Add simple live mode that show last image added to directory
This commit is contained in:
+8
-2
@@ -94,6 +94,7 @@ void Image::imageLoaded(QImage img)
|
||||
}
|
||||
|
||||
ImageRingList::ImageRingList(QObject *parent) : QObject(parent)
|
||||
, m_liveMode(false)
|
||||
{
|
||||
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
|
||||
}
|
||||
@@ -107,13 +108,13 @@ bool ImageRingList::setDir(const QString path, const QString ¤tFile)
|
||||
QStringList nameFilter;
|
||||
nameFilter << "*.jpg" << "*.png" << "*.cr2";
|
||||
|
||||
QStringList list = dir.entryList(nameFilter, QDir::Files | QDir::Readable, QDir::Name);
|
||||
QStringList list = dir.entryList(nameFilter, QDir::Files | QDir::Readable, m_liveMode ? QDir::Time : QDir::Name);
|
||||
QStringList absolutePaths;
|
||||
foreach(const QString &file, list)
|
||||
{
|
||||
absolutePaths.append(dir.absoluteFilePath(file));
|
||||
}
|
||||
setFiles(absolutePaths, currentFile);
|
||||
setFiles(absolutePaths, m_liveMode ? list.first() : currentFile);
|
||||
|
||||
m_fileSystemWatcher.removePaths(m_fileSystemWatcher.directories());
|
||||
m_fileSystemWatcher.addPath(path);
|
||||
@@ -162,6 +163,11 @@ void ImageRingList::decrement()
|
||||
}
|
||||
}
|
||||
|
||||
void ImageRingList::setLiveMode(bool live)
|
||||
{
|
||||
m_liveMode = live;
|
||||
}
|
||||
|
||||
void ImageRingList::setFiles(const QStringList files, const QString ¤tFile)
|
||||
{
|
||||
m_images.clear();
|
||||
|
||||
Reference in New Issue
Block a user