slightly better status printing while loading preview
This commit is contained in:
@@ -51,6 +51,7 @@ void start_idxthread(RclConfig *cnf)
|
||||
void stop_idxthread()
|
||||
{
|
||||
stopidxthread = 1;
|
||||
while (idxthread.running())
|
||||
sleep(1);
|
||||
idxthread.wait();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-9
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.12 2005-11-05 14:40:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.13 2005-11-06 15:07:09 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -88,17 +88,17 @@ static void sigcleanup(int)
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QTranslator translator( 0 );
|
||||
// QTextCodec::locale() return $LANG
|
||||
translator.load( QString("recoll_") + QTextCodec::locale(), "." );
|
||||
a.installTranslator( &translator );
|
||||
|
||||
|
||||
QTranslator translator( 0 );
|
||||
// QTextCodec::locale() return $LANG
|
||||
translator.load( QString("recoll_") + QTextCodec::locale(), "." );
|
||||
a.installTranslator( &translator );
|
||||
|
||||
RecollMain w;
|
||||
w.show();
|
||||
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
||||
QTimer *timer = new QTimer(&a);
|
||||
w.connect(timer, SIGNAL(timeout()), &w, SLOT(checkExit()));
|
||||
w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
|
||||
timer->start(100);
|
||||
|
||||
string reason;
|
||||
@@ -136,7 +136,6 @@ int main( int argc, char ** argv )
|
||||
QMessageBox::information(0, "Recoll",
|
||||
QString("Could not open database in ") +
|
||||
QString(dbdir) + ". Starting indexation");
|
||||
startindexing = 1;
|
||||
}
|
||||
|
||||
start_idxthread(rclconfig);
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
</variables>
|
||||
<slots>
|
||||
<slot>fileExit()</slot>
|
||||
<slot>checkExit()</slot>
|
||||
<slot>periodic100()</slot>
|
||||
<slot>fileStart_IndexingAction_activated()</slot>
|
||||
<slot>reslistTE_doubleClicked( int par, int )</slot>
|
||||
<slot>reslistTE_clicked( int par, int car )</slot>
|
||||
|
||||
+28
-14
@@ -25,6 +25,7 @@ using std::pair;
|
||||
#include <qtimer.h>
|
||||
#include <qstatusbar.h>
|
||||
#include <qwindowdefs.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#include "rcldb.h"
|
||||
#include "rclconfig.h"
|
||||
@@ -197,16 +198,27 @@ void RecollMain::fileExit()
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Misnomer. This is called on a 100ms timer and actually checks for different
|
||||
// things apart from a need to exit
|
||||
void RecollMain::checkExit()
|
||||
// This is called on a 100ms timer checks the status of the indexing
|
||||
// thread and a possible need to exit
|
||||
void RecollMain::periodic100()
|
||||
{
|
||||
static int toggle;
|
||||
// Check if indexing thread done
|
||||
if (indexingstatus) {
|
||||
statusBar()->message("");
|
||||
indexingstatus = false;
|
||||
// Make sure we reopen the db to get the results.
|
||||
LOGINFO(("Indexing done: closing query database\n"));
|
||||
rcldb->close();
|
||||
} else if (indexingdone == 0) {
|
||||
if (toggle < 9) {
|
||||
statusBar()->message("Indexing in progress");
|
||||
} else {
|
||||
statusBar()->message("");
|
||||
}
|
||||
if (toggle >= 10)
|
||||
toggle = 0;
|
||||
toggle++;
|
||||
}
|
||||
if (recollNeedsExit)
|
||||
fileExit();
|
||||
@@ -551,15 +563,11 @@ void RecollMain::startPreview(int docnum)
|
||||
}
|
||||
|
||||
QStatusBar *stb = statusBar();
|
||||
if (stb) {
|
||||
char csz[20];
|
||||
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
||||
string msg = string("Loading: ") + fn + " (size " + csz
|
||||
+ " bytes)";
|
||||
stb->message(msg.c_str());
|
||||
stb->repaint(false);
|
||||
XFlush(qt_xdisplay());
|
||||
}
|
||||
char csz[20];
|
||||
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
||||
string msg = string("Loading: ") + fn + " (size " + csz + " bytes)";
|
||||
stb->message(msg.c_str());
|
||||
qApp->processEvents();
|
||||
|
||||
Rcl::Doc fdoc;
|
||||
FileInterner interner(fn, rclconfig, tmpdir);
|
||||
@@ -570,14 +578,16 @@ void RecollMain::startPreview(int docnum)
|
||||
return;
|
||||
}
|
||||
|
||||
if (stb)
|
||||
stb->clear();
|
||||
stb->message("Creating preview text");
|
||||
qApp->processEvents();
|
||||
|
||||
list<string> terms;
|
||||
rcldb->getQueryTerms(terms);
|
||||
list<pair<int, int> > termoffsets;
|
||||
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
||||
|
||||
stb->message("Creating preview window");
|
||||
qApp->processEvents();
|
||||
QTextEdit *editor;
|
||||
if (curPreview == 0) {
|
||||
curPreview = new Preview(0, "Preview");
|
||||
@@ -641,6 +651,9 @@ void RecollMain::startPreview(int docnum)
|
||||
item->setFontWeight(QFont::Bold);
|
||||
|
||||
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
||||
stb->message("Loading preview text");
|
||||
qApp->processEvents();
|
||||
|
||||
editor->setText(str);
|
||||
int para = 0, index = 1;
|
||||
if (!termoffsets.empty()) {
|
||||
@@ -653,4 +666,5 @@ void RecollMain::startPreview(int docnum)
|
||||
editor->getCursorPosition(¶, &index);
|
||||
LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n",
|
||||
editor->length(), editor->paragraphs(), para, index));
|
||||
stb->clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user