Changeset View
Changeset View
Standalone View
Standalone View
src/file/filecontentindexer.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 37 | { | |||
---|---|---|---|---|---|
46 | bus.registerObject(QStringLiteral("/fileindexer"), | 46 | bus.registerObject(QStringLiteral("/fileindexer"), | ||
47 | this, QDBusConnection::ExportScriptableContents); | 47 | this, QDBusConnection::ExportScriptableContents); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | void FileContentIndexer::run() | 50 | void FileContentIndexer::run() | ||
51 | { | 51 | { | ||
52 | ExtractorProcess process; | 52 | ExtractorProcess process; | ||
53 | connect(&process, &ExtractorProcess::startedIndexingFile, this, &FileContentIndexer::slotStartedIndexingFile); | 53 | connect(&process, &ExtractorProcess::startedIndexingFile, this, &FileContentIndexer::slotStartedIndexingFile); | ||
54 | connect(&process, &ExtractorProcess::startedIndexingFile, this, &FileContentIndexer::slotFinishedIndexingFile); | 54 | connect(&process, &ExtractorProcess::finishedIndexingFile, this, &FileContentIndexer::slotFinishedIndexingFile); | ||
55 | 55 | | |||
56 | m_stop.store(false); | 56 | m_stop.store(false); | ||
57 | while (m_provider->size() && !m_stop.load()) { | 57 | while (m_provider->size() && !m_stop.load()) { | ||
58 | // | 58 | // | ||
59 | // WARNING: This will go mad, if the Extractor does not commit after N=m_batchSize files | 59 | // WARNING: This will go mad, if the Extractor does not commit after N=m_batchSize files | ||
60 | // cause then we will keep fetching the same N files again and again. | 60 | // cause then we will keep fetching the same N files again and again. | ||
61 | // | 61 | // | ||
62 | QElapsedTimer timer; | 62 | QElapsedTimer timer; | ||
Show All 25 Lines | |||||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | void FileContentIndexer::slotFinishedIndexingFile(const QString& filePath) | 90 | void FileContentIndexer::slotFinishedIndexingFile(const QString& filePath) | ||
91 | { | 91 | { | ||
92 | Q_UNUSED(filePath); | 92 | Q_UNUSED(filePath); | ||
93 | if (!m_registeredMonitors.isEmpty()) { | 93 | if (!m_registeredMonitors.isEmpty()) { | ||
94 | Q_EMIT finishedIndexingFile(filePath); | 94 | Q_EMIT finishedIndexingFile(filePath); | ||
95 | } | 95 | } | ||
96 | m_currentFile = QString(); | ||||
96 | } | 97 | } | ||
97 | 98 | | |||
98 | void FileContentIndexer::registerMonitor(const QDBusMessage& message) | 99 | void FileContentIndexer::registerMonitor(const QDBusMessage& message) | ||
99 | { | 100 | { | ||
100 | if (!m_registeredMonitors.contains(message.service())) { | 101 | if (!m_registeredMonitors.contains(message.service())) { | ||
101 | m_registeredMonitors << message.service(); | 102 | m_registeredMonitors << message.service(); | ||
102 | m_monitorWatcher.addWatchedService(message.service()); | 103 | m_monitorWatcher.addWatchedService(message.service()); | ||
103 | } | 104 | } | ||
Show All 13 Lines |