-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gallery] Move indexing into separate thread
- Loading branch information
Showing
5 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2025 Chupligin Sergey <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include "filesystemworker.h" | ||
|
||
#include <QDir> | ||
#include <QDirIterator> | ||
|
||
FileSystemWorker::FileSystemWorker(QStringList dirList, QStringList suffixes, QObject *parent) | ||
: QObject{parent} | ||
, m_dirs(dirList) | ||
, m_suffixes(suffixes) | ||
, m_busy(false) | ||
{ | ||
} | ||
|
||
void FileSystemWorker::start() | ||
{ | ||
m_busy = true; | ||
foreach (const QString& dirString, m_dirs) { | ||
QDirIterator it(dirString, m_suffixes, QDir::Files, QDirIterator::Subdirectories); | ||
while (it.hasNext()) { | ||
emit foundFile(it.next()); | ||
} | ||
} | ||
m_busy = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2025 Chupligin Sergey <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifndef FILESYSTEMWORKER_H | ||
#define FILESYSTEMWORKER_H | ||
|
||
#include <QObject> | ||
|
||
class FileSystemWorker : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit FileSystemWorker(QStringList dirList, QStringList suffixes, QObject *parent = nullptr); | ||
|
||
bool busy() {return m_busy;} | ||
|
||
void start(); | ||
void stop(); | ||
|
||
signals: | ||
void foundFile(QString path); | ||
|
||
private: | ||
QStringList m_dirs; | ||
QStringList m_suffixes; | ||
bool m_busy; | ||
}; | ||
|
||
#endif // FILESYSTEMWORKER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters