|
a/src/qtgui/rclm_idx.cpp |
|
b/src/qtgui/rclm_idx.cpp |
|
... |
|
... |
28 |
#include "indexer.h"
|
28 |
#include "indexer.h"
|
29 |
#include "rclmain_w.h"
|
29 |
#include "rclmain_w.h"
|
30 |
#include "specialindex.h"
|
30 |
#include "specialindex.h"
|
31 |
#include "readfile.h"
|
31 |
#include "readfile.h"
|
32 |
#include "snippets_w.h"
|
32 |
#include "snippets_w.h"
|
|
|
33 |
#include "idxstatus.h"
|
33 |
|
34 |
|
34 |
using namespace std;
|
35 |
using namespace std;
|
35 |
|
36 |
|
|
|
37 |
|
|
|
38 |
// This is called from periodic100 if we started an indexer, or from
|
|
|
39 |
// the rclmain idxstatus file watcher, every time the file changes.
|
36 |
void RclMain::updateIdxStatus()
|
40 |
void RclMain::updateIdxStatus()
|
37 |
{
|
41 |
{
|
38 |
ConfSimple cs(theconfig->getIdxStatusFile().c_str(), 1);
|
42 |
DbIxStatus status;
|
|
|
43 |
readIdxStatus(theconfig, status);
|
39 |
QString msg = tr("Indexing in progress: ");
|
44 |
QString msg = tr("Indexing in progress: ");
|
40 |
DbIxStatus status;
|
|
|
41 |
string val;
|
|
|
42 |
cs.get("phase", val);
|
|
|
43 |
status.phase = DbIxStatus::Phase(atoi(val.c_str()));
|
|
|
44 |
cs.get("fn", status.fn);
|
|
|
45 |
cs.get("docsdone", &status.docsdone);
|
|
|
46 |
cs.get("filesdone", &status.filesdone);
|
|
|
47 |
cs.get("fileerrors", &status.fileerrors);
|
|
|
48 |
cs.get("dbtotdocs", &status.dbtotdocs);
|
|
|
49 |
cs.get("totfiles", &status.totfiles);
|
|
|
50 |
|
|
|
51 |
QString phs;
|
45 |
QString phs;
|
52 |
switch (status.phase) {
|
46 |
switch (status.phase) {
|
53 |
case DbIxStatus::DBIXS_NONE:phs=tr("None");break;
|
47 |
case DbIxStatus::DBIXS_NONE:phs=tr("None");break;
|
54 |
case DbIxStatus::DBIXS_FILES: phs=tr("Updating");break;
|
48 |
case DbIxStatus::DBIXS_FILES: phs=tr("Updating");break;
|
55 |
case DbIxStatus::DBIXS_PURGE: phs=tr("Purge");break;
|
49 |
case DbIxStatus::DBIXS_PURGE: phs=tr("Purge");break;
|
|
... |
|
... |
151 |
actionSpecial_Indexing->setEnabled(false);
|
145 |
actionSpecial_Indexing->setEnabled(false);
|
152 |
periodictimer->setInterval(200);
|
146 |
periodictimer->setInterval(200);
|
153 |
} else {
|
147 |
} else {
|
154 |
Pidfile pidfile(theconfig->getPidfile());
|
148 |
Pidfile pidfile(theconfig->getPidfile());
|
155 |
pid_t pid = pidfile.open();
|
149 |
pid_t pid = pidfile.open();
|
|
|
150 |
fileBumpIndexingAction->setEnabled(false);
|
156 |
if (pid == getpid()) {
|
151 |
if (pid == getpid()) {
|
157 |
// Locked by me
|
152 |
// Locked by me
|
158 |
m_indexerState = IXST_NOTRUNNING;
|
153 |
m_indexerState = IXST_NOTRUNNING;
|
159 |
fileToggleIndexingAction->setText(tr("Index locked"));
|
154 |
fileToggleIndexingAction->setText(tr("Index locked"));
|
160 |
fileToggleIndexingAction->setEnabled(false);
|
155 |
fileToggleIndexingAction->setEnabled(false);
|
|
... |
|
... |
170 |
periodictimer->setInterval(1000);
|
165 |
periodictimer->setInterval(1000);
|
171 |
} else {
|
166 |
} else {
|
172 |
// Real time or externally started batch indexer running
|
167 |
// Real time or externally started batch indexer running
|
173 |
m_indexerState = IXST_RUNNINGNOTMINE;
|
168 |
m_indexerState = IXST_RUNNINGNOTMINE;
|
174 |
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
169 |
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
|
|
170 |
DbIxStatus status;
|
|
|
171 |
readIdxStatus(theconfig, status);
|
|
|
172 |
if (status.hasmonitor) {
|
|
|
173 |
// Real-time indexer running. We can trigger an
|
|
|
174 |
// incremental pass
|
|
|
175 |
fileBumpIndexingAction->setEnabled(true);
|
|
|
176 |
}
|
175 |
fileToggleIndexingAction->setEnabled(true);
|
177 |
fileToggleIndexingAction->setEnabled(true);
|
176 |
fileRebuildIndexAction->setEnabled(false);
|
178 |
fileRebuildIndexAction->setEnabled(false);
|
177 |
actionSpecial_Indexing->setEnabled(false);
|
179 |
actionSpecial_Indexing->setEnabled(false);
|
178 |
periodictimer->setInterval(200);
|
180 |
periodictimer->setInterval(200);
|
179 |
}
|
181 |
}
|
|
... |
|
... |
290 |
case IXST_UNKNOWN:
|
292 |
case IXST_UNKNOWN:
|
291 |
return;
|
293 |
return;
|
292 |
}
|
294 |
}
|
293 |
}
|
295 |
}
|
294 |
|
296 |
|
|
|
297 |
#ifndef _WIN32
|
|
|
298 |
void RclMain::bumpIndexing()
|
|
|
299 |
{
|
|
|
300 |
DbIxStatus status;
|
|
|
301 |
readIdxStatus(theconfig, status);
|
|
|
302 |
if (status.hasmonitor) {
|
|
|
303 |
string cmd("touch ");
|
|
|
304 |
string path = path_cat(theconfig->getConfDir(), "recoll.conf");
|
|
|
305 |
cmd += path;
|
|
|
306 |
system(cmd.c_str());
|
|
|
307 |
}
|
|
|
308 |
}
|
|
|
309 |
#endif
|
|
|
310 |
|
295 |
static void delay(int millisecondsWait)
|
311 |
static void delay(int millisecondsWait)
|
296 |
{
|
312 |
{
|
297 |
QEventLoop loop;
|
313 |
QEventLoop loop;
|
298 |
QTimer t;
|
314 |
QTimer t;
|
299 |
t.connect(&t, &QTimer::timeout, &loop, &QEventLoop::quit);
|
315 |
t.connect(&t, &QTimer::timeout, &loop, &QEventLoop::quit);
|