reslistb form replaced by object derived from QTextBrowser
This commit is contained in:
parent
d4852f3b0d
commit
0dee171e81
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.11 2006-01-30 09:28:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.12 2006-03-21 09:15:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -41,7 +41,7 @@ using std::pair;
|
|||||||
#include <qfontdialog.h>
|
#include <qfontdialog.h>
|
||||||
#include <qspinbox.h>
|
#include <qspinbox.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qtextedit.h>
|
#include <qtextbrowser.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qaction.h>
|
#include <qaction.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
@ -58,6 +58,7 @@ using std::pair;
|
|||||||
#include "sortseq.h"
|
#include "sortseq.h"
|
||||||
#include "uiprefs.h"
|
#include "uiprefs.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "rclreslist.h"
|
||||||
|
|
||||||
#include "rclmain.h"
|
#include "rclmain.h"
|
||||||
#include "moc_rclmain.cpp"
|
#include "moc_rclmain.cpp"
|
||||||
@ -82,11 +83,6 @@ void RclMain::init()
|
|||||||
sortwidth = 0;
|
sortwidth = 0;
|
||||||
uiprefs = 0;
|
uiprefs = 0;
|
||||||
|
|
||||||
// We manage pgup/down, but let ie the arrows for the editor to process
|
|
||||||
resList->reslistTE->installEventFilter(this);
|
|
||||||
resList->reslistTE->viewport()->installEventFilter(this);
|
|
||||||
// resList->viewport()->setFocusPolicy(QWidget::NoFocus);
|
|
||||||
|
|
||||||
// Set the focus to the search terms entry:
|
// Set the focus to the search terms entry:
|
||||||
sSearch->queryText->setFocus();
|
sSearch->queryText->setFocus();
|
||||||
|
|
||||||
@ -199,49 +195,6 @@ static const char *eventTypeToStr(int tp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// There are a number of events that we want to process. Not sure the
|
|
||||||
// ^Q thing is necessary (we have an action for this)?
|
|
||||||
// TODO: Some of this probably should be moved into the reslist object
|
|
||||||
bool RclMain::eventFilter( QObject * target, QEvent * event )
|
|
||||||
{
|
|
||||||
#if defined(SHOWEVENTS)
|
|
||||||
LOGDEB(("RclMain::eventFilter target %p, event %s\n", target,
|
|
||||||
eventTypeToStr(int(event->type()))));
|
|
||||||
#endif
|
|
||||||
if (event->type() == QEvent::KeyPress) {
|
|
||||||
QKeyEvent *keyEvent = (QKeyEvent *)event;
|
|
||||||
if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) {
|
|
||||||
recollNeedsExit = 1;
|
|
||||||
} else if (keyEvent->key() == Key_Prior) {
|
|
||||||
resList->resPageUpOrBack();
|
|
||||||
return true;
|
|
||||||
} else if (keyEvent->key() == Key_Next) {
|
|
||||||
resList->resPageDownOrNext();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} 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(("resList: MouseMove\n"));
|
|
||||||
if (resList->m_mouseDown)
|
|
||||||
resList->m_mouseDrag = true;
|
|
||||||
} else if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
LOGDEB1(("resList: MouseButtonPress\n"));
|
|
||||||
resList->m_mouseDown = true;
|
|
||||||
resList->m_mouseDrag = false;
|
|
||||||
} else if (event->type() == QEvent::MouseButtonRelease) {
|
|
||||||
LOGDEB1(("resList: MouseButtonRelease\n"));
|
|
||||||
resList->m_mouseDown = false;
|
|
||||||
} else if (event->type() == QEvent::MouseButtonDblClick) {
|
|
||||||
LOGDEB1(("resList: MouseButtonDblClick\n"));
|
|
||||||
resList->m_mouseDown = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::eventFilter(target, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RclMain::fileExit()
|
void RclMain::fileExit()
|
||||||
{
|
{
|
||||||
LOGDEB1(("RclMain: fileExit\n"));
|
LOGDEB1(("RclMain: fileExit\n"));
|
||||||
|
|||||||
@ -71,7 +71,6 @@ protected:
|
|||||||
RclDHistory *m_history;
|
RclDHistory *m_history;
|
||||||
private:
|
private:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual bool eventFilter( QObject * target, QEvent * event );
|
|
||||||
virtual void startPreview( int docnum );
|
virtual void startPreview( int docnum );
|
||||||
virtual void startNativeViewer( int docnum );
|
virtual void startNativeViewer( int docnum );
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,33 +1,14 @@
|
|||||||
/*
|
#ifndef lint
|
||||||
* This program is free software; you can redistribute it and/or modify
|
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.1 2006-03-21 09:15:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
* it under the terms of the GNU General Public License as published by
|
#endif
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
/****************************************************************************
|
|
||||||
** ui.h extension file, included from the uic-generated form implementation.
|
|
||||||
**
|
|
||||||
** If you want to add, delete, or rename functions or slots, use
|
|
||||||
** Qt Designer to update this file, preserving your code.
|
|
||||||
**
|
|
||||||
** You should not define a constructor or destructor in this file.
|
|
||||||
** Instead, write your code in functions called init() and destroy().
|
|
||||||
** These will automatically be called by the form's constructor and
|
|
||||||
** destructor.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <qvariant.h>
|
||||||
|
#include <qpushbutton.h>
|
||||||
|
#include <qlayout.h>
|
||||||
|
#include <qtooltip.h>
|
||||||
|
#include <qwhatsthis.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qimage.h>
|
#include <qimage.h>
|
||||||
@ -38,14 +19,32 @@
|
|||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
|
|
||||||
#include "reslistb.h"
|
#include "rclreslist.h"
|
||||||
|
#include "moc_rclreslist.cpp"
|
||||||
|
|
||||||
#ifndef MIN
|
#ifndef MIN
|
||||||
#define MIN(A,B) ((A) < (B) ? (A) : (B))
|
#define MIN(A,B) ((A) < (B) ? (A) : (B))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ResListBase::init()
|
RclResList::RclResList(QWidget* parent, const char* name)
|
||||||
|
: QTextBrowser(parent, name)
|
||||||
{
|
{
|
||||||
|
if ( !name )
|
||||||
|
setName( "rclResList" );
|
||||||
|
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 2, 0, this->sizePolicy().hasHeightForWidth() ) );
|
||||||
|
setTextFormat( RclResList::RichText );
|
||||||
|
setReadOnly( TRUE );
|
||||||
|
setUndoRedoEnabled( FALSE );
|
||||||
|
languageChange();
|
||||||
|
resize( QSize(198, 144).expandedTo(minimumSizeHint()) );
|
||||||
|
clearWState( WState_Polished );
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
|
connect(this, SIGNAL( doubleClicked( int , int ) ), this, SLOT( doubleClicked(int,int) ) );
|
||||||
|
connect(this, SIGNAL( clicked( int , int ) ), this, SLOT( clicked(int,int) ) );
|
||||||
|
|
||||||
|
|
||||||
|
// Code from init:
|
||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
m_mouseDrag = false;
|
m_mouseDrag = false;
|
||||||
m_mouseDown = false;
|
m_mouseDown = false;
|
||||||
@ -54,16 +53,26 @@ void ResListBase::init()
|
|||||||
m_waitingdbl = false;
|
m_waitingdbl = false;
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
m_docsource = 0;
|
m_docsource = 0;
|
||||||
|
connect(this, SIGNAL(linkClicked(const QString &)),
|
||||||
|
this, SLOT(linkWasClicked(const QString &)));
|
||||||
|
viewport()->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResListBase::destroy()
|
|
||||||
|
RclResList::~RclResList()
|
||||||
{
|
{
|
||||||
if (m_docsource)
|
if (m_docsource)
|
||||||
delete m_docsource;
|
delete m_docsource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RclResList::languageChange()
|
||||||
|
{
|
||||||
|
setCaption( tr( "Result list" ) );
|
||||||
|
}
|
||||||
|
|
||||||
// Acquire new docsource
|
// Acquire new docsource
|
||||||
void ResListBase::setDocSource(DocSequence *docsource)
|
void RclResList::setDocSource(DocSequence *docsource)
|
||||||
{
|
{
|
||||||
if (m_docsource)
|
if (m_docsource)
|
||||||
delete m_docsource;
|
delete m_docsource;
|
||||||
@ -71,7 +80,7 @@ void ResListBase::setDocSource(DocSequence *docsource)
|
|||||||
showResultPage();
|
showResultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResListBase::getDoc(int docnum, Rcl::Doc &doc)
|
bool RclResList::getDoc(int docnum, Rcl::Doc &doc)
|
||||||
{
|
{
|
||||||
if (docnum >= 0 && docnum >= int(m_winfirst) &&
|
if (docnum >= 0 && docnum >= int(m_winfirst) &&
|
||||||
docnum < int(m_winfirst + m_curDocs.size())) {
|
docnum < int(m_winfirst + m_curDocs.size())) {
|
||||||
@ -82,7 +91,7 @@ bool ResListBase::getDoc(int docnum, Rcl::Doc &doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get document number-in-window from paragraph number
|
// Get document number-in-window from paragraph number
|
||||||
int ResListBase::reldocnumfromparnum(int par)
|
int RclResList::reldocnumfromparnum(int par)
|
||||||
{
|
{
|
||||||
std::map<int,int>::iterator it = m_pageParaToReldocnums.find(par);
|
std::map<int,int>::iterator it = m_pageParaToReldocnums.find(par);
|
||||||
int rdn;
|
int rdn;
|
||||||
@ -96,9 +105,9 @@ int ResListBase::reldocnumfromparnum(int par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double click in result list
|
// Double click in result list
|
||||||
void ResListBase::doubleClicked(int par, int )
|
void RclResList::doubleClicked(int par, int )
|
||||||
{
|
{
|
||||||
LOGDEB(("ResListBase::doubleClicked: par %d\n", par));
|
LOGDEB(("RclResList::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)
|
||||||
@ -109,11 +118,11 @@ void ResListBase::doubleClicked(int par, int )
|
|||||||
// Single click in result list: we don't actually do anything but
|
// Single click in result list: we don't actually do anything but
|
||||||
// start a timer because we want to check first if this might be a
|
// start a timer because we want to check first if this might be a
|
||||||
// double click
|
// double click
|
||||||
void ResListBase::clicked(int par, int car)
|
void RclResList::clicked(int par, int car)
|
||||||
{
|
{
|
||||||
if (m_waitingdbl)
|
if (m_waitingdbl)
|
||||||
return;
|
return;
|
||||||
LOGDEB(("ResListBase::clicked:wfirst %d par %d char %d drg %d\n",
|
LOGDEB(("RclResList::clicked:wfirst %d par %d char %d drg %d\n",
|
||||||
m_winfirst, par, car, m_mouseDrag));
|
m_winfirst, par, car, m_mouseDrag));
|
||||||
if (m_mouseDrag)
|
if (m_mouseDrag)
|
||||||
return;
|
return;
|
||||||
@ -132,12 +141,12 @@ void ResListBase::clicked(int par, int car)
|
|||||||
// 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. If this was not actually
|
// 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
|
// a double-clik, we finally say it's a click, and change the active paragraph
|
||||||
void ResListBase::delayedClick()
|
void RclResList::delayedClick()
|
||||||
{
|
{
|
||||||
LOGDEB(("ResListBase::delayedClick:\n"));
|
LOGDEB(("RclResList::delayedClick:\n"));
|
||||||
m_waitingdbl = false;
|
m_waitingdbl = false;
|
||||||
if (m_dblclck) {
|
if (m_dblclck) {
|
||||||
LOGDEB1(("ResListBase::delayedclick: dbleclick\n"));
|
LOGDEB1(("RclResList::delayedclick: dbleclick\n"));
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -147,13 +156,13 @@ void ResListBase::delayedClick()
|
|||||||
// Erase everything back to white
|
// Erase everything back to white
|
||||||
{
|
{
|
||||||
QColor color("white");
|
QColor color("white");
|
||||||
for (int i = 1; i < reslistTE->paragraphs(); i++)
|
for (int i = 1; i < paragraphs(); i++)
|
||||||
reslistTE->setParagraphBackgroundColor(i, color);
|
setParagraphBackgroundColor(i, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color the new active paragraph
|
// Color the new active paragraph
|
||||||
QColor color("lightblue");
|
QColor color("lightblue");
|
||||||
reslistTE->setParagraphBackgroundColor(par, color);
|
setParagraphBackgroundColor(par, color);
|
||||||
|
|
||||||
// Document number
|
// Document number
|
||||||
int reldocnum = reldocnumfromparnum(par);
|
int reldocnum = reldocnumfromparnum(par);
|
||||||
@ -165,32 +174,71 @@ void ResListBase::delayedClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RclResList::eventFilter( QObject *o, QEvent *e )
|
||||||
|
{
|
||||||
|
if (o == viewport()) {
|
||||||
|
// We don't want btdown+drag+btup to be a click ! So monitor
|
||||||
|
// mouse events
|
||||||
|
if (e->type() == QEvent::MouseMove) {
|
||||||
|
LOGDEB1(("resList: MouseMove\n"));
|
||||||
|
if (m_mouseDown)
|
||||||
|
m_mouseDrag = true;
|
||||||
|
} else if (e->type() == QEvent::MouseButtonPress) {
|
||||||
|
LOGDEB1(("resList: MouseButtonPress\n"));
|
||||||
|
m_mouseDown = true;
|
||||||
|
m_mouseDrag = false;
|
||||||
|
} else if (e->type() == QEvent::MouseButtonRelease) {
|
||||||
|
LOGDEB1(("resList: MouseButtonRelease\n"));
|
||||||
|
m_mouseDown = false;
|
||||||
|
} else if (e->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
LOGDEB1(("resList: MouseButtonDblClick\n"));
|
||||||
|
m_mouseDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QTextBrowser::eventFilter(o, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RclResList::keyPressEvent( QKeyEvent * e )
|
||||||
|
{
|
||||||
|
if (e->key() == Key_Q && (e->state() & ControlButton)) {
|
||||||
|
recollNeedsExit = 1;
|
||||||
|
return;
|
||||||
|
} else if (e->key() == Key_Prior) {
|
||||||
|
resPageUpOrBack();
|
||||||
|
return;
|
||||||
|
} else if (e->key() == Key_Next) {
|
||||||
|
resPageDownOrNext();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QTextBrowser::keyPressEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
// Page Up/Down: we don't try to check if current paragraph is last or
|
// 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,
|
// first. We just page up/down and check if viewport moved. If it did,
|
||||||
// fair enough, else we go to next/previous result page.
|
// fair enough, else we go to next/previous result page.
|
||||||
void ResListBase::resPageUpOrBack()
|
void RclResList::resPageUpOrBack()
|
||||||
{
|
{
|
||||||
int vpos = reslistTE->contentsY();
|
int vpos = contentsY();
|
||||||
reslistTE->moveCursor(QTextEdit::MovePgUp, false);
|
moveCursor(QTextEdit::MovePgUp, false);
|
||||||
if (vpos == reslistTE->contentsY())
|
if (vpos == contentsY())
|
||||||
resultPageBack();
|
resultPageBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResListBase::resPageDownOrNext()
|
void RclResList::resPageDownOrNext()
|
||||||
{
|
{
|
||||||
int vpos = reslistTE->contentsY();
|
int vpos = contentsY();
|
||||||
reslistTE->moveCursor(QTextEdit::MovePgDown, false);
|
moveCursor(QTextEdit::MovePgDown, false);
|
||||||
LOGDEB(("ResListBase::resPageDownOrNext: vpos before %d, after %d\n",
|
LOGDEB(("RclResList::resPageDownOrNext: vpos before %d, after %d\n",
|
||||||
vpos, reslistTE->contentsY()));
|
vpos, contentsY()));
|
||||||
if (vpos == reslistTE->contentsY())
|
if (vpos == contentsY())
|
||||||
showResultPage();
|
showResultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show previous page of results. We just set the current number back
|
// Show previous page of results. We just set the current number back
|
||||||
// 2 pages and show next page.
|
// 2 pages and show next page.
|
||||||
void ResListBase::resultPageBack()
|
void RclResList::resultPageBack()
|
||||||
{
|
{
|
||||||
if (m_winfirst <= 0)
|
if (m_winfirst <= 0)
|
||||||
return;
|
return;
|
||||||
@ -215,7 +263,7 @@ static string displayableBytes(long size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill up result list window with next screen of hits
|
// Fill up result list window with next screen of hits
|
||||||
void ResListBase::showResultPage()
|
void RclResList::showResultPage()
|
||||||
{
|
{
|
||||||
if (!m_docsource)
|
if (!m_docsource)
|
||||||
return;
|
return;
|
||||||
@ -246,7 +294,7 @@ void ResListBase::showResultPage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool gotone = false;
|
bool gotone = false;
|
||||||
reslistTE->clear();
|
clear();
|
||||||
|
|
||||||
int last = MIN(resCnt-m_winfirst, prefs.respagesize);
|
int last = MIN(resCnt-m_winfirst, prefs.respagesize);
|
||||||
|
|
||||||
@ -258,7 +306,7 @@ void ResListBase::showResultPage()
|
|||||||
// would like to disable updates while we're doing this, but
|
// 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
|
// couldn't find a way to make it work, the widget seems to become
|
||||||
// confused if appended while updates are disabled
|
// confused if appended while updates are disabled
|
||||||
// reslistTE->setUpdatesEnabled(false);
|
// setUpdatesEnabled(false);
|
||||||
for (int i = 0; i < last; i++) {
|
for (int i = 0; i < last; i++) {
|
||||||
string sh;
|
string sh;
|
||||||
doc.erase();
|
doc.erase();
|
||||||
@ -277,16 +325,17 @@ void ResListBase::showResultPage()
|
|||||||
// Display list header
|
// Display list header
|
||||||
// We could use a <title> but the textedit doesnt display
|
// We could use a <title> but the textedit doesnt display
|
||||||
// it prominently
|
// it prominently
|
||||||
reslistTE->append("<qt><head></head><body>");
|
append("<qt><head></head><body>");
|
||||||
QString line = "<p><font size=+1><b>";
|
QString line = "<p><font size=+1><b>";
|
||||||
line += m_docsource->title().c_str();
|
line += m_docsource->title().c_str();
|
||||||
line += "</b></font><br>";
|
line += "</b></font><br>";
|
||||||
reslistTE->append(line);
|
append(line);
|
||||||
line = tr("<b>Displaying results starting at index"
|
line = tr("<b>Displaying results starting at index"
|
||||||
" %1 (maximum set size %2)</b></p>\n")
|
" %1 (maximum set size %2)</b></p>\n")
|
||||||
.arg(m_winfirst+1)
|
.arg(m_winfirst+1)
|
||||||
.arg(resCnt);
|
.arg(resCnt);
|
||||||
reslistTE->append(line);
|
append(line);
|
||||||
|
append("<a href=\"Une certaine valeur\">Ceci est un lien</a>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
gotone = true;
|
gotone = true;
|
||||||
@ -362,19 +411,19 @@ void ResListBase::showResultPage()
|
|||||||
result += "</p>\n";
|
result += "</p>\n";
|
||||||
|
|
||||||
QString str = QString::fromUtf8(result.c_str(), result.length());
|
QString str = QString::fromUtf8(result.c_str(), result.length());
|
||||||
reslistTE->append(str);
|
append(str);
|
||||||
reslistTE->setCursorPosition(0,0);
|
setCursorPosition(0,0);
|
||||||
|
|
||||||
m_pageParaToReldocnums[reslistTE->paragraphs()-1] = i;
|
m_pageParaToReldocnums[paragraphs()-1] = i;
|
||||||
m_curDocs.push_back(doc);
|
m_curDocs.push_back(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gotone) {
|
if (gotone) {
|
||||||
reslistTE->append("</body></qt>");
|
append("</body></qt>");
|
||||||
reslistTE->ensureCursorVisible();
|
ensureCursorVisible();
|
||||||
} else {
|
} else {
|
||||||
// Restore first in win parameter that we shouln't have incremented
|
// Restore first in win parameter that we shouln't have incremented
|
||||||
reslistTE->append(tr("<p>"
|
append(tr("<p>"
|
||||||
/*"<img align=\"left\" source=\"myimage\">"*/
|
/*"<img align=\"left\" source=\"myimage\">"*/
|
||||||
"<b>No results found</b>"
|
"<b>No results found</b>"
|
||||||
"<br>"));
|
"<br>"));
|
||||||
@ -383,13 +432,13 @@ void ResListBase::showResultPage()
|
|||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//reslistTE->setUpdatesEnabled(true);reslistTE->sync();reslistTE->repaint();
|
//setUpdatesEnabled(true);sync();repaint();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
FILE *fp = fopen("/tmp/reslistdebug", "w");
|
FILE *fp = fopen("/tmp/reslistdebug", "w");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
const char *text = (const char *)reslistTE->text().utf8();
|
const char *text = (const char *)text().utf8();
|
||||||
//const char *text = alltext.c_str();
|
//const char *text = alltext.c_str();
|
||||||
fwrite(text, 1, strlen(text), fp);
|
fwrite(text, 1, strlen(text), fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -405,3 +454,9 @@ void ResListBase::showResultPage()
|
|||||||
emit nextPageAvailable(true);
|
emit nextPageAvailable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RclResList::linkWasClicked(const QString &s)
|
||||||
|
{
|
||||||
|
LOGDEB(("RclResList::linkClicked: [%s]\n", s.ascii()));
|
||||||
|
}
|
||||||
|
|
||||||
65
src/qtgui/rclreslist.h
Normal file
65
src/qtgui/rclreslist.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#ifndef _RCLRESLIST_H_INCLUDED_
|
||||||
|
#define _RCLRESLIST_H_INCLUDED_
|
||||||
|
/* @(#$Id: rclreslist.h,v 1.1 2006-03-21 09:15:56 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||||
|
|
||||||
|
#include <qtextbrowser.h>
|
||||||
|
|
||||||
|
#include "rcldb.h"
|
||||||
|
#include "docseq.h"
|
||||||
|
|
||||||
|
class RclResList : public QTextBrowser
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RclResList(QWidget* parent = 0, const char* name = 0);
|
||||||
|
virtual ~RclResList();
|
||||||
|
|
||||||
|
int m_winfirst;
|
||||||
|
bool m_mouseDrag;
|
||||||
|
bool m_mouseDown;
|
||||||
|
int m_par;
|
||||||
|
int m_car;
|
||||||
|
bool m_waitingdbl;
|
||||||
|
bool m_dblclck;
|
||||||
|
|
||||||
|
virtual bool getDoc( int, Rcl::Doc & );
|
||||||
|
virtual void setDocSource(DocSequence *);
|
||||||
|
bool eventFilter( QObject *o, QEvent *e );
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void doubleClicked( int, int );
|
||||||
|
virtual void clicked( int, int );
|
||||||
|
virtual void delayedClick();
|
||||||
|
virtual void resPageUpOrBack();
|
||||||
|
virtual void resPageDownOrNext();
|
||||||
|
virtual void resultPageBack();
|
||||||
|
virtual void showResultPage();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void nextPageAvailable(bool);
|
||||||
|
void prevPageAvailable(bool);
|
||||||
|
void docDoubleClicked(int);
|
||||||
|
void docClicked(int);
|
||||||
|
void headerClicked();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void keyPressEvent( QKeyEvent * e);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void languageChange();
|
||||||
|
virtual void linkWasClicked( const QString & );
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<int,int> m_pageParaToReldocnums;
|
||||||
|
DocSequence *m_docsource;
|
||||||
|
std::vector<Rcl::Doc> m_curDocs;
|
||||||
|
|
||||||
|
virtual int reldocnumfromparnum( int );
|
||||||
|
void emitLinkClicked(const QString &s) {
|
||||||
|
emit linkClicked(s);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _RCLRESLIST_H_INCLUDED_ */
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="ResListBase">
|
<widget class="RclResList">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>resList</cstring>
|
<cstring>resList</cstring>
|
||||||
</property>
|
</property>
|
||||||
@ -136,31 +136,6 @@
|
|||||||
<pixmap>image0</pixmap>
|
<pixmap>image0</pixmap>
|
||||||
<signal>startSearch(Rcl::AdvSearchData)</signal>
|
<signal>startSearch(Rcl::AdvSearchData)</signal>
|
||||||
</customwidget>
|
</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>
|
</customwidgets>
|
||||||
<actions>
|
<actions>
|
||||||
<action>
|
<action>
|
||||||
@ -406,7 +381,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
<includes>
|
<includes>
|
||||||
<include location="local" impldecl="in declaration">ssearchb.h</include>
|
<include location="local" impldecl="in declaration">ssearchb.h</include>
|
||||||
<include location="local" impldecl="in declaration">reslistb.h</include>
|
<include location="local" impldecl="in declaration">rclreslist.h</include>
|
||||||
</includes>
|
</includes>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>fileExit()</slot>
|
<slot>fileExit()</slot>
|
||||||
|
|||||||
@ -1,111 +0,0 @@
|
|||||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
|
||||||
<class>ResListBase</class>
|
|
||||||
<widget class="QWidget">
|
|
||||||
<property name="name">
|
|
||||||
<cstring>resListBase</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>198</width>
|
|
||||||
<height>144</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="caption">
|
|
||||||
<string>Result list</string>
|
|
||||||
</property>
|
|
||||||
<vbox>
|
|
||||||
<property name="name">
|
|
||||||
<cstring>unnamed</cstring>
|
|
||||||
</property>
|
|
||||||
<widget class="QLayoutWidget">
|
|
||||||
<property name="name">
|
|
||||||
<cstring>unnamed</cstring>
|
|
||||||
</property>
|
|
||||||
<vbox>
|
|
||||||
<property name="name">
|
|
||||||
<cstring>unnamed</cstring>
|
|
||||||
</property>
|
|
||||||
<widget class="QTextEdit">
|
|
||||||
<property name="name">
|
|
||||||
<cstring>reslistTE</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy>
|
|
||||||
<hsizetype>5</hsizetype>
|
|
||||||
<vsizetype>5</vsizetype>
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<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>
|
|
||||||
</vbox>
|
|
||||||
</widget>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>reslistTE</sender>
|
|
||||||
<signal>doubleClicked( int , int )</signal>
|
|
||||||
<receiver>resListBase</receiver>
|
|
||||||
<slot>doubleClicked(int,int)</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>reslistTE</sender>
|
|
||||||
<signal>clicked( int , int )</signal>
|
|
||||||
<receiver>resListBase</receiver>
|
|
||||||
<slot>clicked(int,int)</slot>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
<includes>
|
|
||||||
<include location="local" impldecl="in implementation">reslistb.ui.h</include>
|
|
||||||
<include location="local" impldecl="in declaration">docseq.h</include>
|
|
||||||
<include location="global" impldecl="in declaration">vector</include>
|
|
||||||
</includes>
|
|
||||||
<variables>
|
|
||||||
<variable access="public">int m_winfirst;</variable>
|
|
||||||
<variable access="public">bool m_mouseDrag;</variable>
|
|
||||||
<variable access="public">bool m_mouseDown;</variable>
|
|
||||||
<variable access="public">int m_par;</variable>
|
|
||||||
<variable access="public">int m_car;</variable>
|
|
||||||
<variable access="public">bool m_waitingdbl;</variable>
|
|
||||||
<variable access="public">bool m_dblclck;</variable>
|
|
||||||
<variable access="private">std::map<int,int> m_pageParaToReldocnums;</variable>
|
|
||||||
<variable access="private">DocSequence *m_docsource;</variable>
|
|
||||||
<variable access="private">std::vector<Rcl::Doc> m_curDocs;</variable>
|
|
||||||
</variables>
|
|
||||||
<signals>
|
|
||||||
<signal>nextPageAvailable(bool)</signal>
|
|
||||||
<signal>prevPageAvailable(bool)</signal>
|
|
||||||
<signal>docDoubleClicked(int)</signal>
|
|
||||||
<signal>docClicked(int)</signal>
|
|
||||||
<signal>headerClicked()</signal>
|
|
||||||
</signals>
|
|
||||||
<slots>
|
|
||||||
<slot>doubleClicked( int, int )</slot>
|
|
||||||
<slot>clicked( int, int )</slot>
|
|
||||||
<slot>delayedClick()</slot>
|
|
||||||
<slot>resPageUpOrBack()</slot>
|
|
||||||
<slot>resPageDownOrNext()</slot>
|
|
||||||
<slot>resultPageBack()</slot>
|
|
||||||
<slot>showResultPage()</slot>
|
|
||||||
</slots>
|
|
||||||
<functions>
|
|
||||||
<function access="private">init()</function>
|
|
||||||
<function access="private">destroy()</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>
|
|
||||||
</functions>
|
|
||||||
<layoutdefaults spacing="6" margin="11"/>
|
|
||||||
</UI>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user