File indexing completed on 2024-04-28 05:49:11
0001 /* 0002 SPDX-FileCopyrightText: 2013 Kåre Särs <kare.sars@iki.fi> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QList> 0010 #include <QRegularExpression> 0011 #include <QStringList> 0012 #include <QThread> 0013 0014 class FolderFilesList : public QThread 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 explicit FolderFilesList(QObject *parent = nullptr); 0020 ~FolderFilesList() override; 0021 0022 void run() override; 0023 0024 void generateList(const QString &folder, bool recursive, bool hidden, bool symlinks, const QString &types, const QString &excludes); 0025 0026 void terminateSearch(); 0027 0028 QStringList fileList(); 0029 0030 Q_SIGNALS: 0031 void searching(const QString &path); 0032 void fileListReady(); 0033 0034 private: 0035 struct DirectoryWithResults { 0036 QString directory; 0037 QStringList newDirectories; 0038 QStringList newFiles; 0039 }; 0040 0041 void checkNextItem(DirectoryWithResults &handleOnFolder) const; 0042 0043 private: 0044 QString m_folder; 0045 QStringList m_files; 0046 bool m_cancelSearch = false; 0047 0048 bool m_recursive = false; 0049 bool m_hidden = false; 0050 bool m_symlinks = false; 0051 QStringList m_types; 0052 QList<QRegularExpression> m_excludes; 0053 };