moved periodic timer control from main.cpp to rclmain_w.cpp
This commit is contained in:
parent
8a377d135a
commit
88475dabca
@ -37,8 +37,8 @@ static char rcsid[] = "@(#$Id: main.cpp,v 1.73 2008-12-17 08:01:40 dockes Exp $
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#include <qthread.h>
|
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
#include <qthread.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
@ -372,13 +372,12 @@ int main(int argc, char **argv)
|
|||||||
// after mainWindow->show() , else the QMessageBox above never
|
// after mainWindow->show() , else the QMessageBox above never
|
||||||
// returns.
|
// returns.
|
||||||
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||||
QTimer *timer = new QTimer(&app);
|
|
||||||
mainWindow->connect(timer, SIGNAL(timeout()),
|
|
||||||
mainWindow, SLOT(periodic100()));
|
|
||||||
timer->start(100);
|
|
||||||
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
||||||
|
|
||||||
|
// Start the indexing thread. It will immediately go to sleep waiting for
|
||||||
|
// something to do.
|
||||||
start_idxthread(*rclconfig);
|
start_idxthread(*rclconfig);
|
||||||
|
|
||||||
if (op_flags & OPT_q) {
|
if (op_flags & OPT_q) {
|
||||||
SSearch::SSearchType stype;
|
SSearch::SSearchType stype;
|
||||||
if (op_flags & OPT_o) {
|
if (op_flags & OPT_o) {
|
||||||
@ -393,9 +392,7 @@ int main(int argc, char **argv)
|
|||||||
mainWindow->sSearch->searchTypCMB->setCurrentItem(int(stype));
|
mainWindow->sSearch->searchTypCMB->setCurrentItem(int(stype));
|
||||||
mainWindow->
|
mainWindow->
|
||||||
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
|
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
|
||||||
// The 200 ms are a hack to jump over the first db close by
|
QTimer::singleShot(0, mainWindow->sSearch, SLOT(startSimpleSearch()));
|
||||||
// periodic100()...
|
|
||||||
QTimer::singleShot(200, mainWindow->sSearch, SLOT(startSimpleSearch()));
|
|
||||||
}
|
}
|
||||||
// fprintf(stderr, "Go\n");
|
// fprintf(stderr, "Go\n");
|
||||||
// Let's go
|
// Let's go
|
||||||
|
|||||||
@ -122,6 +122,8 @@ void RclMain::init()
|
|||||||
spellform = 0;
|
spellform = 0;
|
||||||
m_idxStatusAck = false;
|
m_idxStatusAck = false;
|
||||||
|
|
||||||
|
periodictimer = new QTimer(this);
|
||||||
|
|
||||||
(void)new HelpClient(this);
|
(void)new HelpClient(this);
|
||||||
HelpClient::installMap(this->name(), "RCL.SEARCH.SIMPLE");
|
HelpClient::installMap(this->name(), "RCL.SEARCH.SIMPLE");
|
||||||
|
|
||||||
@ -260,6 +262,10 @@ void RclMain::init()
|
|||||||
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
||||||
if (prefs.catgToolBar && catgCMB)
|
if (prefs.catgToolBar && catgCMB)
|
||||||
connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int)));
|
connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int)));
|
||||||
|
connect(periodictimer, SIGNAL(timeout()), this, SLOT(periodic100()));
|
||||||
|
// Start timer on a slow period (used for checking ^C). Will be
|
||||||
|
// speeded up during indexing
|
||||||
|
periodictimer->start(1000);
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
#if (QT_VERSION < 0x040000)
|
||||||
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
||||||
@ -470,9 +476,13 @@ void RclMain::toggleIndexing()
|
|||||||
if (idxthread_getStatus() == IDXTS_NULL) {
|
if (idxthread_getStatus() == IDXTS_NULL) {
|
||||||
// Indexing in progress
|
// Indexing in progress
|
||||||
stop_indexing();
|
stop_indexing();
|
||||||
|
periodictimer->stop();
|
||||||
|
periodictimer->start(1000);
|
||||||
fileToggleIndexingAction->setText(tr("Update &Index"));
|
fileToggleIndexingAction->setText(tr("Update &Index"));
|
||||||
} else {
|
} else {
|
||||||
start_indexing(false);
|
start_indexing(false);
|
||||||
|
periodictimer->stop();
|
||||||
|
periodictimer->start(100);
|
||||||
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
||||||
}
|
}
|
||||||
fileToggleIndexingAction->setEnabled(FALSE);
|
fileToggleIndexingAction->setEnabled(FALSE);
|
||||||
|
|||||||
@ -123,6 +123,7 @@ private:
|
|||||||
UIPrefsDialog *uiprefs;
|
UIPrefsDialog *uiprefs;
|
||||||
ConfIndexW *indexConfig;
|
ConfIndexW *indexConfig;
|
||||||
SpellW *spellform;
|
SpellW *spellform;
|
||||||
|
QTimer *periodictimer;
|
||||||
|
|
||||||
vector<TempFile> m_tempfiles;
|
vector<TempFile> m_tempfiles;
|
||||||
map<QString, int> m_stemLangToId;
|
map<QString, int> m_stemLangToId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user