mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Folder Scanning: initial import of the torrents inside is fixed
This commit is contained in:
parent
90207020f2
commit
3c6635cdbe
2 changed files with 8 additions and 3 deletions
|
@ -1249,8 +1249,9 @@ void Bittorrent::enableDirectoryScanning(QString scan_dir) {
|
|||
}
|
||||
if(FSWatcher == 0) {
|
||||
// Set up folder watching
|
||||
FSWatcher = new FileSystemWatcher(scan_dir, this);
|
||||
FSWatcher = new FileSystemWatcher(this);
|
||||
connect(FSWatcher, SIGNAL(torrentsAdded(QStringList&)), this, SLOT(addTorrentsFromScanFolder(QStringList&)));
|
||||
FSWatcher->addPath(scan_dir);
|
||||
} else {
|
||||
QString old_scan_dir = "";
|
||||
if(!FSWatcher->directories().empty())
|
||||
|
|
|
@ -139,6 +139,7 @@ public:
|
|||
} else {
|
||||
#endif
|
||||
// Normal mode
|
||||
qDebug("FS Watching is watching %s in normal mode", path.toLocal8Bit().data());
|
||||
QFileSystemWatcher::addPath(path);
|
||||
scanFolder();
|
||||
#ifndef Q_WS_WIN
|
||||
|
@ -165,11 +166,14 @@ public:
|
|||
protected slots:
|
||||
// XXX: Does not detect file size changes to improve performance.
|
||||
void scanFolder() {
|
||||
qDebug("Scan folder was called");
|
||||
QStringList torrents;
|
||||
if(watch_timer)
|
||||
if(watch_timer) {
|
||||
torrents = watched_folder.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
else
|
||||
} else {
|
||||
torrents = QDir(QFileSystemWatcher::directories().first()).entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
qDebug("FSWatcher: Polling manually folder %s", QFileSystemWatcher::directories().first().toLocal8Bit().data());
|
||||
}
|
||||
if(!torrents.empty())
|
||||
emit torrentsAdded(torrents);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue