more modularization
This commit is contained in:
parent
348bf377ae
commit
fd79eae560
@ -62,7 +62,6 @@ void RclMain::init()
|
|||||||
sortform = 0;
|
sortform = 0;
|
||||||
sortwidth = 0;
|
sortwidth = 0;
|
||||||
uiprefs = 0;
|
uiprefs = 0;
|
||||||
docsource = 0;
|
|
||||||
|
|
||||||
// We manage pgup/down, but let ie the arrows for the editor to process
|
// We manage pgup/down, but let ie the arrows for the editor to process
|
||||||
resList->reslistTE->installEventFilter(this);
|
resList->reslistTE->installEventFilter(this);
|
||||||
@ -287,12 +286,7 @@ void RclMain::startAdvSearch(Rcl::AdvSearchData sdata)
|
|||||||
return;
|
return;
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
|
|
||||||
if (docsource) {
|
DocSequence *docsource;
|
||||||
delete docsource;
|
|
||||||
docsource = 0;
|
|
||||||
resList->setDocSource(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sortwidth > 0) {
|
if (sortwidth > 0) {
|
||||||
DocSequenceDb myseq(rcldb, tr("Query results"));
|
DocSequenceDb myseq(rcldb, tr("Query results"));
|
||||||
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
||||||
@ -379,7 +373,7 @@ void RclMain::showUIPrefs()
|
|||||||
void RclMain::startPreview(int docnum)
|
void RclMain::startPreview(int docnum)
|
||||||
{
|
{
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (!docsource->getDoc(docnum, doc, 0)) {
|
if (!resList->getDoc(docnum, doc)) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("Cannot retrieve document info"
|
tr("Cannot retrieve document info"
|
||||||
" from database"));
|
" from database"));
|
||||||
@ -423,7 +417,7 @@ void RclMain::startPreview(int docnum)
|
|||||||
void RclMain::startNativeViewer(int docnum)
|
void RclMain::startNativeViewer(int docnum)
|
||||||
{
|
{
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (!docsource->getDoc(docnum, doc, 0, 0)) {
|
if (!resList->getDoc(docnum, doc)) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("Cannot retrieve document info"
|
tr("Cannot retrieve document info"
|
||||||
" from database"));
|
" from database"));
|
||||||
@ -491,12 +485,8 @@ void RclMain::showDocHistory()
|
|||||||
LOGDEB(("RclMain::showDocHistory\n"));
|
LOGDEB(("RclMain::showDocHistory\n"));
|
||||||
resList->m_winfirst = -1;
|
resList->m_winfirst = -1;
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
if (docsource) {
|
|
||||||
delete docsource;
|
|
||||||
docsource = 0;
|
|
||||||
resList->setDocSource(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DocSequence *docsource;
|
||||||
if (sortwidth > 0) {
|
if (sortwidth > 0) {
|
||||||
DocSequenceHistory myseq(rcldb, m_history, tr("Document history"));
|
DocSequenceHistory myseq(rcldb, m_history, tr("Document history"));
|
||||||
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
||||||
|
|||||||
@ -52,7 +52,6 @@ protected:
|
|||||||
UIPrefsDialog *uiprefs;
|
UIPrefsDialog *uiprefs;
|
||||||
int sortwidth;
|
int sortwidth;
|
||||||
RclSortSpec sortspecs;
|
RclSortSpec sortspecs;
|
||||||
DocSequence *docsource;
|
|
||||||
RclDHistory *m_history;
|
RclDHistory *m_history;
|
||||||
private:
|
private:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|||||||
@ -100,7 +100,9 @@
|
|||||||
</slots>
|
</slots>
|
||||||
<functions>
|
<functions>
|
||||||
<function access="private">init()</function>
|
<function access="private">init()</function>
|
||||||
|
<function access="private">destroy()</function>
|
||||||
<function returnType="int" access="private">reldocnumfromparnum( int )</function>
|
<function returnType="int" access="private">reldocnumfromparnum( int )</function>
|
||||||
|
<function returnType="bool" access="public">getDoc( int, Rcl::Doc & )</function>
|
||||||
<function access="public">setDocSource(DocSequence *)</function>
|
<function access="public">setDocSource(DocSequence *)</function>
|
||||||
</functions>
|
</functions>
|
||||||
<layoutdefaults spacing="6" margin="11"/>
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
|||||||
@ -34,9 +34,30 @@ void ResListBase::init()
|
|||||||
m_car = -1;
|
m_car = -1;
|
||||||
m_waitingdbl = false;
|
m_waitingdbl = false;
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
|
m_docsource = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// how we format the title etc..
|
void ResListBase::destroy()
|
||||||
|
{
|
||||||
|
if (m_docsource)
|
||||||
|
delete m_docsource;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Acquire new docsource
|
||||||
|
void ResListBase::setDocSource(DocSequence *docsource)
|
||||||
|
{
|
||||||
|
if (m_docsource)
|
||||||
|
delete m_docsource;
|
||||||
|
m_docsource = docsource;
|
||||||
|
showResultPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ResListBase::getDoc(int docnum, Rcl::Doc &doc)
|
||||||
|
{
|
||||||
|
return m_docsource ? m_docsource->getDoc(docnum, doc, 0, 0) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get document number-in-window from paragraph number
|
||||||
int ResListBase::reldocnumfromparnum(int par)
|
int ResListBase::reldocnumfromparnum(int par)
|
||||||
{
|
{
|
||||||
std::map<int,int>::iterator it = m_pageParaToReldocnums.find(par);
|
std::map<int,int>::iterator it = m_pageParaToReldocnums.find(par);
|
||||||
@ -50,10 +71,10 @@ int ResListBase::reldocnumfromparnum(int par)
|
|||||||
return rdn;
|
return rdn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double click in result list: use external viewer to display file
|
// Double click in result list
|
||||||
void ResListBase::doubleClicked(int par, int )
|
void ResListBase::doubleClicked(int par, int )
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::reslist::doubleClicked: par %d\n", par));
|
LOGDEB(("ResListBase::doubleClicked: par %d\n", par));
|
||||||
m_dblclck = true;
|
m_dblclck = true;
|
||||||
int reldocnum = reldocnumfromparnum(par);
|
int reldocnum = reldocnumfromparnum(par);
|
||||||
if (reldocnum < 0)
|
if (reldocnum < 0)
|
||||||
@ -61,16 +82,14 @@ void ResListBase::doubleClicked(int par, int )
|
|||||||
emit docDoubleClicked(m_winfirst + reldocnum);
|
emit docDoubleClicked(m_winfirst + reldocnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Single click in result list: we don't actually do anything but
|
||||||
// Display preview for the selected document, and highlight entry. The
|
// start a timer because we want to check first if this might be a
|
||||||
// paragraph number is doc number in window + 1
|
// double click
|
||||||
// We don't actually do anything but start a timer because we want to
|
|
||||||
// check first if this might be a double click
|
|
||||||
void ResListBase::clicked(int par, int car)
|
void ResListBase::clicked(int par, int car)
|
||||||
{
|
{
|
||||||
if (m_waitingdbl)
|
if (m_waitingdbl)
|
||||||
return;
|
return;
|
||||||
LOGDEB(("RclMain::reslistTE_clicked:wfirst %d par %d char %d drg %d\n",
|
LOGDEB(("ResListBase::clicked:wfirst %d par %d char %d drg %d\n",
|
||||||
m_winfirst, par, car, m_mouseDrag));
|
m_winfirst, par, car, m_mouseDrag));
|
||||||
if (m_winfirst == -1 || m_mouseDrag)
|
if (m_winfirst == -1 || m_mouseDrag)
|
||||||
return;
|
return;
|
||||||
@ -81,19 +100,20 @@ void ResListBase::clicked(int par, int car)
|
|||||||
m_waitingdbl = true;
|
m_waitingdbl = true;
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
// Wait to see if there's going to be a dblclck
|
// Wait to see if there's going to be a dblclck
|
||||||
QTimer::singleShot(150, this, SLOT(reslistTE_delayedclick()) );
|
QTimer::singleShot(150, this, SLOT(delayedClick()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This gets called by a timer 100mS after a single click in the
|
// 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
|
// result list. We don't want to start a preview if the user has
|
||||||
// requested a native viewer by double-clicking
|
// requested a native viewer by double-clicking. If this was not actually
|
||||||
|
// a double-clik, we finally say it's a click, and change the active paragraph
|
||||||
void ResListBase::delayedClick()
|
void ResListBase::delayedClick()
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::reslistTE_delayedclick:\n"));
|
LOGDEB(("ResListBase::delayedClick:\n"));
|
||||||
m_waitingdbl = false;
|
m_waitingdbl = false;
|
||||||
if (m_dblclck) {
|
if (m_dblclck) {
|
||||||
LOGDEB1(("RclMain::reslistTE_delayedclick: dbleclick\n"));
|
LOGDEB1(("ResListBase::delayedclick: dbleclick\n"));
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -138,7 +158,7 @@ void ResListBase::resPageDownOrNext()
|
|||||||
{
|
{
|
||||||
int vpos = reslistTE->contentsY();
|
int vpos = reslistTE->contentsY();
|
||||||
reslistTE->moveCursor(QTextEdit::MovePgDown, false);
|
reslistTE->moveCursor(QTextEdit::MovePgDown, false);
|
||||||
LOGDEB(("RclMain::resPageDownOrNext: vpos before %d, after %d\n",
|
LOGDEB(("ResListBase::resPageDownOrNext: vpos before %d, after %d\n",
|
||||||
vpos, reslistTE->contentsY()));
|
vpos, reslistTE->contentsY()));
|
||||||
if (vpos == reslistTE->contentsY())
|
if (vpos == reslistTE->contentsY())
|
||||||
showResultPage();
|
showResultPage();
|
||||||
@ -154,12 +174,6 @@ void ResListBase::resultPageBack()
|
|||||||
showResultPage();
|
showResultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResListBase::setDocSource(DocSequence *docsource)
|
|
||||||
{
|
|
||||||
m_docsource = docsource;
|
|
||||||
showResultPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill up result list window with next screen of hits
|
// Fill up result list window with next screen of hits
|
||||||
void ResListBase::showResultPage()
|
void ResListBase::showResultPage()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,11 +23,10 @@ void SSearchBase::searchTextChanged( const QString & text )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SSearchBase::startSimpleSearch()
|
void SSearchBase::startSimpleSearch()
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::queryText_returnPressed()\n"));
|
LOGDEB(("SSearchBase::startSimpleSearch\n"));
|
||||||
// The db may have been closed at the end of indexing
|
|
||||||
Rcl::AdvSearchData sdata;
|
Rcl::AdvSearchData sdata;
|
||||||
|
|
||||||
QCString u8 = queryText->text().utf8();
|
QCString u8 = queryText->text().utf8();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user