File indexing completed on 2024-04-28 03:51:47
0001 /* 0002 This file is part of the KDE Baloo Project 0003 SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef EXTRACTOR_APP_H 0009 #define EXTRACTOR_APP_H 0010 0011 #include <QVector> 0012 #include <QMimeDatabase> 0013 #include <QSocketNotifier> 0014 #include <QFile> 0015 0016 #include <KFileMetaData/ExtractorCollection> 0017 0018 #include "database.h" 0019 #include "extractor/commandpipe.h" 0020 #include "../fileindexerconfig.h" 0021 0022 class KIdleTime; 0023 class QString; 0024 0025 namespace Baloo { 0026 0027 class Transaction; 0028 0029 class App : public QObject 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 explicit App(QObject* parent = nullptr); 0035 0036 private Q_SLOTS: 0037 void slotNewBatch(const QVector<quint64>& ids); 0038 void processNextFile(); 0039 0040 private: 0041 bool index(Transaction* tr, const QString& filePath, quint64 id); 0042 0043 QMimeDatabase m_mimeDb; 0044 0045 KFileMetaData::ExtractorCollection m_extractorCollection; 0046 0047 FileIndexerConfig m_config; 0048 0049 QSocketNotifier m_notifyNewData; 0050 QFile m_input; 0051 QFile m_output; 0052 Private::WorkerPipe m_workerPipe; 0053 0054 KIdleTime* m_idleTime = nullptr; 0055 bool m_isBusy = true; 0056 0057 QVector<quint64> m_ids; 0058 Transaction* m_tr; 0059 }; 0060 0061 } 0062 #endif