|
a/src/qtgui/idxthread.cpp |
|
b/src/qtgui/idxthread.cpp |
|
... |
|
... |
25 |
#include "debuglog.h"
|
25 |
#include "debuglog.h"
|
26 |
#include "idxthread.h"
|
26 |
#include "idxthread.h"
|
27 |
#include "smallut.h"
|
27 |
#include "smallut.h"
|
28 |
#include "rclinit.h"
|
28 |
#include "rclinit.h"
|
29 |
|
29 |
|
30 |
int stopindexing;
|
30 |
static int stopindexing;
|
31 |
int startindexing;
|
31 |
static int startindexing;
|
|
|
32 |
static bool rezero;
|
32 |
IdxThreadStatus indexingstatus = IDXTS_OK;
|
33 |
static IdxThreadStatus indexingstatus = IDXTS_OK;
|
33 |
string indexingReason;
|
34 |
static string indexingReason;
|
34 |
static int stopidxthread;
|
35 |
static int stopidxthread;
|
35 |
|
36 |
|
36 |
static QMutex curfile_mutex;
|
37 |
static QMutex curfile_mutex;
|
37 |
|
38 |
|
38 |
class IdxThread : public QThread , public DbIxStatusUpdater {
|
39 |
class IdxThread : public QThread , public DbIxStatusUpdater {
|
|
... |
|
... |
72 |
int loglevel;
|
73 |
int loglevel;
|
73 |
myconf->setKeyDir("");
|
74 |
myconf->setKeyDir("");
|
74 |
myconf->getConfParam("loglevel", &loglevel);
|
75 |
myconf->getConfParam("loglevel", &loglevel);
|
75 |
DebugLog::getdbl()->setloglevel(loglevel);
|
76 |
DebugLog::getdbl()->setloglevel(loglevel);
|
76 |
ConfIndexer *indexer = new ConfIndexer(myconf, this);
|
77 |
ConfIndexer *indexer = new ConfIndexer(myconf, this);
|
77 |
if (indexer->index()) {
|
78 |
if (indexer->index(rezero)) {
|
78 |
indexingstatus = IDXTS_OK;
|
79 |
indexingstatus = IDXTS_OK;
|
79 |
indexingReason = "";
|
80 |
indexingReason = "";
|
80 |
} else {
|
81 |
} else {
|
81 |
indexingstatus = IDXTS_ERROR;
|
82 |
indexingstatus = IDXTS_ERROR;
|
82 |
indexingReason = "Indexing failed: " + indexer->getReason();
|
83 |
indexingReason = "Indexing failed: " + indexer->getReason();
|
83 |
}
|
84 |
}
|
|
|
85 |
rezero = false;
|
84 |
delete indexer;
|
86 |
delete indexer;
|
85 |
}
|
87 |
}
|
86 |
msleep(100);
|
88 |
msleep(100);
|
87 |
}
|
89 |
}
|
88 |
}
|
90 |
}
|
|
... |
|
... |
99 |
{
|
101 |
{
|
100 |
stopindexing = 1;
|
102 |
stopindexing = 1;
|
101 |
stopidxthread = 1;
|
103 |
stopidxthread = 1;
|
102 |
idxthread.wait();
|
104 |
idxthread.wait();
|
103 |
}
|
105 |
}
|
104 |
|
106 |
void stop_indexing()
|
|
|
107 |
{
|
|
|
108 |
stopindexing = 1;
|
|
|
109 |
}
|
|
|
110 |
void start_indexing(bool raz)
|
|
|
111 |
{
|
|
|
112 |
startindexing = 1;
|
|
|
113 |
rezero = raz;
|
|
|
114 |
}
|
105 |
DbIxStatus idxthread_idxStatus()
|
115 |
DbIxStatus idxthread_idxStatus()
|
106 |
{
|
116 |
{
|
107 |
QMutexLocker locker(&curfile_mutex);
|
117 |
QMutexLocker locker(&curfile_mutex);
|
108 |
return idxthread.m_statusSnap;
|
118 |
return idxthread.m_statusSnap;
|
109 |
}
|
119 |
}
|
110 |
bool idxthread_idxInterrupted()
|
120 |
bool idxthread_idxInterrupted()
|
111 |
{
|
121 |
{
|
112 |
return idxthread.m_interrupted;
|
122 |
return idxthread.m_interrupted;
|
113 |
}
|
123 |
}
|
|
|
124 |
string idxthread_getReason()
|
|
|
125 |
{
|
|
|
126 |
return indexingReason;
|
|
|
127 |
}
|
|
|
128 |
IdxThreadStatus idxthread_getStatus()
|
|
|
129 |
{
|
|
|
130 |
return indexingstatus;
|
|
|
131 |
}
|