improve periodic indexing status reporting and timer processing

This commit is contained in:
dockes 2009-07-02 10:26:02 +00:00
parent b915c4aea7
commit 86a1684fff
2 changed files with 15 additions and 16 deletions

View File

@ -508,14 +508,13 @@ DbIndexer::processone(const std::string &fn, const struct stat *stp,
// Tell what we are doing and check for interrupt request // Tell what we are doing and check for interrupt request
if (m_updater) { if (m_updater) {
if ((++(m_updater->status.docsdone) % 10) == 0) { ++(m_updater->status.docsdone);
m_updater->status.fn = fn; m_updater->status.fn = fn;
if (!ipath.empty()) if (!ipath.empty())
m_updater->status.fn += "|" + ipath; m_updater->status.fn += "|" + ipath;
if (!m_updater->update()) { if (!m_updater->update()) {
return FsTreeWalker::FtwStop; return FsTreeWalker::FtwStop;
} }
}
} }
} }

View File

@ -395,8 +395,8 @@ void RclMain::fileExit()
exit(0); exit(0);
} }
// This is called on a 100ms timer checks the status of the indexing // This is called by a periodic timer to check the status of the
// thread and a possible need to exit // indexing thread and a possible need to exit
void RclMain::periodic100() void RclMain::periodic100()
{ {
static int toggle = 0; static int toggle = 0;
@ -424,14 +424,16 @@ void RclMain::periodic100()
// relatively complicated (keep an open/close gen number // relatively complicated (keep an open/close gen number
// and check this / restart query in DocSeqDb() ?) // and check this / restart query in DocSeqDb() ?)
rcldb->close(); rcldb->close();
periodictimer->changeInterval(1000);
} }
} else { } else {
// Indexing is running // Indexing is running
m_idxStatusAck = false; m_idxStatusAck = false;
fileToggleIndexingAction->setText(tr("Stop &Indexing")); fileToggleIndexingAction->setText(tr("Stop &Indexing"));
fileToggleIndexingAction->setEnabled(TRUE); fileToggleIndexingAction->setEnabled(TRUE);
periodictimer->changeInterval(100);
// The toggle thing is for the status to flash // The toggle thing is for the status to flash
if (toggle == 0) { if (toggle < 9) {
QString msg = tr("Indexing in progress: "); QString msg = tr("Indexing in progress: ");
DbIxStatus status = idxthread_idxStatus(); DbIxStatus status = idxthread_idxStatus();
QString phs; QString phs;
@ -474,15 +476,13 @@ void RclMain::periodic100()
void RclMain::toggleIndexing() void RclMain::toggleIndexing()
{ {
if (idxthread_getStatus() == IDXTS_NULL) { if (idxthread_getStatus() == IDXTS_NULL) {
// Indexing in progress // Indexing was in progress, stop it
stop_indexing(); stop_indexing();
periodictimer->stop(); periodictimer->changeInterval(1000);
periodictimer->start(1000);
fileToggleIndexingAction->setText(tr("Update &Index")); fileToggleIndexingAction->setText(tr("Update &Index"));
} else { } else {
start_indexing(false); start_indexing(false);
periodictimer->stop(); periodictimer->changeInterval(100);
periodictimer->start(100);
fileToggleIndexingAction->setText(tr("Stop &Indexing")); fileToggleIndexingAction->setText(tr("Stop &Indexing"));
} }
fileToggleIndexingAction->setEnabled(FALSE); fileToggleIndexingAction->setEnabled(FALSE);