File indexing completed on 2024-05-05 04:50:32
0001 /* 0002 SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr> 0003 0004 SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #ifndef ABSTRACTFILELISTENER_H 0008 #define ABSTRACTFILELISTENER_H 0009 0010 #include <QObject> 0011 #include <QString> 0012 0013 #include "datatypes.h" 0014 0015 #include <memory> 0016 0017 class AbstractFileListenerPrivate; 0018 class DatabaseInterface; 0019 class AbstractFileListing; 0020 0021 class AbstractFileListener : public QObject 0022 { 0023 Q_OBJECT 0024 0025 Q_PROPERTY(DatabaseInterface* databaseInterface 0026 READ databaseInterface 0027 WRITE setDatabaseInterface 0028 NOTIFY databaseInterfaceChanged) 0029 0030 public: 0031 explicit AbstractFileListener(QObject *parent = nullptr); 0032 0033 ~AbstractFileListener() override; 0034 0035 [[nodiscard]] DatabaseInterface* databaseInterface() const; 0036 0037 [[nodiscard]] AbstractFileListing* fileListing() const; 0038 0039 [[nodiscard]] bool canHandleRootPaths() const; 0040 0041 Q_SIGNALS: 0042 0043 void databaseInterfaceChanged(); 0044 0045 void newTrackFile(const DataTypes::TrackDataType &newTrack); 0046 0047 void indexingStarted(); 0048 0049 void indexingFinished(); 0050 0051 void configurationChanged(); 0052 0053 void clearDatabase(); 0054 0055 public Q_SLOTS: 0056 0057 void setDatabaseInterface(DatabaseInterface* databaseInterface); 0058 0059 void applicationAboutToQuit(); 0060 0061 void quitListener(); 0062 0063 void setAllRootPaths(const QStringList &allRootPaths); 0064 0065 protected: 0066 0067 void setFileListing(AbstractFileListing *fileIndexer); 0068 0069 private: 0070 0071 std::unique_ptr<AbstractFileListenerPrivate> d; 0072 0073 }; 0074 0075 #endif // ABSTRACTFILELISTENER_H