1 | /* |
2 | This file is part of the KDE Baloo Project |
3 | SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
6 | */ |
7 | |
8 | #ifndef EXTRACTOR_APP_H |
9 | #define |
10 | |
11 | #include <QVector> |
12 | #include <QMimeDatabase> |
13 | #include <QSocketNotifier> |
14 | #include <QFile> |
15 | |
16 | #include <memory> |
17 | |
18 | #include <KFileMetaData/ExtractorCollection> |
19 | |
20 | #include "database.h" |
21 | #include "extractor/commandpipe.h" |
22 | #include "../fileindexerconfig.h" |
23 | |
24 | class KIdleTime; |
25 | class QString; |
26 | |
27 | namespace Baloo { |
28 | |
29 | class Transaction; |
30 | |
31 | class App : public QObject |
32 | { |
33 | Q_OBJECT |
34 | |
35 | public: |
36 | explicit App(QObject* parent = nullptr); |
37 | ~App(); |
38 | |
39 | private Q_SLOTS: |
40 | void slotNewBatch(const QVector<quint64>& ids); |
41 | void processNextFile(); |
42 | |
43 | private: |
44 | bool index(Transaction* tr, const QString& filePath, quint64 id); |
45 | |
46 | QMimeDatabase m_mimeDb; |
47 | |
48 | KFileMetaData::ExtractorCollection ; |
49 | |
50 | FileIndexerConfig m_config; |
51 | |
52 | QSocketNotifier m_notifyNewData; |
53 | QFile m_input; |
54 | QFile m_output; |
55 | Private::WorkerPipe m_workerPipe; |
56 | |
57 | KIdleTime* m_idleTime = nullptr; |
58 | bool m_isBusy = true; |
59 | |
60 | QVector<quint64> m_ids; |
61 | std::unique_ptr<Transaction> m_tr; |
62 | }; |
63 | |
64 | } |
65 | #endif |
66 | |