Baloo

filecontentindexer.h
1/*
2 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
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
18namespace Baloo {
19
20class FileContentIndexerProvider;
21
22class FileContentIndexer : public QObject, public QRunnable
23{
25 Q_CLASSINFO("D-Bus Interface", "org.kde.baloo.fileindexer")
26
27 Q_PROPERTY(QString currentFile READ currentFile NOTIFY startedIndexingFile)
28public:
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
39public Q_SLOTS:
40 Q_SCRIPTABLE void registerMonitor(const QDBusMessage& message);
41 Q_SCRIPTABLE void unregisterMonitor(const QDBusMessage& message);
42
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
50private Q_SLOTS:
51 void monitorClosed(const QString& service);
52 void slotStartedIndexingFile(const QString& filePath);
53 void slotFinishedIndexingFile(const QString& filePath, bool fileUpdated);
54
55private:
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
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
void storeRelaxed(T newValue)
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.