|
a/src/qtgui/idxthread.cpp |
|
b/src/qtgui/idxthread.cpp |
|
... |
|
... |
40 |
stopindexing = 0;
|
40 |
stopindexing = 0;
|
41 |
return false;
|
41 |
return false;
|
42 |
}
|
42 |
}
|
43 |
return true;
|
43 |
return true;
|
44 |
}
|
44 |
}
|
45 |
ConfIndexer *indexer;
|
|
|
46 |
// Maintain a copy/snapshot of idx status
|
45 |
// Maintain a copy/snapshot of idx status
|
47 |
DbIxStatus m_statusSnap;
|
46 |
DbIxStatus m_statusSnap;
|
48 |
int loglevel;
|
47 |
const RclConfig *cnf;
|
49 |
};
|
48 |
};
|
50 |
|
49 |
|
51 |
int stopindexing;
|
50 |
int stopindexing;
|
52 |
int startindexing;
|
51 |
int startindexing;
|
53 |
int indexingdone = 1;
|
52 |
int indexingdone = 1;
|
|
... |
|
... |
55 |
string indexingReason;
|
54 |
string indexingReason;
|
56 |
static int stopidxthread;
|
55 |
static int stopidxthread;
|
57 |
|
56 |
|
58 |
void IdxThread::run()
|
57 |
void IdxThread::run()
|
59 |
{
|
58 |
{
|
60 |
DebugLog::getdbl()->setloglevel(loglevel);
|
|
|
61 |
recoll_threadinit();
|
59 |
recoll_threadinit();
|
62 |
for (;;) {
|
60 |
for (;;) {
|
63 |
if (stopidxthread) {
|
61 |
if (stopidxthread) {
|
64 |
deleteZ(indexer);
|
|
|
65 |
return;
|
62 |
return;
|
66 |
}
|
63 |
}
|
67 |
if (startindexing) {
|
64 |
if (startindexing) {
|
68 |
startindexing = 0;
|
65 |
startindexing = 0;
|
69 |
indexingdone = 0;
|
66 |
indexingdone = 0;
|
70 |
indexingstatus = IDXTS_NULL;
|
67 |
indexingstatus = IDXTS_NULL;
|
|
|
68 |
// We have to make a copy of the config (setKeydir changes
|
|
|
69 |
// it during indexation)
|
|
|
70 |
RclConfig *myconf = new RclConfig(*cnf);
|
|
|
71 |
int loglevel;
|
|
|
72 |
myconf->setKeyDir("");
|
|
|
73 |
myconf->getConfParam("loglevel", &loglevel);
|
|
|
74 |
DebugLog::getdbl()->setloglevel(loglevel);
|
|
|
75 |
ConfIndexer *indexer = new ConfIndexer(myconf, this);
|
71 |
if (indexer->index()) {
|
76 |
if (indexer->index()) {
|
72 |
indexingstatus = IDXTS_OK;
|
77 |
indexingstatus = IDXTS_OK;
|
73 |
indexingReason = "";
|
78 |
indexingReason = "";
|
74 |
} else {
|
79 |
} else {
|
75 |
indexingstatus = IDXTS_ERROR;
|
80 |
indexingstatus = IDXTS_ERROR;
|
76 |
indexingReason = "Indexation failed: " + indexer->getReason();
|
81 |
indexingReason = "Indexing failed: " + indexer->getReason();
|
77 |
}
|
82 |
}
|
78 |
indexingdone = 1;
|
83 |
indexingdone = 1;
|
|
|
84 |
delete indexer;
|
79 |
}
|
85 |
}
|
80 |
msleep(100);
|
86 |
msleep(100);
|
81 |
}
|
87 |
}
|
82 |
}
|
88 |
}
|
83 |
|
89 |
|
84 |
static IdxThread idxthread;
|
90 |
static IdxThread idxthread;
|
85 |
|
91 |
|
86 |
void start_idxthread(const RclConfig& cnf)
|
92 |
void start_idxthread(const RclConfig& cnf)
|
87 |
{
|
93 |
{
|
88 |
// We have to make a copy of the config (setKeydir changes it during
|
94 |
idxthread.cnf = &cnf;
|
89 |
// indexation)
|
|
|
90 |
RclConfig *myconf = new RclConfig(cnf);
|
|
|
91 |
idxthread.indexer = new ConfIndexer(myconf, &idxthread);
|
|
|
92 |
idxthread.loglevel = DebugLog::getdbl()->getlevel();
|
|
|
93 |
idxthread.start();
|
95 |
idxthread.start();
|
94 |
}
|
96 |
}
|
95 |
|
97 |
|
96 |
void stop_idxthread()
|
98 |
void stop_idxthread()
|
97 |
{
|
99 |
{
|