Allow change of preload without restart
This commit is contained in:
@@ -348,6 +348,35 @@ QVariant ImageRingList::headerData(int section, Qt::Orientation orientation, int
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void ImageRingList::setPreload(int width)
|
||||
{
|
||||
DEFAULT_WIDTH = width;
|
||||
if(m_images.size() == 0)return;
|
||||
|
||||
int newWidth = DEFAULT_WIDTH<m_images.size()/2 ? DEFAULT_WIDTH : m_images.size()/2;
|
||||
if(newWidth > m_width)
|
||||
{
|
||||
for(int i = newWidth - m_width; i>0; i--)
|
||||
{
|
||||
m_firstImage = decrement(m_firstImage);
|
||||
(*m_firstImage)->load();
|
||||
m_lastImage = increment(m_lastImage);
|
||||
(*m_lastImage)->load();
|
||||
}
|
||||
}
|
||||
if(newWidth < m_width)
|
||||
{
|
||||
for(int i = m_width - newWidth; i>0; i--)
|
||||
{
|
||||
(*m_firstImage)->release();
|
||||
m_firstImage = increment(m_firstImage);
|
||||
(*m_lastImage)->release();
|
||||
m_lastImage = decrement(m_lastImage);
|
||||
}
|
||||
}
|
||||
m_width = newWidth;
|
||||
}
|
||||
|
||||
void ImageRingList::setFiles(const QStringList files, const QString ¤tFile)
|
||||
{
|
||||
QThreadPool::globalInstance()->clear();
|
||||
|
||||
Reference in New Issue
Block a user