slightly better status printing while loading preview
This commit is contained in:
parent
48948bc92f
commit
e5329a410c
@ -51,6 +51,7 @@ void start_idxthread(RclConfig *cnf)
|
||||
void stop_idxthread()
|
||||
{
|
||||
stopidxthread = 1;
|
||||
while (idxthread.running())
|
||||
sleep(1);
|
||||
idxthread.wait();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.34 2005-11-06 11:16:53 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.35 2005-11-06 15:07:09 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
@ -346,7 +346,7 @@ bool Rcl::Db::add(const string &fn, const Rcl::Doc &idoc)
|
||||
#else
|
||||
hash = fn;
|
||||
#endif
|
||||
LOGDEB(("Rcl::Db::add: pathhash [%s]\n", hash.c_str()));
|
||||
LOGDEB2(("Rcl::Db::add: pathhash [%s]\n", hash.c_str()));
|
||||
|
||||
string pathterm = "P" + hash;
|
||||
newdocument.add_term(pathterm);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: base64.cpp,v 1.1 2005-11-06 11:16:53 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: base64.cpp,v 1.2 2005-11-06 15:07:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -176,7 +176,7 @@ void base64_encode(const string &in, string &out)
|
||||
if (0 != srclength) {
|
||||
/* Get what's left. */
|
||||
input[0] = input[1] = input[2] = '\0';
|
||||
for (unsigned int i = 0; i < srclength; i++)
|
||||
for (int i = 0; i < srclength; i++)
|
||||
input[i] = in[sidx++];
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user