diff --git a/imageringlist.cpp b/imageringlist.cpp index 00690be..4cb5f2b 100644 --- a/imageringlist.cpp +++ b/imageringlist.cpp @@ -146,6 +146,7 @@ bool ImageRingList::setDir(const QString path, const QString ¤tFile, bool if(dir.exists()) { + m_currentDir = path; QStringList scannedDirs; QStringList absolutePaths; std::function scanDir = [&](const QString &path) @@ -174,7 +175,8 @@ bool ImageRingList::setDir(const QString path, const QString ¤tFile, bool //qDebug() << absolutePaths.size(); setFilesPrivate(absolutePaths, m_liveMode ? absolutePaths.first() : currentFile); - m_fileSystemWatcher.removePaths(m_fileSystemWatcher.directories()); + if(m_fileSystemWatcher.directories().size()) + m_fileSystemWatcher.removePaths(m_fileSystemWatcher.directories()); m_fileSystemWatcher.addPath(path); return true; } @@ -212,6 +214,11 @@ ImagePtr ImageRingList::currentImage() return 0; } +QString ImageRingList::currentDir() const +{ + return m_currentDir; +} + void ImageRingList::increment() { if(m_images.size()) @@ -538,9 +545,8 @@ void ImageRingList::imageLoaded(Image *image) } } -void ImageRingList::dirChanged(QString dir) +void ImageRingList::dirChanged(QString) { - m_currentDir = dir; if(m_liveMode) reloadDir(); else diff --git a/imageringlist.h b/imageringlist.h index b285ade..932a215 100644 --- a/imageringlist.h +++ b/imageringlist.h @@ -79,6 +79,7 @@ public: void setFile(const QString &file); void setFiles(QStringList files); ImagePtr currentImage(); + QString currentDir() const; void setLiveMode(bool live); void setCalculateStats(bool stats); void setFindPeaks(bool findPeaks); @@ -117,7 +118,7 @@ signals: void currentImageChanged(int index); protected slots: void imageLoaded(Image *image); - void dirChanged(QString dir); + void dirChanged(QString); void reloadDir(); }; diff --git a/mainwindow.cpp b/mainwindow.cpp index 20954d7..36240b9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -811,8 +811,8 @@ void MainWindow::updateWindowTitle() ImagePtr ptr = m_ringList->currentImage(); if(ptr) { - QFileInfo info(ptr->name()); - QString title = info.fileName(); + QDir dir(m_ringList->currentDir()); + QString title = dir.relativeFilePath(ptr->name()); if(m_database->isMarked(ptr->name())) title += " *"; setWindowTitle(title); diff --git a/settingsdialog.cpp b/settingsdialog.cpp index 8cc99ed..ef12c68 100644 --- a/settingsdialog.cpp +++ b/settingsdialog.cpp @@ -150,10 +150,10 @@ void SettingsDialog::installThumbnailer() QProcess regsvr; int ret = regsvr.execute("regsvr32.exe", {"/s", path}); - if(ret) - { + if(ret == 0) + QMessageBox::information(this, tr("Thumbnail support"), tr("Thumbnail generation support sucessufully installed.")); + else QMessageBox::critical(this, tr("Error"), tr("Failed to register thumbnailer. %1").arg(ret)); - } #endif }