|
a/src/qtgui/recollmain.ui.h |
|
b/src/qtgui/recollmain.ui.h |
|
... |
|
... |
23 |
#include <qcstring.h>
|
23 |
#include <qcstring.h>
|
24 |
#include <qtabwidget.h>
|
24 |
#include <qtabwidget.h>
|
25 |
#include <qtimer.h>
|
25 |
#include <qtimer.h>
|
26 |
#include <qstatusbar.h>
|
26 |
#include <qstatusbar.h>
|
27 |
#include <qwindowdefs.h>
|
27 |
#include <qwindowdefs.h>
|
|
|
28 |
#include <qapplication.h>
|
28 |
|
29 |
|
29 |
#include "rcldb.h"
|
30 |
#include "rcldb.h"
|
30 |
#include "rclconfig.h"
|
31 |
#include "rclconfig.h"
|
31 |
#include "debuglog.h"
|
32 |
#include "debuglog.h"
|
32 |
#include "mimehandler.h"
|
33 |
#include "mimehandler.h"
|
|
... |
|
... |
195 |
if (asearchform)
|
196 |
if (asearchform)
|
196 |
delete asearchform;
|
197 |
delete asearchform;
|
197 |
exit(0);
|
198 |
exit(0);
|
198 |
}
|
199 |
}
|
199 |
|
200 |
|
200 |
// Misnomer. This is called on a 100ms timer and actually checks for different
|
201 |
// This is called on a 100ms timer checks the status of the indexing
|
201 |
// things apart from a need to exit
|
202 |
// thread and a possible need to exit
|
202 |
void RecollMain::checkExit()
|
203 |
void RecollMain::periodic100()
|
203 |
{
|
204 |
{
|
|
|
205 |
static int toggle;
|
204 |
// Check if indexing thread done
|
206 |
// Check if indexing thread done
|
205 |
if (indexingstatus) {
|
207 |
if (indexingstatus) {
|
|
|
208 |
statusBar()->message("");
|
206 |
indexingstatus = false;
|
209 |
indexingstatus = false;
|
207 |
// Make sure we reopen the db to get the results.
|
210 |
// Make sure we reopen the db to get the results.
|
208 |
LOGINFO(("Indexing done: closing query database\n"));
|
211 |
LOGINFO(("Indexing done: closing query database\n"));
|
209 |
rcldb->close();
|
212 |
rcldb->close();
|
|
|
213 |
} else if (indexingdone == 0) {
|
|
|
214 |
if (toggle < 9) {
|
|
|
215 |
statusBar()->message("Indexing in progress");
|
|
|
216 |
} else {
|
|
|
217 |
statusBar()->message("");
|
|
|
218 |
}
|
|
|
219 |
if (toggle >= 10)
|
|
|
220 |
toggle = 0;
|
|
|
221 |
toggle++;
|
210 |
}
|
222 |
}
|
211 |
if (recollNeedsExit)
|
223 |
if (recollNeedsExit)
|
212 |
fileExit();
|
224 |
fileExit();
|
213 |
}
|
225 |
}
|
214 |
|
226 |
|
|
... |
|
... |
549 |
fn.c_str());
|
561 |
fn.c_str());
|
550 |
return;
|
562 |
return;
|
551 |
}
|
563 |
}
|
552 |
|
564 |
|
553 |
QStatusBar *stb = statusBar();
|
565 |
QStatusBar *stb = statusBar();
|
554 |
if (stb) {
|
|
|
555 |
char csz[20];
|
566 |
char csz[20];
|
556 |
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
567 |
sprintf(csz, "%lu", (unsigned long)st.st_size);
|
557 |
string msg = string("Loading: ") + fn + " (size " + csz
|
568 |
string msg = string("Loading: ") + fn + " (size " + csz + " bytes)";
|
558 |
+ " bytes)";
|
|
|
559 |
stb->message(msg.c_str());
|
569 |
stb->message(msg.c_str());
|
560 |
stb->repaint(false);
|
570 |
qApp->processEvents();
|
561 |
XFlush(qt_xdisplay());
|
|
|
562 |
}
|
|
|
563 |
|
571 |
|
564 |
Rcl::Doc fdoc;
|
572 |
Rcl::Doc fdoc;
|
565 |
FileInterner interner(fn, rclconfig, tmpdir);
|
573 |
FileInterner interner(fn, rclconfig, tmpdir);
|
566 |
if (interner.internfile(fdoc, doc.ipath) != FileInterner::FIDone) {
|
574 |
if (interner.internfile(fdoc, doc.ipath) != FileInterner::FIDone) {
|
567 |
QMessageBox::warning(0, "Recoll",
|
575 |
QMessageBox::warning(0, "Recoll",
|
568 |
QString("Can't turn doc into internal rep ") +
|
576 |
QString("Can't turn doc into internal rep ") +
|
569 |
doc.mimetype.c_str());
|
577 |
doc.mimetype.c_str());
|
570 |
return;
|
578 |
return;
|
571 |
}
|
579 |
}
|
572 |
|
580 |
|
573 |
if (stb)
|
581 |
stb->message("Creating preview text");
|
574 |
stb->clear();
|
582 |
qApp->processEvents();
|
575 |
|
583 |
|
576 |
list<string> terms;
|
584 |
list<string> terms;
|
577 |
rcldb->getQueryTerms(terms);
|
585 |
rcldb->getQueryTerms(terms);
|
578 |
list<pair<int, int> > termoffsets;
|
586 |
list<pair<int, int> > termoffsets;
|
579 |
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
587 |
string rich = plaintorich(fdoc.text, terms, termoffsets);
|
580 |
|
588 |
|
|
|
589 |
stb->message("Creating preview window");
|
|
|
590 |
qApp->processEvents();
|
581 |
QTextEdit *editor;
|
591 |
QTextEdit *editor;
|
582 |
if (curPreview == 0) {
|
592 |
if (curPreview == 0) {
|
583 |
curPreview = new Preview(0, "Preview");
|
593 |
curPreview = new Preview(0, "Preview");
|
584 |
curPreview->setCaption(queryText->text());
|
594 |
curPreview->setCaption(queryText->text());
|
585 |
connect(curPreview, SIGNAL(previewClosed(Preview *)),
|
595 |
connect(curPreview, SIGNAL(previewClosed(Preview *)),
|
|
... |
|
... |
639 |
new QStyleSheetItem(editor->styleSheet(), "termtag" );
|
649 |
new QStyleSheetItem(editor->styleSheet(), "termtag" );
|
640 |
item->setColor("blue");
|
650 |
item->setColor("blue");
|
641 |
item->setFontWeight(QFont::Bold);
|
651 |
item->setFontWeight(QFont::Bold);
|
642 |
|
652 |
|
643 |
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
653 |
QString str = QString::fromUtf8(rich.c_str(), rich.length());
|
|
|
654 |
stb->message("Loading preview text");
|
|
|
655 |
qApp->processEvents();
|
|
|
656 |
|
644 |
editor->setText(str);
|
657 |
editor->setText(str);
|
645 |
int para = 0, index = 1;
|
658 |
int para = 0, index = 1;
|
646 |
if (!termoffsets.empty()) {
|
659 |
if (!termoffsets.empty()) {
|
647 |
index = (termoffsets.begin())->first;
|
660 |
index = (termoffsets.begin())->first;
|
648 |
LOGDEB(("Set cursor position: para %d, character index %d\n",
|
661 |
LOGDEB(("Set cursor position: para %d, character index %d\n",
|
|
... |
|
... |
651 |
}
|
664 |
}
|
652 |
editor->ensureCursorVisible();
|
665 |
editor->ensureCursorVisible();
|
653 |
editor->getCursorPosition(¶, &index);
|
666 |
editor->getCursorPosition(¶, &index);
|
654 |
LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n",
|
667 |
LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n",
|
655 |
editor->length(), editor->paragraphs(), para, index));
|
668 |
editor->length(), editor->paragraphs(), para, index));
|
|
|
669 |
stb->clear();
|
656 |
}
|
670 |
}
|