Baloo

filecontentindexer.h
1 /*
2  SPDX-FileCopyrightText: 2015 Vishesh Handa <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef BALOO_FILECONTENTINDEXER_H
8 #define BALOO_FILECONTENTINDEXER_H
9 
10 #include <QRunnable>
11 #include <QObject>
12 #include <QAtomicInt>
13 #include <QStringList>
14 
15 #include <QDBusServiceWatcher>
16 #include <QDBusMessage>
17 
18 namespace Baloo {
19 
20 class FileContentIndexerProvider;
21 
22 class FileContentIndexer : public QObject, public QRunnable
23 {
24  Q_OBJECT
25  Q_CLASSINFO("D-Bus Interface", "org.kde.baloo.fileindexer")
26 
27  Q_PROPERTY(QString currentFile READ currentFile NOTIFY startedIndexingFile)
28 public:
29  FileContentIndexer(uint batchSize, FileContentIndexerProvider* provider, uint& finishedCount, QObject* parent = nullptr);
30 
31  QString currentFile() { return m_currentFile; }
32 
33  void run() override;
34 
35  void quit() {
36  m_stop.storeRelaxed(true);
37  }
38 
39 public Q_SLOTS:
40  Q_SCRIPTABLE void registerMonitor(const QDBusMessage& message);
41  Q_SCRIPTABLE void unregisterMonitor(const QDBusMessage& message);
42 
43 Q_SIGNALS:
44  Q_SCRIPTABLE void startedIndexingFile(const QString& filePath);
45  Q_SCRIPTABLE void finishedIndexingFile(const QString& filePath);
46  Q_SCRIPTABLE void committedBatch(uint time, uint batchSize);
47 
48  void done();
49 
50 private Q_SLOTS:
51  void monitorClosed(const QString& service);
52  void slotStartedIndexingFile(const QString& filePath);
53  void slotFinishedIndexingFile(const QString& filePath, bool fileUpdated);
54 
55 private:
56  uint m_batchSize;
57  FileContentIndexerProvider* m_provider;
58  uint& m_finishedCount;
59 
60  QAtomicInt m_stop;
61 
62  QString m_currentFile;
63  QStringList m_updatedFiles;
64 
65  QStringList m_registeredMonitors;
66  QDBusServiceWatcher m_monitorWatcher;
67 
68  QString m_extractorPath;
69 };
70 
71 }
72 
73 #endif // BALOO_FILECONTENTINDEXER_H
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Q_CLASSINFO(Name, Value)
QAction * quit(const QObject *recvr, const char *slot, QObject *parent)
Implements storage for docIds without any associated data Instantiated for:
Definition: coding.cpp:11
KIOWIDGETS_EXPORT bool run(const QUrl &_url, bool _is_local)
Q_SIGNALSQ_SIGNALS
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 03:56:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.