Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.h | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h new file mode 100644 index 0000000..48575e9 --- a/dev/null +++ b/noncore/apps/opie-reader/QTReaderApp.h | |||
@@ -0,0 +1,206 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qt Palmtop Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __QTREADERAPP_H | ||
21 | #define __QTREADERAPP_H | ||
22 | |||
23 | //#define __ISEARCH | ||
24 | |||
25 | #define MAX_ENCODING 6 | ||
26 | |||
27 | #include <qmainwindow.h> | ||
28 | #include "QTReader.h" | ||
29 | #include <qlist.h> | ||
30 | #include <qpe/filemanager.h> | ||
31 | #include <qmap.h> | ||
32 | #include <qlineedit.h> | ||
33 | #include <qstack.h> | ||
34 | #include <qlistbox.h> | ||
35 | #include "Queue.h" | ||
36 | |||
37 | class QWidgetStack; | ||
38 | class QToolButton; | ||
39 | class QPopupMenu; | ||
40 | class QToolBar; | ||
41 | class CBkmkSelector; | ||
42 | class QProgressBar; | ||
43 | class QAction; | ||
44 | |||
45 | #ifdef __ISEARCH | ||
46 | struct searchrecord | ||
47 | { | ||
48 | QString s; | ||
49 | size_t pos; | ||
50 | searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {} | ||
51 | }; | ||
52 | #endif | ||
53 | |||
54 | class infowin; | ||
55 | |||
56 | class QTReaderApp : public QMainWindow | ||
57 | { | ||
58 | Q_OBJECT | ||
59 | |||
60 | unsigned long m_savedpos; | ||
61 | |||
62 | public: | ||
63 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | ||
64 | ~QTReaderApp(); | ||
65 | |||
66 | void openFile( const QString & ); | ||
67 | |||
68 | void setScrollState(bool _b); | ||
69 | |||
70 | protected: | ||
71 | void closeEvent( QCloseEvent *e ); | ||
72 | void readbkmks(); | ||
73 | void do_mono(const QString&); | ||
74 | void do_jump(const QString&); | ||
75 | void do_overlap(const QString&); | ||
76 | void do_settarget(const QString&); | ||
77 | int EncNameToInt(const QString&); | ||
78 | void saveprefs(); | ||
79 | |||
80 | private slots: | ||
81 | void do_setfont(const QString&); | ||
82 | void encodingSelected(QAction*); | ||
83 | void msgHandler(const QCString&, const QByteArray&); | ||
84 | void monospace(bool); | ||
85 | void jump(); | ||
86 | void setoverlap(); | ||
87 | void settarget(); | ||
88 | void setspacing(); | ||
89 | void setfont(); | ||
90 | void clearBkmkList(); | ||
91 | void listBkmkFiles(); | ||
92 | void editMark(); | ||
93 | void autoScroll(bool); | ||
94 | void addbkmk(); | ||
95 | void savebkmks(); | ||
96 | //void importFiles(); | ||
97 | void infoClose(); | ||
98 | // void oldFile(); | ||
99 | void showinfo(); | ||
100 | void setDocument(const QString&); | ||
101 | void TBD(); | ||
102 | void TBDzoom(); | ||
103 | |||
104 | void indentplus(); | ||
105 | void indentminus(); | ||
106 | |||
107 | void fileOpen(); | ||
108 | |||
109 | void editCopy(); | ||
110 | void editFind(); | ||
111 | |||
112 | void pageup(); | ||
113 | void pagedn(); | ||
114 | |||
115 | void findNext(); | ||
116 | void findClose(); | ||
117 | |||
118 | void regClose(); | ||
119 | |||
120 | #ifdef __ISEARCH | ||
121 | // void search( const QString& ); | ||
122 | #else | ||
123 | void search(); | ||
124 | #endif | ||
125 | |||
126 | void openFile( const DocLnk & ); | ||
127 | void showEditTools(); | ||
128 | |||
129 | void stripcr(bool); | ||
130 | void striphtml(bool); | ||
131 | void dehyphen(bool); | ||
132 | void unindent(bool); | ||
133 | void repara(bool); | ||
134 | void setbold(bool); | ||
135 | void dblspce(bool); | ||
136 | void pagemode(bool); | ||
137 | // void gotobkmk(const QString& bm); | ||
138 | void gotobkmk(int); | ||
139 | void cancelbkmk(); | ||
140 | void do_gotomark(); | ||
141 | void do_delmark(); | ||
142 | void do_autogen(); | ||
143 | void do_regaction(); | ||
144 | |||
145 | private: | ||
146 | void listbkmk(); | ||
147 | void do_regedit(); | ||
148 | void colorChanged( const QColor &c ); | ||
149 | void clear(); | ||
150 | void updateCaption(); | ||
151 | void do_autogen(const QString&); | ||
152 | void do_addbkmk(const QString&); | ||
153 | |||
154 | private: | ||
155 | |||
156 | QAction* m_scrollButton; | ||
157 | |||
158 | QAction* m_EncodingAction[MAX_ENCODING]; | ||
159 | |||
160 | CBkmkSelector* bkmkselector; | ||
161 | |||
162 | size_t searchStart; | ||
163 | #ifdef __ISEARCH | ||
164 | QStack<searchrecord>* searchStack; | ||
165 | bool dosearch(size_t start, CBuffer& test, const QString& arg); | ||
166 | #else | ||
167 | bool dosearch(size_t start, CBuffer& test, const QRegExp& arg); | ||
168 | #endif | ||
169 | QWidgetStack *editorStack; | ||
170 | QTReader* reader; | ||
171 | QComboBox* m_fontSelector; | ||
172 | QToolBar *menu, *editBar, *searchBar, *regBar, *m_fontBar; | ||
173 | QLineEdit *searchEdit, *regEdit; | ||
174 | DocLnk *doc; | ||
175 | bool searchVisible; | ||
176 | bool regVisible; | ||
177 | bool m_fontVisible; | ||
178 | bool bFromDocView; | ||
179 | static unsigned long m_uid; | ||
180 | long unsigned get_unique_id() { return m_uid++; } | ||
181 | /* | ||
182 | void resizeEvent( QResizeEvent * r) | ||
183 | { | ||
184 | qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); | ||
185 | qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); | ||
186 | // bgroup->move( width()-bgroup->width(), 0 ); | ||
187 | } | ||
188 | */ | ||
189 | CList<Bkmk>* pBkmklist; | ||
190 | infowin* m_infoWin; | ||
191 | QProgressBar* pbar; | ||
192 | bool m_fBkmksChanged; | ||
193 | int m_nRegAction; | ||
194 | QString m_autogenstr; | ||
195 | }; | ||
196 | |||
197 | const int cAutoGen = 0; | ||
198 | const int cAddBkmk = 1; | ||
199 | const int cDelBkmk = 2; | ||
200 | const int cGotoBkmk = 3; | ||
201 | const int cRmBkmkFile = 4; | ||
202 | const int cJump = 5; | ||
203 | const int cMonoSpace = 6; | ||
204 | const int cOverlap = 7; | ||
205 | const int cSetTarget = 8; | ||
206 | #endif | ||