|
a/src/qtgui/preview_w.h |
|
b/src/qtgui/preview_w.h |
1 |
#ifndef _PREVIEW_W_H_INCLUDED_
|
1 |
#ifndef _PREVIEW_W_H_INCLUDED_
|
2 |
#define _PREVIEW_W_H_INCLUDED_
|
2 |
#define _PREVIEW_W_H_INCLUDED_
|
3 |
/* @(#$Id: preview_w.h,v 1.1 2006-09-04 15:13:01 dockes Exp $ (C) 2006 J.F.Dockes */
|
3 |
/* @(#$Id: preview_w.h,v 1.2 2006-09-12 10:11:36 dockes Exp $ (C) 2006 J.F.Dockes */
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
8 |
* (at your option) any later version.
|
8 |
* (at your option) any later version.
|
|
... |
|
... |
21 |
#include <qvariant.h>
|
21 |
#include <qvariant.h>
|
22 |
#include <qwidget.h>
|
22 |
#include <qwidget.h>
|
23 |
#include "rcldb.h"
|
23 |
#include "rcldb.h"
|
24 |
#include "preview.h"
|
24 |
#include "preview.h"
|
25 |
|
25 |
|
|
|
26 |
// We keep a list of data associated to each tab
|
|
|
27 |
class TabData {
|
|
|
28 |
public:
|
|
|
29 |
string fn; // filename for this tab
|
|
|
30 |
string ipath; // Internal doc path inside file
|
|
|
31 |
QWidget *w; // widget for setCurrent
|
|
|
32 |
int docnum; // Index of doc in db search results.
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
TabData(QWidget *wi) : w(wi) {}
|
|
|
36 |
};
|
|
|
37 |
|
26 |
class Preview : public PreviewBase
|
38 |
class Preview : public PreviewBase
|
27 |
{
|
39 |
{
|
28 |
Q_OBJECT
|
40 |
Q_OBJECT
|
29 |
|
41 |
|
30 |
public:
|
42 |
public:
|
31 |
Preview( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ) :
|
43 |
Preview(QWidget* parent = 0, const char* name = 0, WFlags fl = 0) :
|
32 |
PreviewBase(parent,name,fl) {init();}
|
44 |
PreviewBase(parent,name,fl) {init();}
|
33 |
|
45 |
|
34 |
~Preview(){}
|
46 |
~Preview(){}
|
35 |
|
47 |
|
|
|
48 |
virtual void setSId(int sid) {m_searchId = sid;}
|
36 |
virtual void closeEvent( QCloseEvent * e );
|
49 |
virtual void closeEvent( QCloseEvent *e );
|
37 |
virtual bool eventFilter( QObject * target, QEvent * event );
|
50 |
virtual bool eventFilter( QObject *target, QEvent *event );
|
38 |
virtual bool makeDocCurrent( const string & fn, const Rcl::Doc & doc );
|
51 |
virtual bool makeDocCurrent( const string & fn, const Rcl::Doc & doc );
|
39 |
virtual QTextEdit * getCurrentEditor();
|
52 |
virtual QTextEdit *getCurrentEditor();
|
40 |
virtual QTextEdit * addEditorTab();
|
53 |
virtual QTextEdit *addEditorTab();
|
41 |
virtual bool loadFileInCurrentTab(string fn, size_t sz,
|
54 |
virtual bool loadFileInCurrentTab(string fn, size_t sz,
|
42 |
const Rcl::Doc & idoc );
|
55 |
const Rcl::Doc& idoc, int dnm);
|
43 |
|
56 |
|
44 |
public slots:
|
57 |
public slots:
|
45 |
virtual void searchTextLine_textChanged( const QString & text );
|
58 |
virtual void searchTextLine_textChanged( const QString & text );
|
46 |
virtual void doSearch( const QString &str, bool next, bool reverse );
|
59 |
virtual void doSearch( const QString &str, bool next, bool reverse );
|
47 |
virtual void nextPressed();
|
60 |
virtual void nextPressed();
|
48 |
virtual void prevPressed();
|
61 |
virtual void prevPressed();
|
49 |
virtual void currentChanged( QWidget * tw );
|
62 |
virtual void currentChanged( QWidget * tw );
|
50 |
virtual void closeCurrentTab();
|
63 |
virtual void closeCurrentTab();
|
51 |
virtual void setCurTabProps( const string & fn, const Rcl::Doc & doc );
|
64 |
virtual void setCurTabProps(const string & fn, const Rcl::Doc & doc,
|
|
|
65 |
int docnum);
|
52 |
virtual void textDoubleClicked(int, int);
|
66 |
virtual void textDoubleClicked(int, int);
|
53 |
|
67 |
|
54 |
signals:
|
68 |
signals:
|
55 |
void previewClosed(QWidget *);
|
69 |
void previewClosed(QWidget *);
|
56 |
void wordSelect(QString);
|
70 |
void wordSelect(QString);
|
|
|
71 |
void showNext(int sid, int docnum);
|
|
|
72 |
void showPrev(int sid, int docnum);
|
57 |
|
73 |
|
58 |
protected:
|
74 |
protected:
|
|
|
75 |
int m_searchId; // Identifier of search in main window. This is so that
|
|
|
76 |
// we make sense when requesting the next document when
|
|
|
77 |
// browsing successive search results in a tab.
|
59 |
int matchIndex;
|
78 |
int matchIndex;
|
60 |
int matchPara;
|
79 |
int matchPara;
|
61 |
bool dynSearchActive;
|
80 |
bool dynSearchActive;
|
62 |
bool canBeep;
|
81 |
bool canBeep;
|
63 |
void *tabData;
|
82 |
list<TabData> tabData;
|
64 |
QWidget *currentW;
|
83 |
QWidget *currentW;
|
65 |
|
84 |
|
66 |
private:
|
85 |
private:
|
67 |
void init();
|
86 |
void init();
|
68 |
virtual void destroy();
|
87 |
virtual void destroy();
|
|
|
88 |
TabData *tabDataForCurrent(); // Return auxiliary data pointer for cur tab
|
69 |
};
|
89 |
};
|
70 |
|
90 |
|
71 |
#endif /* _PREVIEW_W_H_INCLUDED_ */
|
91 |
#endif /* _PREVIEW_W_H_INCLUDED_ */
|