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()
|
void stop_idxthread()
|
||||||
{
|
{
|
||||||
stopidxthread = 1;
|
stopidxthread = 1;
|
||||||
while (idxthread.running())
|
idxthread.wait();
|
||||||
sleep(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#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
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -88,17 +88,17 @@ static void sigcleanup(int)
|
|||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
QTranslator translator( 0 );
|
QTranslator translator( 0 );
|
||||||
// QTextCodec::locale() return $LANG
|
// QTextCodec::locale() return $LANG
|
||||||
translator.load( QString("recoll_") + QTextCodec::locale(), "." );
|
translator.load( QString("recoll_") + QTextCodec::locale(), "." );
|
||||||
a.installTranslator( &translator );
|
a.installTranslator( &translator );
|
||||||
|
|
||||||
RecollMain w;
|
RecollMain w;
|
||||||
w.show();
|
w.show();
|
||||||
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
||||||
QTimer *timer = new QTimer(&a);
|
QTimer *timer = new QTimer(&a);
|
||||||
w.connect(timer, SIGNAL(timeout()), &w, SLOT(checkExit()));
|
w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
|
||||||
timer->start(100);
|
timer->start(100);
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
@ -136,7 +136,6 @@ int main( int argc, char ** argv )
|
|||||||
QMessageBox::information(0, "Recoll",
|
QMessageBox::information(0, "Recoll",
|
||||||
QString("Could not open database in ") +
|
QString("Could not open database in ") +
|
||||||
QString(dbdir) + ". Starting indexation");
|
QString(dbdir) + ". Starting indexation");
|
||||||
startindexing = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_idxthread(rclconfig);
|
start_idxthread(rclconfig);
|
||||||
|
|||||||
@ -301,7 +301,7 @@
|
|||||||
</variables>
|
</variables>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>fileExit()</slot>
|
<slot>fileExit()</slot>
|
||||||
<slot>checkExit()</slot>
|
<slot>periodic100()</slot>
|
||||||
<slot>fileStart_IndexingAction_activated()</slot>
|
<slot>fileStart_IndexingAction_activated()</slot>
|
||||||
<slot>reslistTE_doubleClicked( int par, int )</slot>
|
<slot>reslistTE_doubleClicked( int par, int )</slot>
|
||||||
<slot>reslistTE_clicked( int par, int car )</slot>
|
<slot>reslistTE_clicked( int par, int car )</slot>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ using std::pair;
|
|||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#include <qstatusbar.h>
|
#include <qstatusbar.h>
|
||||||
#include <qwindowdefs.h>
|
#include <qwindowdefs.h>
|
||||||
|
#include <qapplication.h>
|
||||||
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
@ -197,16 +198,27 @@ void RecollMain::fileExit()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Misnomer. This is called on a 100ms timer and actually checks for different
|
// This is called on a 100ms timer checks the status of the indexing
|
||||||
// things apart from a need to exit
|
// thread and a possible need to exit
|
||||||
void RecollMain::checkExit()
|
void RecollMain::periodic100()
|
||||||
{
|
{
|
||||||
|
static int toggle;
|
||||||
// Check if indexing thread done
|
// Check if indexing thread done
|
||||||
if (indexingstatus) {
|
if (indexingstatus) {
|
||||||
|
statusBar()->message("");
|
||||||
indexingstatus = false;
|
indexingstatus = false;
|
||||||
// Make sure we reopen the db to get the results.
|
// Make sure we reopen the db to get the results.
|
||||||
LOGINFO(("Indexing done: closing query database\n"));
|
LOGINFO(("Indexing done: closing query database\n"));
|
||||||
rcldb->close();
|
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)
|
if (recollNeedsExit)
|
||||||
fileExit();
|
fileExit();
|
||||||
@ -551,15 +563,11 @@ void RecollMain::startPreview(int docnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar *stb = statusBar();
|
QStatusBar *stb = statusBar();
|
||||||
if (stb) {
|
char csz[20];
|
||||||
char csz[20];
|
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
||||||
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
string msg = string("Loading: ") + fn + " (size " + csz + " bytes)";
|
||||||
string msg = string("Loading: ") + fn + " (size " + csz
|
stb->message(msg.c_str());
|
||||||
+ " bytes)";
|
qApp->processEvents();
|
||||||
stb->message(msg.c_str());
|
|
||||||
stb->repaint(false);
|
|
||||||
XFlush(qt_xdisplay());
|
|
||||||
}
|
|
||||||
|
|
||||||
Rcl::Doc fdoc;
|
Rcl::Doc fdoc;
|
||||||
FileInterner interner(fn, rclconfig, tmpdir);
|
FileInterner interner(fn, rclconfig, tmpdir);
|
||||||
@ -570,14 +578,16 @@ void RecollMain::startPreview(int docnum)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stb)
|
stb->message("Creating preview text");
|
||||||
stb->clear();
|
qApp->processEvents();
|
||||||
|
|
||||||
list<string> terms;
|
list<string> terms;
|
||||||
rcldb->getQueryTerms(terms);
|
rcldb->getQueryTerms(terms);
|
||||||
list<pair<int, int> > termoffsets;
|
list<pair<int, int> > termoffsets;
|
||||||
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
||||||
|
|
||||||
|
stb->message("Creating preview window");
|
||||||
|
qApp->processEvents();
|
||||||
QTextEdit *editor;
|
QTextEdit *editor;
|
||||||
if (curPreview == 0) {
|
if (curPreview == 0) {
|
||||||
curPreview = new Preview(0, "Preview");
|
curPreview = new Preview(0, "Preview");
|
||||||
@ -641,6 +651,9 @@ void RecollMain::startPreview(int docnum)
|
|||||||
item->setFontWeight(QFont::Bold);
|
item->setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
||||||
|
stb->message("Loading preview text");
|
||||||
|
qApp->processEvents();
|
||||||
|
|
||||||
editor->setText(str);
|
editor->setText(str);
|
||||||
int para = 0, index = 1;
|
int para = 0, index = 1;
|
||||||
if (!termoffsets.empty()) {
|
if (!termoffsets.empty()) {
|
||||||
@ -653,4 +666,5 @@ void RecollMain::startPreview(int docnum)
|
|||||||
editor->getCursorPosition(¶, &index);
|
editor->getCursorPosition(¶, &index);
|
||||||
LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n",
|
LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n",
|
||||||
editor->length(), editor->paragraphs(), para, index));
|
editor->length(), editor->paragraphs(), para, index));
|
||||||
|
stb->clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#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
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -346,7 +346,7 @@ bool Rcl::Db::add(const string &fn, const Rcl::Doc &idoc)
|
|||||||
#else
|
#else
|
||||||
hash = fn;
|
hash = fn;
|
||||||
#endif
|
#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;
|
string pathterm = "P" + hash;
|
||||||
newdocument.add_term(pathterm);
|
newdocument.add_term(pathterm);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#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
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -176,7 +176,7 @@ void base64_encode(const string &in, string &out)
|
|||||||
if (0 != srclength) {
|
if (0 != srclength) {
|
||||||
/* Get what's left. */
|
/* Get what's left. */
|
||||||
input[0] = input[1] = input[2] = '\0';
|
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++];
|
input[i] = in[sidx++];
|
||||||
|
|
||||||
output[0] = input[0] >> 2;
|
output[0] = input[0] >> 2;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user