|
a/src/qtgui/idxthread.cpp |
|
b/src/qtgui/idxthread.cpp |
|
... |
|
... |
28 |
static QMutex curfile_mutex;
|
28 |
static QMutex curfile_mutex;
|
29 |
|
29 |
|
30 |
class IdxThread : public QThread , public DbIxStatusUpdater {
|
30 |
class IdxThread : public QThread , public DbIxStatusUpdater {
|
31 |
virtual void run();
|
31 |
virtual void run();
|
32 |
public:
|
32 |
public:
|
33 |
virtual void update(const string &fn) {
|
33 |
virtual bool update(const string &fn) {
|
34 |
QMutexLocker locker(&curfile_mutex);
|
34 |
QMutexLocker locker(&curfile_mutex);
|
35 |
m_curfile = fn;
|
35 |
m_curfile = fn;
|
36 |
LOGDEB(("IdxThread::update: indexing %s\n", m_curfile.c_str()));
|
36 |
LOGDEB1(("IdxThread::update: indexing %s\n", m_curfile.c_str()));
|
|
|
37 |
if (stopindexing) {
|
|
|
38 |
stopindexing = 0;
|
|
|
39 |
return false;
|
|
|
40 |
}
|
|
|
41 |
return true;
|
37 |
}
|
42 |
}
|
38 |
ConfIndexer *indexer;
|
43 |
ConfIndexer *indexer;
|
39 |
string m_curfile;
|
44 |
string m_curfile;
|
40 |
int loglevel;
|
45 |
int loglevel;
|
41 |
};
|
46 |
};
|
42 |
|
47 |
|
|
|
48 |
int stopindexing;
|
43 |
int startindexing;
|
49 |
int startindexing;
|
44 |
int indexingdone = 1;
|
50 |
int indexingdone = 1;
|
45 |
bool indexingstatus = false;
|
51 |
IdxThreadStatus indexingstatus = IDXTS_NULL;
|
46 |
|
52 |
string indexingReason;
|
47 |
static int stopidxthread;
|
53 |
static int stopidxthread;
|
48 |
|
54 |
|
49 |
void IdxThread::run()
|
55 |
void IdxThread::run()
|
50 |
{
|
56 |
{
|
51 |
DebugLog::getdbl()->setloglevel(loglevel);
|
57 |
DebugLog::getdbl()->setloglevel(loglevel);
|
|
... |
|
... |
53 |
if (stopidxthread) {
|
59 |
if (stopidxthread) {
|
54 |
delete indexer;
|
60 |
delete indexer;
|
55 |
return;
|
61 |
return;
|
56 |
}
|
62 |
}
|
57 |
if (startindexing) {
|
63 |
if (startindexing) {
|
58 |
indexingdone = indexingstatus = 0;
|
|
|
59 |
fprintf(stderr, "Index thread :start index\n");
|
|
|
60 |
indexingstatus = indexer->index();
|
|
|
61 |
startindexing = 0;
|
64 |
startindexing = 0;
|
|
|
65 |
indexingdone = 0;
|
|
|
66 |
indexingstatus = IDXTS_NULL;
|
|
|
67 |
if (indexer->index()) {
|
|
|
68 |
indexingstatus = IDXTS_OK;
|
|
|
69 |
indexingReason = "";
|
|
|
70 |
} else {
|
|
|
71 |
indexingstatus = IDXTS_ERROR;
|
|
|
72 |
indexingReason = "Indexation failed: " + indexer->getReason();
|
|
|
73 |
}
|
62 |
indexingdone = 1;
|
74 |
indexingdone = 1;
|
63 |
}
|
75 |
}
|
64 |
msleep(100);
|
76 |
msleep(100);
|
65 |
}
|
77 |
}
|
66 |
}
|
78 |
}
|
|
... |
|
... |
78 |
idxthread.start();
|
90 |
idxthread.start();
|
79 |
}
|
91 |
}
|
80 |
|
92 |
|
81 |
void stop_idxthread()
|
93 |
void stop_idxthread()
|
82 |
{
|
94 |
{
|
|
|
95 |
stopindexing = 1;
|
83 |
stopidxthread = 1;
|
96 |
stopidxthread = 1;
|
84 |
idxthread.wait();
|
97 |
idxthread.wait();
|
85 |
}
|
98 |
}
|
86 |
|
99 |
|
87 |
std::string idxthread_currentfile()
|
100 |
std::string idxthread_currentfile()
|