From 348bf377ae9effcf591ac5b4b0b155b0b5013741 Mon Sep 17 00:00:00 2001 From: dockes Date: Sun, 22 Jan 2006 18:46:41 +0000 Subject: [PATCH] extract functionality from main window --- src/qtgui/main.cpp | 6 +- src/qtgui/rclmain.cpp | 407 ++++++-------------------------------- src/qtgui/rclmain.h | 22 +-- src/qtgui/recoll.pro | 17 +- src/qtgui/recoll.pro.in | 55 ++++++ src/qtgui/recollmain.ui | 258 ++++++++++-------------- src/qtgui/recollmain.ui.h | 42 ++-- src/qtgui/reslistb.ui | 7 +- src/qtgui/reslistb.ui.h | 16 +- src/qtgui/ssearchb.ui | 4 +- 10 files changed, 264 insertions(+), 570 deletions(-) create mode 100644 src/qtgui/recoll.pro.in diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 2450cca5..8a9855fa 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: main.cpp,v 1.32 2006-01-20 14:58:57 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: main.cpp,v 1.33 2006-01-22 18:46:41 dockes Exp $ (C) 2005 J.F.Dockes"; #endif #include @@ -67,7 +67,7 @@ static void rwSettings(bool writing) return; prefs_mainwidth = mainWindow->width(); prefs_mainheight = mainWindow->height(); - prefs_ssall = mainWindow->allTermsCB->isChecked(); + prefs_ssall = mainWindow->sSearch->allTermsCB->isChecked(); } QSettings settings; @@ -158,7 +158,7 @@ int main( int argc, char ** argv ) QSize s(prefs_mainwidth, prefs_mainheight); w.resize(s); - w.allTermsCB->setChecked(prefs_ssall); + w.sSearch->allTermsCB->setChecked(prefs_ssall); if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) { // Note: this will have to be replaced by a call to a diff --git a/src/qtgui/rclmain.cpp b/src/qtgui/rclmain.cpp index d77d617f..1c0e5755 100644 --- a/src/qtgui/rclmain.cpp +++ b/src/qtgui/rclmain.cpp @@ -55,41 +55,32 @@ using std::pair; extern "C" int XFlush(void *); -#ifndef MIN -#define MIN(A,B) ((A) < (B) ? (A) : (B)) -#endif - void RclMain::init() { - reslist_winfirst = -1; - reslist_mouseDrag = false; - reslist_mouseDown = false; - reslist_par = -1; - reslist_car = -1; - reslist_waitingdbl = false; - reslist_dblclck = false; curPreview = 0; asearchform = 0; sortform = 0; - docsource = 0; sortwidth = 0; uiprefs = 0; + docsource = 0; // We manage pgup/down, but let ie the arrows for the editor to process - reslistTE->installEventFilter(this); - reslistTE->viewport()->installEventFilter(this); - // reslistTE->viewport()->setFocusPolicy(QWidget::NoFocus); + resList->reslistTE->installEventFilter(this); + resList->reslistTE->viewport()->installEventFilter(this); + // resList->viewport()->setFocusPolicy(QWidget::NoFocus); // Set the focus to the search terms entry: - queryText->setFocus(); + sSearch->queryText->setFocus(); // Set result list font according to user preferences. if (prefs_reslistfontfamily.length()) { QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize); - reslistTE->setFont(nfont); + resList->setFont(nfont); } string historyfile = path_cat(rclconfig->getConfDir(), "history"); m_history = new RclDHistory(historyfile); + connect(sSearch, SIGNAL(startSearch(Rcl::AdvSearchData)), + this, SLOT(startAdvSearch(Rcl::AdvSearchData))); } // We also want to get rid of the advanced search form and previews @@ -200,29 +191,29 @@ bool RclMain::eventFilter( QObject * target, QEvent * event ) if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) { recollNeedsExit = 1; } else if (keyEvent->key() == Key_Prior) { - resPageUpOrBack(); + resList->resPageUpOrBack(); return true; } else if (keyEvent->key() == Key_Next) { - resPageDownOrNext(); + resList->resPageDownOrNext(); return true; } - } else if (target == reslistTE->viewport()) { + } else if (target == resList->reslistTE->viewport()) { // We don't want btdown+drag+btup to be a click ! So monitor // mouse events if (event->type() == QEvent::MouseMove) { - LOGDEB1(("reslistTE: MouseMove\n")); - if (reslist_mouseDown) - reslist_mouseDrag = true; + LOGDEB1(("resList: MouseMove\n")); + if (resList->m_mouseDown) + resList->m_mouseDrag = true; } else if (event->type() == QEvent::MouseButtonPress) { - LOGDEB1(("reslistTE: MouseButtonPress\n")); - reslist_mouseDown = true; - reslist_mouseDrag = false; + LOGDEB1(("resList: MouseButtonPress\n")); + resList->m_mouseDown = true; + resList->m_mouseDrag = false; } else if (event->type() == QEvent::MouseButtonRelease) { - LOGDEB1(("reslistTE: MouseButtonRelease\n")); - reslist_mouseDown = false; + LOGDEB1(("resList: MouseButtonRelease\n")); + resList->m_mouseDown = false; } else if (event->type() == QEvent::MouseButtonDblClick) { - LOGDEB1(("reslistTE: MouseButtonDblClick\n")); - reslist_mouseDown = false; + LOGDEB1(("resList: MouseButtonDblClick\n")); + resList->m_mouseDown = false; } } @@ -276,112 +267,6 @@ static string urltolocalpath(string url) return url.substr(7, string::npos); } -// Translate paragraph number in list window to doc number. This depends on -// how we format the title etc.. -int RclMain::reldocnumfromparnum(int par) -{ - std::map::iterator it = pageParaToReldocnums.find(par); - int rdn; - if (it != pageParaToReldocnums.end()) { - rdn = it->second; - } else { - rdn = -1; - } - LOGDEB1(("reldocnumfromparnum: par %d reldoc %d\n", par, rdn)); - return rdn; -} - -// Double click in result list: use external viewer to display file -void RclMain::reslistTE_doubleClicked(int par, int) -{ - LOGDEB(("RclMain::reslistTE_doubleClicked: par %d\n", par)); - reslist_dblclck = true; - int reldocnum = reldocnumfromparnum(par); - if (reldocnum < 0) - return; - startNativeViewer(reslist_winfirst + reldocnum); -} - - -// Display preview for the selected document, and highlight entry. The -// paragraph number is doc number in window + 1 -// We don't actually do anything but start a timer because we want to -// check first if this might be a double click -void RclMain::reslistTE_clicked(int par, int car) -{ - if (reslist_waitingdbl) - return; - LOGDEB(("RclMain::reslistTE_clicked:wfirst %d par %d char %d drg %d\n", - reslist_winfirst, par, car, reslist_mouseDrag)); - if (reslist_winfirst == -1 || reslist_mouseDrag) - return; - - // remember par and car - reslist_par = par; - reslist_car = car; - reslist_waitingdbl = true; - reslist_dblclck = false; - // Wait to see if there's going to be a dblclck - QTimer::singleShot(150, this, SLOT(reslistTE_delayedclick()) ); -} - -// This gets called by a timer 100mS after a single click in the -// result list. We don't want to start a preview if the user has -// requested a native viewer by double-clicking -void RclMain::reslistTE_delayedclick() -{ - LOGDEB(("RclMain::reslistTE_delayedclick:\n")); - reslist_waitingdbl = false; - if (reslist_dblclck) { - LOGDEB1(("RclMain::reslistTE_delayedclick: dbleclick\n")); - reslist_dblclck = false; - return; - } - - int par = reslist_par; - - // Erase everything back to white - { - QColor color("white"); - for (int i = 1; i < reslistTE->paragraphs(); i++) - reslistTE->setParagraphBackgroundColor(i, color); - } - - // Color the new active paragraph - QColor color("lightblue"); - reslistTE->setParagraphBackgroundColor(par, color); - - // Document number - int reldocnum = reldocnumfromparnum(par); - - if (reldocnum < 0) { - // Bad number: must have clicked on header. Show details of query - QString desc = tr("Query details") + ": " + - QString::fromUtf8(currentQueryData.description.c_str()); - QMessageBox::information(this, tr("Query details"), desc); - return; - } else { - startPreview(reslist_winfirst + reldocnum); - } -} - -// User asked to start query. Send it to the db aand call -// listNextPB_clicked to fetch and display the first page of results -void RclMain::startSimpleSearch() -{ - LOGDEB(("RclMain::queryText_returnPressed()\n")); - // The db may have been closed at the end of indexing - Rcl::AdvSearchData sdata; - - QCString u8 = queryText->text().utf8(); - if (allTermsCB->isChecked()) - sdata.allwords = u8; - else - sdata.orwords = u8; - - startAdvSearch(sdata); -} - // Execute an advanced search query. The parameters normally come from // the advanced search dialog void RclMain::startAdvSearch(Rcl::AdvSearchData sdata) @@ -394,15 +279,19 @@ void RclMain::startAdvSearch(Rcl::AdvSearchData sdata) exit(1); } - reslist_winfirst = -1; + resList->m_winfirst = -1; if (!rcldb->setQuery(sdata, prefs_queryStemLang.length() > 0 ? Rcl::Db::QO_STEM : Rcl::Db::QO_NONE, prefs_queryStemLang.ascii())) return; curPreview = 0; - if (docsource) + + if (docsource) { delete docsource; + docsource = 0; + resList->setDocSource(0); + } if (sortwidth > 0) { DocSequenceDb myseq(rcldb, tr("Query results")); @@ -412,202 +301,7 @@ void RclMain::startAdvSearch(Rcl::AdvSearchData sdata) docsource = new DocSequenceDb(rcldb, tr("Query results")); } currentQueryData = sdata; - showResultPage(); -} - -// Page Up/Down: we don't try to check if current paragraph is last or -// first. We just page up/down and check if viewport moved. If it did, -// fair enough, else we go to next/previous result page. -void RclMain::resPageUpOrBack() -{ - int vpos = reslistTE->contentsY(); - reslistTE->moveCursor(QTextEdit::MovePgUp, false); - if (vpos == reslistTE->contentsY()) - resultPageBack(); -} -void RclMain::resPageDownOrNext() -{ - int vpos = reslistTE->contentsY(); - reslistTE->moveCursor(QTextEdit::MovePgDown, false); - LOGDEB(("RclMain::resPageDownOrNext: vpos before %d, after %d\n", - vpos, reslistTE->contentsY())); - if (vpos == reslistTE->contentsY()) - showResultPage(); -} - -// Show previous page of results. We just set the current number back -// 2 pages and show next page. -void RclMain::resultPageBack() -{ - if (reslist_winfirst <= 0) - return; - reslist_winfirst -= 2 * prefs_respagesize; - showResultPage(); -} - - -// Fill up result list window with next screen of hits -void RclMain::showResultPage() -{ - if (!docsource) - return; - - int percent; - Rcl::Doc doc; - - int resCnt = docsource->getResCnt(); - - LOGDEB(("showResultPage: rescnt %d, winfirst %d\n", resCnt, - reslist_winfirst)); - - pageParaToReldocnums.clear(); - - // If we are already on the last page, nothing to do: - if (reslist_winfirst >= 0 && - (reslist_winfirst + prefs_respagesize > resCnt)) { - nextPageAction->setEnabled(false); - return; - } - - if (reslist_winfirst < 0) { - reslist_winfirst = 0; - prevPageAction->setEnabled(false); - } else { - prevPageAction->setEnabled(true); - reslist_winfirst += prefs_respagesize; - } - - bool gotone = false; - reslistTE->clear(); - - int last = MIN(resCnt-reslist_winfirst, prefs_respagesize); - - - // Insert results if any in result list window. We have to send - // the text to the widgets, because we need the paragraph number - // each time we add a result paragraph (its diffult and - // error-prone to compute the paragraph numbers in parallel. We - // would like to disable updates while we're doing this, but - // couldn't find a way to make it work, the widget seems to become - // confused if appended while updates are disabled - // reslistTE->setUpdatesEnabled(false); - for (int i = 0; i < last; i++) { - string sh; - doc.erase(); - - if (!docsource->getDoc(reslist_winfirst + i, doc, &percent, &sh)) { - // This may very well happen for history if the doc has - // been removed since. So don't treat it as fatal. - doc.abstract = string(tr("Unavailable document").utf8()); - } - if (i == 0) { - // Display header - // We could use a but the textedit doesnt display - // it prominently - reslistTE->append("<qt><head></head><body>"); - QString line = "<p><font size=+1><b>"; - line += docsource->title().c_str(); - line += "</b></font><br>"; - reslistTE->append(line); - line = tr("<b>Displaying results starting at index" - " %1 (maximum set size %2)</b></p>\n") - .arg(reslist_winfirst+1) - .arg(resCnt); - reslistTE->append(line); - } - - gotone = true; - - // Result list entry display: this must be exactly one paragraph - // We should probably display the size too - size ? - - string result; - if (!sh.empty()) - result += string("<p><b>") + sh + "</p>\n<p>"; - else - result = "<p>"; - - string img_name; - if (prefs_showicons) { - string iconpath; - string iconname = rclconfig->getMimeIconName(doc.mimetype, - &iconpath); - LOGDEB1(("Img file; %s\n", iconpath.c_str())); - QImage image(iconpath.c_str()); - if (!image.isNull()) { - img_name = string("img_") + iconname; - QMimeSourceFactory::defaultFactory()-> - setImage(img_name.c_str(), image); - } - } - - char perbuf[10]; - sprintf(perbuf, "%3d%%", percent); - if (doc.title.empty()) - doc.title = path_getsimple(doc.url); - char datebuf[100]; - datebuf[0] = 0; - if (!doc.dmtime.empty() || !doc.fmtime.empty()) { - time_t mtime = doc.dmtime.empty() ? - atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str()); - struct tm *tm = localtime(&mtime); - strftime(datebuf, 99, - "<i>Modified:</i> %Y-%m-%d %H:%M:%S", tm); - } - string abst = escapeHtml(doc.abstract); - LOGDEB1(("Abstract: {%s}\n", abst.c_str())); - if (!img_name.empty()) { - result += "<img source=\"" + img_name + "\" align=\"left\">"; - } - result += string(perbuf) + " <b>" + doc.title + "</b><br>" + - doc.mimetype + " " + - (datebuf[0] ? string(datebuf) + "<br>" : string("<br>")) + - (!abst.empty() ? abst + "<br>" : string("")) + - (!doc.keywords.empty() ? doc.keywords + "<br>" : string("")) + - "<i>" + doc.url + +"</i><br></p>\n"; - - QString str = QString::fromUtf8(result.c_str(), result.length()); - reslistTE->append(str); - - pageParaToReldocnums[reslistTE->paragraphs()-1] = i; - } - - if (gotone) { - reslistTE->append("</body></qt>"); - reslistTE->setCursorPosition(0,0); - reslistTE->ensureCursorVisible(); - } else { - // Restore first in win parameter that we shouln't have incremented - reslistTE->append(tr("<p>" - /*"<img align=\"left\" source=\"myimage\">"*/ - "<b>No results found</b>" - "<br>")); - reslist_winfirst -= prefs_respagesize; - if (reslist_winfirst < 0) - reslist_winfirst = -1; - } - - //reslistTE->setUpdatesEnabled(true);reslistTE->sync();reslistTE->repaint(); - -#if 0 - { - FILE *fp = fopen("/tmp/reslistdebug", "w"); - if (fp) { - const char *text = (const char *)reslistTE->text().utf8(); - //const char *text = alltext.c_str(); - fwrite(text, 1, strlen(text), fp); - fclose(fp); - } - } -#endif - - if (reslist_winfirst < 0 || - (reslist_winfirst >= 0 && - reslist_winfirst + prefs_respagesize >= resCnt)) { - nextPageAction->setEnabled(false); - } else { - nextPageAction->setEnabled(true); - } + resList->setDocSource(docsource); } // If a preview (toplevel) window gets closed by the user, we need to @@ -711,7 +405,7 @@ void RclMain::startPreview(int docnum) return; } - curPreview->setCaption(queryText->text()); + curPreview->setCaption(QString::fromUtf8(currentQueryData.description.c_str())); connect(curPreview, SIGNAL(previewClosed(Widget *)), this, SLOT(previewClosed(Widget *))); curPreview->show(); @@ -795,10 +489,13 @@ void RclMain::startManual() void RclMain::showDocHistory() { LOGDEB(("RclMain::showDocHistory\n")); - reslist_winfirst = -1; + resList->m_winfirst = -1; curPreview = 0; - if (docsource) + if (docsource) { delete docsource; + docsource = 0; + resList->setDocSource(0); + } if (sortwidth > 0) { DocSequenceHistory myseq(rcldb, m_history, tr("Document history")); @@ -810,22 +507,10 @@ void RclMain::showDocHistory() } currentQueryData.erase(); currentQueryData.description = tr("History data").utf8(); - showResultPage(); + resList->setDocSource(docsource); } -void RclMain::searchTextChanged(const QString & text) -{ - if (text.isEmpty()) { - searchPB->setEnabled(false); - clearqPB->setEnabled(false); - } else { - searchPB->setEnabled(true); - clearqPB->setEnabled(true); - } - -} - void RclMain::sortDataChanged(int cnt, RclSortSpec spec) { LOGDEB(("RclMain::sortDataChanged\n")); @@ -847,9 +532,9 @@ void RclMain::setUIPrefs() prefs_reslistfontsize = uiprefs->reslistFontSize; if (prefs_reslistfontfamily.length()) { QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize); - reslistTE->setFont(nfont); + resList->setFont(nfont); } else { - reslistTE->setFont(this->font()); + resList->setFont(this->font()); } if (uiprefs->stemLangCMB->currentItem() == 0) { @@ -858,3 +543,21 @@ void RclMain::setUIPrefs() prefs_queryStemLang = uiprefs->stemLangCMB->currentText(); } } + +void RclMain::enableNextPage(bool yesno) +{ + nextPageAction->setEnabled(yesno); +} + +void RclMain::enablePrevPage(bool yesno) +{ + prevPageAction->setEnabled(yesno); +} + +void RclMain::showQueryDetails() +{ + // Bad number: must have clicked on header. Show details of query + QString desc = tr("Query details") + ": " + + QString::fromUtf8(currentQueryData.description.c_str()); + QMessageBox::information(this, tr("Query details"), desc); +} diff --git a/src/qtgui/rclmain.h b/src/qtgui/rclmain.h index 2578d749..af697a37 100644 --- a/src/qtgui/rclmain.h +++ b/src/qtgui/rclmain.h @@ -31,34 +31,20 @@ public slots: virtual void fileExit(); virtual void periodic100(); virtual void fileStart_IndexingAction_activated(); - virtual void reslistTE_doubleClicked( int par, int ); - virtual void reslistTE_clicked( int par, int car ); - virtual void reslistTE_delayedclick(); - virtual void startSimpleSearch(); virtual void startAdvSearch( Rcl::AdvSearchData sdata ); - virtual void resPageUpOrBack(); - virtual void resPageDownOrNext(); - virtual void resultPageBack(); - virtual void showResultPage(); virtual void previewClosed( QWidget * w ); virtual void showAdvSearchDialog(); virtual void showSortDialog(); virtual void showAboutDialog(); virtual void startManual(); virtual void showDocHistory(); - virtual void searchTextChanged( const QString & text ); virtual void sortDataChanged( int cnt, RclSortSpec spec ); virtual void showUIPrefs(); virtual void setUIPrefs(); - + virtual void enableNextPage(bool); + virtual void enablePrevPage(bool); + virtual void showQueryDetails(); protected: - int reslist_winfirst; - bool reslist_mouseDrag; - bool reslist_mouseDown; - int reslist_par; - int reslist_car; - bool reslist_waitingdbl; - bool reslist_dblclck; Preview *curPreview; advsearch *asearchform; Rcl::AdvSearchData currentQueryData; @@ -67,12 +53,10 @@ protected: int sortwidth; RclSortSpec sortspecs; DocSequence *docsource; - std::map<int,int> pageParaToReldocnums; RclDHistory *m_history; private: virtual void init(); virtual bool eventFilter( QObject * target, QEvent * event ); - virtual int reldocnumfromparnum( int par ); virtual void startPreview( int docnum ); virtual void startNativeViewer( int docnum ); }; diff --git a/src/qtgui/recoll.pro b/src/qtgui/recoll.pro index 83b1f9ba..a91a3a5c 100644 --- a/src/qtgui/recoll.pro +++ b/src/qtgui/recoll.pro @@ -3,19 +3,20 @@ LANGUAGE = C++ CONFIG += qt warn_on thread release debug +HEADERS += rclmain.h + SOURCES += main.cpp \ rclmain.cpp \ idxthread.cpp \ plaintorich.cpp -HEADERS = rclmain.h - -FORMS = recollmain.ui \ - advsearch.ui \ - preview/preview.ui \ - sort.ui \ - uiprefs.ui - +FORMS = reslistb.ui \ + recollmain.ui \ + advsearch.ui \ + preview/preview.ui \ + sort.ui \ + uiprefs.ui \ + ssearchb.ui IMAGES = images/filenew \ images/fileopen \ diff --git a/src/qtgui/recoll.pro.in b/src/qtgui/recoll.pro.in new file mode 100644 index 00000000..3121dae6 --- /dev/null +++ b/src/qtgui/recoll.pro.in @@ -0,0 +1,55 @@ +TEMPLATE = app +LANGUAGE = C++ + +CONFIG += qt warn_on thread release debug + +SOURCES += main.cpp \ + rclmain.cpp \ + idxthread.cpp \ + plaintorich.cpp + +HEADERS = rclmain.h + +FORMS = recollmain.ui \ + advsearch.ui \ + preview/preview.ui \ + sort.ui \ + uiprefs.ui + + +IMAGES = images/filenew \ + images/fileopen \ + images/filesave \ + images/print \ + images/undo \ + images/redo \ + images/editcut \ + images/editcopy \ + images/editpaste \ + images/searchfind \ + images/asearch \ + images/history \ + images/nextpage \ + images/prevpage \ + images/sortparms + +unix { + UI_DIR = .ui + MOC_DIR = .moc + OBJECTS_DIR = .obj + + DEFINES += RECOLL_DATADIR=\"@QTRECOLL_DATADIR@\" + LIBS += ../lib/librcl.a ../bincimapmime/libmime.a \ + $(BSTATIC) @LIBXAPIAN@ @LIBICONV@ $(BDYNAMIC) \ + -lz + + INCLUDEPATH += ../common ../index ../query ../unac ../utils + POST_TARGETDEPS = ../lib/librcl.a +} + +UNAME = $$system(uname -s) +contains( UNAME, [lL]inux ) { + LIBS -= -liconv +} + +TRANSLATIONS = recoll_fr.ts diff --git a/src/qtgui/recollmain.ui b/src/qtgui/recollmain.ui index 35e8928e..1740db7e 100644 --- a/src/qtgui/recollmain.ui +++ b/src/qtgui/recollmain.ui @@ -8,8 +8,8 @@ <rect> <x>0</x> <y>0</y> - <width>678</width> - <height>212</height> + <width>681</width> + <height>244</height> </rect> </property> <property name="sizePolicy"> @@ -22,8 +22,8 @@ </property> <property name="minimumSize"> <size> - <width>362</width> - <height>190</height> + <width>25</width> + <height>244</height> </size> </property> <property name="caption"> @@ -35,101 +35,28 @@ </property> <widget class="QLayoutWidget"> <property name="name"> - <cstring>layout30</cstring> + <cstring>unnamed</cstring> </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="SSearchBase"> <property name="name"> - <cstring>layout29</cstring> + <cstring>sSearch</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QPushButton"> - <property name="name"> - <cstring>clearqPB</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Clear</string> - </property> - <property name="accel"> - <string>Ctrl+S</string> - </property> - <property name="toolTip" stdset="0"> - <string>Erase search entry</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>searchPB</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Search</string> - </property> - <property name="toolTip" stdset="0"> - <string>Start query</string> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>allTermsCB</cstring> - </property> - <property name="text"> - <string>&All terms</string> - </property> - <property name="accel"> - <string>Alt+A</string> - </property> - <property name="toolTip" stdset="0"> - <string>Do documents have to contain all terms in query?</string> - </property> - <property name="whatsThis" stdset="0"> - <string>If this is set, each returned document will contain all the terms in the query. Else documents will be ordered by relevance, but may not contain all the terms.</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>queryText</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>8</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>155</width> - <height>0</height> - </size> - </property> - <property name="frameShape"> - <enum>LineEditPanel</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="toolTip" stdset="0"> - <string>Enter search terms here</string> - </property> - </widget> - </hbox> </widget> - <widget class="QTextEdit"> + <widget class="ResListBase"> <property name="name"> - <cstring>reslistTE</cstring> + <cstring>resList</cstring> </property> <property name="sizePolicy"> <sizepolicy> @@ -139,15 +66,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="textFormat"> - <enum>RichText</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="undoRedoEnabled"> - <bool>false</bool> - </property> </widget> </vbox> </widget> @@ -200,6 +118,50 @@ <action name="nextPageAction"/> </toolbar> </toolbars> +<customwidgets> + <customwidget> + <class>SSearchBase</class> + <header location="local">ssearchb.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>startSearch(Rcl::AdvSearchData)</signal> + </customwidget> + <customwidget> + <class>ResListBase</class> + <header location="local">reslistb.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image1</pixmap> + <signal>docDoubleClicked(int)</signal> + <signal>docClicked(int)</signal> + <signal>headerClicked()</signal> + <signal>nextPageAvailable(bool)</signal> + <signal>prevPageAvailable(bool)</signal> + <slot access="public" specifier="">resPageUpOrBack()</slot> + <slot access="public" specifier="">resPageDownOrNext()</slot> + <slot access="public" specifier="">resultPageBack()</slot> + <slot access="public" specifier="">showResultPage()</slot> + </customwidget> +</customwidgets> <actions> <action> <property name="name"> @@ -342,6 +304,14 @@ </property> </action> </actions> +<images> + <image name="image0"> + <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="XBM.GZ" length="79">789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data> + </image> +</images> <connections> <connection> <sender>fileExitAction</sender> @@ -355,30 +325,6 @@ <receiver>RclMainBase</receiver> <slot>fileStart_IndexingAction_activated()</slot> </connection> - <connection> - <sender>searchPB</sender> - <signal>clicked()</signal> - <receiver>RclMainBase</receiver> - <slot>startSimpleSearch()</slot> - </connection> - <connection> - <sender>queryText</sender> - <signal>returnPressed()</signal> - <receiver>RclMainBase</receiver> - <slot>startSimpleSearch()</slot> - </connection> - <connection> - <sender>reslistTE</sender> - <signal>doubleClicked(int,int)</signal> - <receiver>RclMainBase</receiver> - <slot>reslistTE_doubleClicked(int,int)</slot> - </connection> - <connection> - <sender>reslistTE</sender> - <signal>clicked(int,int)</signal> - <receiver>RclMainBase</receiver> - <slot>reslistTE_clicked(int,int)</slot> - </connection> <connection> <sender>helpAbout_RecollAction</sender> <signal>activated()</signal> @@ -397,18 +343,6 @@ <receiver>RclMainBase</receiver> <slot>showDocHistory()</slot> </connection> - <connection> - <sender>queryText</sender> - <signal>textChanged(const QString&)</signal> - <receiver>RclMainBase</receiver> - <slot>searchTextChanged(const QString&)</slot> - </connection> - <connection> - <sender>clearqPB</sender> - <signal>clicked()</signal> - <receiver>queryText</receiver> - <slot>clear()</slot> - </connection> <connection> <sender>toolsAdvanced_SearchAction</sender> <signal>activated()</signal> @@ -424,13 +358,13 @@ <connection> <sender>prevPageAction</sender> <signal>activated()</signal> - <receiver>RclMainBase</receiver> + <receiver>resList</receiver> <slot>resultPageBack()</slot> </connection> <connection> <sender>nextPageAction</sender> <signal>activated()</signal> - <receiver>RclMainBase</receiver> + <receiver>resList</receiver> <slot>showResultPage()</slot> </connection> <connection> @@ -439,35 +373,59 @@ <receiver>RclMainBase</receiver> <slot>showUIPrefs()</slot> </connection> + <connection> + <sender>resList</sender> + <signal>nextPageAvailable(bool)</signal> + <receiver>RclMainBase</receiver> + <slot>enableNextPage(bool)</slot> + </connection> + <connection> + <sender>resList</sender> + <signal>prevPageAvailable(bool)</signal> + <receiver>RclMainBase</receiver> + <slot>enablePrevPage(bool)</slot> + </connection> + <connection> + <sender>resList</sender> + <signal>docDoubleClicked(int)</signal> + <receiver>RclMainBase</receiver> + <slot>startNativeViewer(int)</slot> + </connection> + <connection> + <sender>resList</sender> + <signal>docClicked(int)</signal> + <receiver>RclMainBase</receiver> + <slot>startPreview(int)</slot> + </connection> + <connection> + <sender>resList</sender> + <signal>headerClicked()</signal> + <receiver>RclMainBase</receiver> + <slot>showQueryDetails()</slot> + </connection> </connections> <includes> + <include location="local" impldecl="in declaration">ssearchb.h</include> + <include location="local" impldecl="in declaration">reslistb.h</include> </includes> -<variables> -</variables> <slots> <slot>fileExit()</slot> <slot>periodic100()</slot> <slot>fileStart_IndexingAction_activated()</slot> - <slot>reslistTE_doubleClicked( int par, int )</slot> - <slot>reslistTE_clicked( int par, int car )</slot> - <slot>reslistTE_delayedclick()</slot> - <slot>startSimpleSearch()</slot> - <slot>resPageUpOrBack()</slot> - <slot>resPageDownOrNext()</slot> - <slot>resultPageBack()</slot> - <slot>showResultPage()</slot> <slot>previewClosed( QWidget * w )</slot> <slot>showAdvSearchDialog()</slot> <slot>showSortDialog()</slot> <slot>showAboutDialog()</slot> <slot>startManual()</slot> <slot>showDocHistory()</slot> - <slot>searchTextChanged( const QString & text )</slot> <slot>showUIPrefs()</slot> <slot>setUIPrefs()</slot> + <slot>enableNextPage(bool)</slot> + <slot>enablePrevPage(bool)</slot> + <slot>startNativeViewer(int)</slot> + <slot>startPreview(int)</slot> + <slot>showQueryDetails()</slot> </slots> -<functions> -</functions> <pixmapinproject/> <layoutdefaults spacing="6" margin="11"/> </UI> diff --git a/src/qtgui/recollmain.ui.h b/src/qtgui/recollmain.ui.h index 18b1069c..921576e4 100644 --- a/src/qtgui/recollmain.ui.h +++ b/src/qtgui/recollmain.ui.h @@ -18,30 +18,6 @@ void RclMainBase::periodic100() void RclMainBase::fileStart_IndexingAction_activated() { } -void RclMainBase::reslistTE_doubleClicked( int , int ) -{ -} -void RclMainBase::reslistTE_clicked( int , int ) -{ -} -void RclMainBase::reslistTE_delayedclick() -{ -} -void RclMainBase::startSimpleSearch() -{ -} -void RclMainBase::resPageUpOrBack() -{ -} -void RclMainBase::resPageDownOrNext() -{ -} -void RclMainBase::resultPageBack() -{ -} -void RclMainBase::showResultPage() -{ -} void RclMainBase::previewClosed( QWidget * ) { } @@ -60,12 +36,24 @@ void RclMainBase::startManual() void RclMainBase::showDocHistory() { } -void RclMainBase::searchTextChanged( const QString & ) -{ -} void RclMainBase::showUIPrefs() { } void RclMainBase::setUIPrefs() { } +void RclMainBase::enableNextPage(bool) +{ +} +void RclMainBase::enablePrevPage(bool) +{ +} +void RclMainBase::startNativeViewer(int) +{ +} +void RclMainBase::startPreview(int) +{ +} +void RclMainBase::showQueryDetails() +{ +} diff --git a/src/qtgui/reslistb.ui b/src/qtgui/reslistb.ui index e3ad87bc..c0d72649 100644 --- a/src/qtgui/reslistb.ui +++ b/src/qtgui/reslistb.ui @@ -83,10 +83,8 @@ <variable access="private">DocSequence *m_docsource;</variable> </variables> <signals> - <signal>lastPageReached()</signal> - <signal>nextPageAvailable()</signal> - <signal>firstPageReached()</signal> - <signal>prevPageAvailable()</signal> + <signal>nextPageAvailable(bool)</signal> + <signal>prevPageAvailable(bool)</signal> <signal>docDoubleClicked(int)</signal> <signal>docClicked(int)</signal> <signal>headerClicked()</signal> @@ -103,6 +101,7 @@ <functions> <function access="private">init()</function> <function returnType="int" access="private">reldocnumfromparnum( int )</function> + <function access="public">setDocSource(DocSequence *)</function> </functions> <layoutdefaults spacing="6" margin="11"/> </UI> diff --git a/src/qtgui/reslistb.ui.h b/src/qtgui/reslistb.ui.h index a796da24..1a4a0d8a 100644 --- a/src/qtgui/reslistb.ui.h +++ b/src/qtgui/reslistb.ui.h @@ -154,6 +154,12 @@ void ResListBase::resultPageBack() showResultPage(); } +void ResListBase::setDocSource(DocSequence *docsource) +{ + m_docsource = docsource; + showResultPage(); +} + // Fill up result list window with next screen of hits void ResListBase::showResultPage() { @@ -173,15 +179,15 @@ void ResListBase::showResultPage() // If we are already on the last page, nothing to do: if (m_winfirst >= 0 && (m_winfirst + prefs_respagesize > resCnt)) { - emit lastPageReached(); + emit nextPageAvailable(false); return; } if (m_winfirst < 0) { m_winfirst = 0; - emit firstPageReached(); + emit prevPageAvailable(false); } else { - emit prevPageAvailable(); + emit prevPageAvailable(true); m_winfirst += prefs_respagesize; } @@ -312,8 +318,8 @@ void ResListBase::showResultPage() if (m_winfirst < 0 || (m_winfirst >= 0 && m_winfirst + prefs_respagesize >= resCnt)) { - emit lastPageReached(); + emit nextPageAvailable(false); } else { - emit nextPageAvailable(); + emit nextPageAvailable(true); } } diff --git a/src/qtgui/ssearchb.ui b/src/qtgui/ssearchb.ui index c266da3d..0d81077f 100644 --- a/src/qtgui/ssearchb.ui +++ b/src/qtgui/ssearchb.ui @@ -8,7 +8,7 @@ <rect> <x>0</x> <y>0</y> - <width>516</width> + <width>525</width> <height>48</height> </rect> </property> @@ -144,5 +144,5 @@ <slot>searchTextChanged( const QString & text )</slot> <slot>startSimpleSearch()</slot> </slots> -<layoutdefaults spacing="6" margin="11"/> +<layoutdefaults spacing="6" margin="0"/> </UI>