connect (myWatcher, SIGNAL(directoryChanged(const QString&)),
this, SLOT(watcherActivated(const QString&)));
//std::cerr << "watching " << qPrintable(path) << " for new .torrent files" << std::endl;
- watcherActivated (path); // trigger the watchdir for .torrent files in there already
+ QTimer::singleShot (0, this, SLOT (rescanAllWatchedDirectories ())); // trigger the watchdir for .torrent files in there already
}
}
// for comparison the next time around
myWatchDirFiles = files;
}
+
+void
+WatchDir :: rescanAllWatchedDirectories ()
+{
+ if (myWatcher == nullptr)
+ return;
+
+ foreach (const QString& path, myWatcher->directories ())
+ watcherActivated (path);
+}
void watcherActivated (const QString& path);
void onTimeout ();
+ private slots:
+ void rescanAllWatchedDirectories ();
+
private:
const TorrentModel& myModel;
QSet<QString> myWatchDirFiles;