--- a/src/qtgui/idxthread.cpp
+++ b/src/qtgui/idxthread.cpp
@@ -19,15 +19,25 @@
#include <qthread.h>
+#include <qmutex.h>
#include "indexer.h"
#include "debuglog.h"
#include "idxthread.h"
-class IdxThread : public QThread {
+static QMutex curfile_mutex;
+
+class IdxThread : public QThread , public DbIxStatusUpdater {
virtual void run();
public:
+ virtual void update(const string &fn) {
+ QMutexLocker locker(&curfile_mutex);
+ m_curfile = fn;
+ LOGDEB(("IdxThread::update: indexing %s\n", m_curfile.c_str()));
+ }
ConfIndexer *indexer;
+ string m_curfile;
+ int loglevel;
};
int startindexing;
@@ -38,7 +48,7 @@
void IdxThread::run()
{
- DebugLog::getdbl()->setloglevel(DEBDEB1);
+ DebugLog::getdbl()->setloglevel(loglevel);
for (;;) {
if (stopidxthread) {
delete indexer;
@@ -62,8 +72,9 @@
// We have to make a copy of the config (setKeydir changes it during
// indexation)
RclConfig *myconf = new RclConfig(cnf);
- ConfIndexer *ix = new ConfIndexer(myconf);
+ ConfIndexer *ix = new ConfIndexer(myconf, &idxthread);
idxthread.indexer = ix;
+ idxthread.loglevel = DebugLog::getdbl()->getlevel();
idxthread.start();
}
@@ -72,3 +83,9 @@
stopidxthread = 1;
idxthread.wait();
}
+
+std::string idxthread_currentfile()
+{
+ QMutexLocker locker(&curfile_mutex);
+ return(idxthread.m_curfile);
+}