|
a/src/qtgui/preview_w.h |
|
b/src/qtgui/preview_w.h |
|
... |
|
... |
20 |
#include <stdio.h>
|
20 |
#include <stdio.h>
|
21 |
|
21 |
|
22 |
#include <qvariant.h>
|
22 |
#include <qvariant.h>
|
23 |
#include <qwidget.h>
|
23 |
#include <qwidget.h>
|
24 |
#include <qtextedit.h>
|
24 |
#include <qtextedit.h>
|
|
|
25 |
#include <qimage.h>
|
25 |
|
26 |
|
26 |
#include "rcldb.h"
|
27 |
#include "rcldb.h"
|
27 |
#include "refcntr.h"
|
28 |
#include "refcntr.h"
|
28 |
#include "plaintorich.h"
|
29 |
#include "plaintorich.h"
|
|
|
30 |
#include "rclmain_w.h"
|
29 |
|
31 |
|
30 |
class QTabWidget;
|
32 |
class QTabWidget;
|
31 |
class QLabel;
|
33 |
class QLabel;
|
32 |
class QLineEdit;
|
34 |
class QLineEdit;
|
33 |
class QPushButton;
|
35 |
class QPushButton;
|
34 |
class QCheckBox;
|
36 |
class QCheckBox;
|
35 |
class PreviewTextEdit;
|
|
|
36 |
class Preview;
|
|
|
37 |
|
|
|
38 |
// We keep a list of data associated to each tab
|
|
|
39 |
class TabData {
|
|
|
40 |
public:
|
|
|
41 |
string url; // filename for this tab
|
|
|
42 |
string ipath; // Internal doc path inside file
|
|
|
43 |
int docnum; // Index of doc in db search results.
|
|
|
44 |
// doc out of internfile (previous fields come from the index) with
|
|
|
45 |
// main text erased (for space).
|
|
|
46 |
Rcl::Doc fdoc;
|
|
|
47 |
// Saved rich (or plain actually) text: the textedit seems to
|
|
|
48 |
// sometimes (but not always) return its text stripped of tags, so
|
|
|
49 |
// this is needed (for printing for example)
|
|
|
50 |
QString richtxt;
|
|
|
51 |
Qt::TextFormat format;
|
|
|
52 |
TabData()
|
|
|
53 |
: docnum(-1)
|
|
|
54 |
{}
|
|
|
55 |
};
|
|
|
56 |
|
|
|
57 |
class Preview;
|
37 |
class Preview;
|
58 |
class PlainToRichQtPreview;
|
38 |
class PlainToRichQtPreview;
|
59 |
|
39 |
|
60 |
class PreviewTextEdit : public QTextEdit {
|
40 |
class PreviewTextEdit : public QTextEdit {
|
61 |
Q_OBJECT
|
41 |
Q_OBJECT;
|
62 |
public:
|
42 |
public:
|
63 |
PreviewTextEdit(QWidget* parent, const char* name, Preview *pv);
|
43 |
PreviewTextEdit(QWidget* parent, const char* name, Preview *pv);
|
64 |
virtual ~PreviewTextEdit();
|
44 |
virtual ~PreviewTextEdit();
|
65 |
void moveToAnchor(const QString& name);
|
45 |
void moveToAnchor(const QString& name);
|
|
|
46 |
enum DspType {PTE_DSPTXT, PTE_DSPFLDS, PTE_DSPIMG};
|
|
|
47 |
|
66 |
public slots:
|
48 |
public slots:
|
67 |
virtual void toggleFields();
|
49 |
virtual void displayFields();
|
|
|
50 |
virtual void displayText();
|
|
|
51 |
virtual void displayImage();
|
68 |
virtual void print();
|
52 |
virtual void print();
|
69 |
virtual void createPopupMenu(const QPoint& pos);
|
53 |
virtual void createPopupMenu(const QPoint& pos);
|
70 |
friend class Preview;
|
54 |
friend class Preview;
|
71 |
protected:
|
55 |
protected:
|
72 |
void mouseDoubleClickEvent(QMouseEvent *);
|
56 |
void mouseDoubleClickEvent(QMouseEvent *);
|
73 |
|
57 |
|
74 |
private:
|
58 |
private:
|
75 |
PlainToRichQtPreview *m_plaintorich;
|
59 |
PlainToRichQtPreview *m_plaintorich;
|
76 |
Preview *m_preview;
|
60 |
Preview *m_preview;
|
77 |
TabData m_data;
|
|
|
78 |
bool m_dspflds;
|
61 |
bool m_dspflds;
|
|
|
62 |
string m_url; // filename for this tab
|
|
|
63 |
string m_ipath; // Internal doc path inside file
|
|
|
64 |
int m_docnum; // Index of doc in db search results.
|
|
|
65 |
// doc out of internfile (previous fields come from the index) with
|
|
|
66 |
// main text erased (for space).
|
|
|
67 |
Rcl::Doc m_fdoc;
|
|
|
68 |
// Saved rich (or plain actually) text: the textedit seems to
|
|
|
69 |
// sometimes (but not always) return its text stripped of tags, so
|
|
|
70 |
// this is needed (for printing for example)
|
|
|
71 |
QString m_richtxt;
|
|
|
72 |
Qt::TextFormat m_format;
|
|
|
73 |
// Temporary file name (possibly, if displaying image). The
|
|
|
74 |
// TempFile itself is kept inside main.cpp (because that's where
|
|
|
75 |
// signal cleanup happens), but we use its name to ask for release
|
|
|
76 |
// when the tab is closed.
|
|
|
77 |
string m_tmpfilename;
|
|
|
78 |
QImage m_image;
|
|
|
79 |
DspType m_curdsp;
|
79 |
};
|
80 |
};
|
80 |
|
81 |
|
81 |
|
82 |
|
82 |
class Preview : public QWidget {
|
83 |
class Preview : public QWidget {
|
83 |
|
84 |
|