diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index a27f934e..df9f2545 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: indexer.cpp,v 1.25 2006-03-20 16:05:41 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: indexer.cpp,v 1.26 2006-03-22 16:24:41 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -200,6 +200,8 @@ FsTreeWalker::Status DbIndexer::processone(const std::string &fn, const struct stat *stp, FsTreeWalker::CbFlag flg) { + if (m_updfunc) + m_updfunc->update(fn); // If we're changing directories, possibly adjust parameters (set // the current directory in configuration object) if (flg == FsTreeWalker::FtwDirEnter || @@ -309,7 +311,7 @@ bool ConfIndexer::index(bool resetbefore) // cout << *dit << " "; //} //cout << endl; - dbindexer = new DbIndexer(config, dbit->first); + dbindexer = new DbIndexer(config, dbit->first, m_updfunc); if (!dbindexer->indexDb(resetbefore, &dbit->second)) { deleteZ(dbindexer); return false; diff --git a/src/index/indexer.h b/src/index/indexer.h index 213cb202..d84dfea0 100644 --- a/src/index/indexer.h +++ b/src/index/indexer.h @@ -16,7 +16,7 @@ */ #ifndef _INDEXER_H_INCLUDED_ #define _INDEXER_H_INCLUDED_ -/* @(#$Id: indexer.h,v 1.10 2006-01-30 11:15:27 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: indexer.h,v 1.11 2006-03-22 16:24:41 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -28,6 +28,13 @@ /* Forward decl for lower level indexing object */ class DbIndexer; +/* Callback to say what we're doing */ +class DbIxStatusUpdater { + public: + virtual ~DbIxStatusUpdater(){} + virtual void update(const std::string &) = 0; +}; + /** The top level indexing object. Processes the configuration, then invokes file system walking to populate/update the database(s). @@ -40,15 +47,16 @@ class DbIndexer; class ConfIndexer { public: enum runStatus {IndexerOk, IndexerError}; - ConfIndexer(RclConfig *cnf) : config(cnf), dbindexer(0) - { - } + ConfIndexer(RclConfig *cnf, DbIxStatusUpdater *updfunc = 0) + : config(cnf), dbindexer(0), m_updfunc(updfunc) + {} virtual ~ConfIndexer(); /** Worker function: doe the actual indexing */ bool index(bool resetbefore = false); private: - RclConfig *config; - DbIndexer *dbindexer; // Object to process directories for a given db + RclConfig *config; + DbIndexer *dbindexer; // Object to process directories for a given db + DbIxStatusUpdater *m_updfunc; }; /** Index things into one database @@ -64,8 +72,11 @@ Single file(s) indexing: no database purging or stem db updating. class DbIndexer : public FsTreeWalkerCB { public: /** Constructor does nothing but store parameters */ - DbIndexer(RclConfig *cnf, const std::string &dbd) - : config(cnf), dbdir(dbd) { + DbIndexer(RclConfig *cnf, // Configuration data + const std::string &dbd, // Place where the db lives + DbIxStatusUpdater *updfunc = 0 // status updater callback + ) + : config(cnf), dbdir(dbd), m_updfunc(updfunc) { } virtual ~DbIndexer(); @@ -99,6 +110,7 @@ class DbIndexer : public FsTreeWalkerCB { std::string dbdir; Rcl::Db db; std::string tmpdir; + DbIxStatusUpdater *m_updfunc; bool init(bool rst = false); }; diff --git a/src/qtgui/idxthread.cpp b/src/qtgui/idxthread.cpp index 5cd69ccc..dab680fd 100644 --- a/src/qtgui/idxthread.cpp +++ b/src/qtgui/idxthread.cpp @@ -19,15 +19,25 @@ #include +#include #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 @@ static int stopidxthread; void IdxThread::run() { - DebugLog::getdbl()->setloglevel(DEBDEB1); + DebugLog::getdbl()->setloglevel(loglevel); for (;;) { if (stopidxthread) { delete indexer; @@ -62,8 +72,9 @@ void start_idxthread(const RclConfig& cnf) // 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 @@ void stop_idxthread() stopidxthread = 1; idxthread.wait(); } + +std::string idxthread_currentfile() +{ + QMutexLocker locker(&curfile_mutex); + return(idxthread.m_curfile); +} diff --git a/src/qtgui/idxthread.h b/src/qtgui/idxthread.h index 9c6d7821..9f650a43 100644 --- a/src/qtgui/idxthread.h +++ b/src/qtgui/idxthread.h @@ -16,7 +16,8 @@ */ #ifndef _IDXTHREAD_H_INCLUDED_ #define _IDXTHREAD_H_INCLUDED_ -/* @(#$Id: idxthread.h,v 1.3 2006-01-30 11:15:28 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: idxthread.h,v 1.4 2006-03-22 16:24:41 dockes Exp $ (C) 2004 J.F.Dockes */ +#include class RclConfig; @@ -24,6 +25,7 @@ class RclConfig; // sessions. extern void start_idxthread(const RclConfig& cnf); extern void stop_idxthread(); +extern std::string idxthread_currentfile(); extern int startindexing; extern int indexingdone; diff --git a/src/qtgui/rclmain.cpp b/src/qtgui/rclmain.cpp index d6ead04b..de4eac1d 100644 --- a/src/qtgui/rclmain.cpp +++ b/src/qtgui/rclmain.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.13 2006-03-21 13:46:37 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.14 2006-03-22 16:24:41 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -208,7 +208,7 @@ void RclMain::fileExit() // thread and a possible need to exit void RclMain::periodic100() { - static int toggle; + static int toggle = 0; // Check if indexing thread done if (indexingstatus) { statusBar()->message(""); @@ -217,14 +217,15 @@ void RclMain::periodic100() LOGINFO(("Indexing done: closing query database\n")); rcldb->close(); } else if (indexingdone == 0) { - if (toggle < 9) { - statusBar()->message(tr("Indexing in progress")); - } else { + if (toggle == 0) { + QString msg = tr("Indexing in progress: "); + msg += idxthread_currentfile().c_str(); + statusBar()->message(msg); + } else if (toggle == 9) { statusBar()->message(""); } - if (toggle >= 10) + if (++toggle >= 10) toggle = 0; - toggle++; } if (recollNeedsExit) fileExit(); diff --git a/src/qtgui/recollmain.ui b/src/qtgui/recollmain.ui index 21441c7c..b6adb0bd 100644 --- a/src/qtgui/recollmain.ui +++ b/src/qtgui/recollmain.ui @@ -136,6 +136,22 @@ image0 startSearch(Rcl::AdvSearchData) + + RclResList +
rclreslist.h
+ + 300 + 200 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
@@ -148,6 +164,9 @@ E&xit + + Ctrl+Q + @@ -283,9 +302,6 @@ 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082 - - 789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f - @@ -330,6 +346,12 @@ RclMainBase showSortDialog() + + preferencesQuery_PrefsAction + activated() + RclMainBase + showUIPrefs() + prevPageAction activated() @@ -342,12 +364,6 @@ resList showResultPage() - - preferencesQuery_PrefsAction - activated() - RclMainBase - showUIPrefs() - resList nextPageAvailable(bool) @@ -403,4 +419,7 @@ + + rclreslist.h +