Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.h | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h index 22c57e4..cb33e4a 100644 --- a/noncore/apps/opie-reader/QTReaderApp.h +++ b/noncore/apps/opie-reader/QTReaderApp.h | |||
@@ -14,117 +14,128 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __QTREADERAPP_H | 20 | #ifndef __QTREADERAPP_H |
21 | #define __QTREADERAPP_H | 21 | #define __QTREADERAPP_H |
22 | 22 | ||
23 | //#define __ISEARCH | 23 | //#define __ISEARCH |
24 | 24 | ||
25 | #define MAX_ENCODING 6 | 25 | #define MAX_ENCODING 6 |
26 | #define MAX_ACTIONS 3 | 26 | #define MAX_ACTIONS 4 |
27 | 27 | ||
28 | #include <qmainwindow.h> | 28 | #include <qmainwindow.h> |
29 | #include "CExpander.h" | 29 | #include "CExpander.h" |
30 | #include <qlist.h> | 30 | #include <qlist.h> |
31 | #include <qpe/filemanager.h> | 31 | #include <qpe/filemanager.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qstack.h> | 34 | #include <qstack.h> |
35 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
36 | //#include "Queue.h" | 36 | //#include "Queue.h" |
37 | 37 | ||
38 | class QWidgetStack; | 38 | class QWidgetStack; |
39 | class QToolButton; | 39 | class QToolButton; |
40 | class QPopupMenu; | 40 | class QPopupMenu; |
41 | class QToolBar; | 41 | class QToolBar; |
42 | class QPEToolBar; | 42 | //class QPEToolBar; |
43 | class CBkmkSelector; | 43 | class CBkmkSelector; |
44 | class QProgressBar; | 44 | class QProgressBar; |
45 | class QAction; | 45 | class QAction; |
46 | class CAnnoEdit; | 46 | class CAnnoEdit; |
47 | class QFloatBar; | 47 | class QFloatBar; |
48 | class CDrawBuffer; | 48 | class CDrawBuffer; |
49 | class QTReader; | 49 | class QTReader; |
50 | class QPixmap; | ||
50 | 51 | ||
51 | enum ActionTypes | 52 | enum ActionTypes |
52 | { | 53 | { |
53 | cesOpenFile = 0, | 54 | cesOpenFile = 0, |
54 | cesAutoScroll, | 55 | cesAutoScroll, |
55 | cesActionMark | 56 | cesActionMark, |
57 | cesFullScreen | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | #ifdef __ISEARCH | 60 | #ifdef __ISEARCH |
59 | struct searchrecord | 61 | struct searchrecord |
60 | { | 62 | { |
61 | QString s; | 63 | QString s; |
62 | size_t pos; | 64 | size_t pos; |
63 | searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {} | 65 | searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {} |
64 | }; | 66 | }; |
65 | #endif | 67 | #endif |
66 | 68 | ||
67 | class infowin; | 69 | class infowin; |
70 | class GraphicWin; | ||
68 | 71 | ||
69 | class QTReaderApp : public QMainWindow | 72 | class QTReaderApp : public QMainWindow |
70 | { | 73 | { |
71 | Q_OBJECT | 74 | Q_OBJECT |
72 | 75 | ||
73 | unsigned long m_savedpos; | 76 | unsigned long m_savedpos; |
74 | bool m_annoIsEditing; | 77 | bool m_annoIsEditing; |
75 | 78 | ||
76 | public: | 79 | public: |
77 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 80 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
78 | ~QTReaderApp(); | 81 | ~QTReaderApp(); |
79 | 82 | void suspend(); | |
80 | void openFile( const QString & ); | 83 | void openFile( const QString & ); |
81 | 84 | ||
82 | void setScrollState(bool _b); | 85 | void setScrollState(bool _b); |
83 | 86 | ||
84 | protected: | 87 | protected: |
85 | void setfontHelper(const QString& lcn, int size = 0); | 88 | void setfontHelper(const QString& lcn, int size = 0); |
86 | QAction* m_bkmkAvail; | 89 | QAction* m_bkmkAvail, *m_actFullscreen; |
87 | CAnnoEdit* m_annoWin; | 90 | CAnnoEdit* m_annoWin; |
88 | Bkmk* m_anno; | 91 | Bkmk* m_anno; |
92 | // void resizeEvent(QResizeEvent* e); | ||
93 | void keyPressEvent(QKeyEvent* e); | ||
89 | void closeEvent( QCloseEvent *e ); | 94 | void closeEvent( QCloseEvent *e ); |
90 | void readbkmks(); | 95 | void readbkmks(); |
91 | void do_mono(const QString&); | 96 | void do_mono(const QString&); |
92 | void do_jump(const QString&); | 97 | void do_jump(const QString&); |
93 | void do_overlap(const QString&); | 98 | void do_overlap(const QString&); |
94 | void do_settarget(const QString&); | 99 | void do_settarget(const QString&); |
95 | int EncNameToInt(const QString&); | 100 | int EncNameToInt(const QString&); |
96 | ActionTypes ActNameToInt(const QString&); | 101 | ActionTypes ActNameToInt(const QString&); |
97 | bool m_doAnnotation; | 102 | bool m_doAnnotation; |
98 | bool m_doDictionary; | 103 | bool m_doDictionary; |
99 | bool m_doClipboard; | 104 | bool m_doClipboard; |
105 | bool m_fullscreen; | ||
100 | 106 | ||
101 | public: | 107 | public: |
102 | void saveprefs(); | 108 | void saveprefs(); |
103 | private slots: | 109 | private slots: |
110 | void zoomin(); | ||
111 | void zoomout(); | ||
112 | void setfullscreen(bool sfs); | ||
113 | void setcontinuous(bool sfs); | ||
104 | void setTwoTouch(bool _b); | 114 | void setTwoTouch(bool _b); |
105 | void restoreFocus(); | 115 | void restoreFocus(); |
106 | void OnAnnotation(bool _b) | 116 | void OnAnnotation(bool _b) |
107 | { | 117 | { |
108 | m_doAnnotation = _b; | 118 | m_doAnnotation = _b; |
109 | } | 119 | } |
110 | void OnDictionary(bool _b) | 120 | void OnDictionary(bool _b) |
111 | { | 121 | { |
112 | m_doDictionary = _b; | 122 | m_doDictionary = _b; |
113 | } | 123 | } |
114 | void OnClipboard(bool _b) | 124 | void OnClipboard(bool _b) |
115 | { | 125 | { |
116 | m_doClipboard = _b; | 126 | m_doClipboard = _b; |
117 | } | 127 | } |
118 | void OnWordSelected(const QString&, size_t, const QString&); | 128 | void OnWordSelected(const QString&, size_t, const QString&); |
129 | void showgraphic(QPixmap&); | ||
119 | void addAnno(const QString&, const QString&, size_t); | 130 | void addAnno(const QString&, const QString&, size_t); |
120 | void addAnno(const QString&, const QString&); | 131 | void addAnno(const QString&, const QString&); |
121 | void addanno(); | 132 | void addanno(); |
122 | void showAnnotation(); | 133 | void showAnnotation(); |
123 | void do_setfont(const QString&); | 134 | void do_setfont(const QString&); |
124 | void encodingSelected(QAction*); | 135 | void encodingSelected(QAction*); |
125 | void buttonActionSelected(QAction*); | 136 | void buttonActionSelected(QAction*); |
126 | void msgHandler(const QCString&, const QByteArray&); | 137 | void msgHandler(const QCString&, const QByteArray&); |
127 | void monospace(bool); | 138 | void monospace(bool); |
128 | void jump(); | 139 | void jump(); |
129 | void setoverlap(); | 140 | void setoverlap(); |
130 | void settarget(); | 141 | void settarget(); |
@@ -132,77 +143,90 @@ private slots: | |||
132 | void setfont(); | 143 | void setfont(); |
133 | void clearBkmkList(); | 144 | void clearBkmkList(); |
134 | void listBkmkFiles(); | 145 | void listBkmkFiles(); |
135 | void editMark(); | 146 | void editMark(); |
136 | void autoScroll(bool); | 147 | void autoScroll(bool); |
137 | void addbkmk(); | 148 | void addbkmk(); |
138 | void savebkmks(); | 149 | void savebkmks(); |
139 | //void importFiles(); | 150 | //void importFiles(); |
140 | void infoClose(); | 151 | void infoClose(); |
141 | // void oldFile(); | 152 | // void oldFile(); |
142 | void showinfo(); | 153 | void showinfo(); |
143 | void setDocument(const QString&); | 154 | void setDocument(const QString&); |
144 | void TBD(); | ||
145 | void TBDzoom(); | ||
146 | 155 | ||
147 | void indentplus(); | 156 | void indentplus(); |
148 | void indentminus(); | 157 | void indentminus(); |
149 | 158 | ||
150 | void fileOpen(); | 159 | void fileOpen(); |
160 | void fileClose(); | ||
151 | 161 | ||
152 | void editCopy(); | 162 | void editCopy(); |
153 | void editFind(); | 163 | void editFind(); |
154 | 164 | ||
155 | void pageup(); | 165 | void pageup(); |
156 | void pagedn(); | 166 | void pagedn(); |
157 | 167 | ||
158 | void findNext(); | 168 | void findNext(); |
159 | void findClose(); | 169 | void findClose(); |
160 | 170 | ||
161 | void regClose(); | 171 | void regClose(); |
162 | 172 | ||
163 | #ifdef __ISEARCH | 173 | #ifdef __ISEARCH |
164 | // void search( const QString& ); | 174 | // void search( const QString& ); |
165 | #else | 175 | #else |
166 | void search(); | 176 | void search(); |
167 | #endif | 177 | #endif |
168 | 178 | ||
169 | void openFile( const DocLnk & ); | ||
170 | void showEditTools(); | 179 | void showEditTools(); |
171 | 180 | ||
172 | void stripcr(bool); | 181 | void stripcr(bool); |
182 | void onespace(bool); | ||
183 | #ifdef REPALM | ||
184 | // void repalm(bool); | ||
185 | #endif | ||
173 | void peanut(bool _b); | 186 | void peanut(bool _b); |
174 | void remap(bool); | 187 | void remap(bool); |
175 | void embolden(bool); | 188 | void embolden(bool); |
176 | void autofmt(bool); | 189 | void autofmt(bool); |
177 | void textfmt(bool); | 190 | void textfmt(bool); |
178 | void striphtml(bool); | 191 | void striphtml(bool); |
179 | void dehyphen(bool); | 192 | void dehyphen(bool); |
180 | void unindent(bool); | 193 | void unindent(bool); |
181 | void repara(bool); | 194 | void repara(bool); |
182 | void dblspce(bool); | 195 | void dblspce(bool); |
183 | void pagemode(bool); | 196 | void pagemode(bool); |
197 | void navkeys(bool); | ||
184 | // void gotobkmk(const QString& bm); | 198 | // void gotobkmk(const QString& bm); |
185 | void gotobkmk(int); | 199 | void gotobkmk(int); |
186 | void cancelbkmk(); | 200 | void cancelbkmk(); |
187 | void do_gotomark(); | 201 | void do_gotomark(); |
188 | void do_delmark(); | 202 | void do_delmark(); |
189 | void do_autogen(); | 203 | void do_autogen(); |
190 | void do_regaction(); | 204 | void do_regaction(); |
191 | void OnRedraw(); | 205 | void OnRedraw(); |
192 | void OnActionPressed(); | 206 | void OnActionPressed(); |
193 | 207 | ||
194 | private: | 208 | private: |
209 | /* | ||
210 | void setstate(unsigned char* _sd, unsigned short _sdlen); | ||
211 | void getstate(unsigned char*& data, unsigned short& len); | ||
212 | */ | ||
213 | void fileOpen2(); | ||
214 | void readfilelist(); | ||
215 | void savefilelist(); | ||
216 | void updatefileinfo(); | ||
217 | bool openfrombkmk(Bkmk*); | ||
195 | QString m_targetapp, m_targetmsg; | 218 | QString m_targetapp, m_targetmsg; |
196 | void listbkmk(); | 219 | void listbkmk(CList<Bkmk>*, const QString& _lab = QString::null); |
220 | QString usefilebrowser(); | ||
197 | void do_regedit(); | 221 | void do_regedit(); |
198 | void colorChanged( const QColor &c ); | 222 | void colorChanged( const QColor &c ); |
199 | void clear(); | 223 | void clear(); |
200 | void updateCaption(); | 224 | void updateCaption(); |
201 | void do_autogen(const QString&); | 225 | void do_autogen(const QString&); |
202 | void do_addbkmk(const QString&); | 226 | void do_addbkmk(const QString&); |
203 | bool findNextBookmark(size_t start); | 227 | bool findNextBookmark(size_t start); |
204 | 228 | ||
205 | private: | 229 | private: |
206 | 230 | ||
207 | QAction* m_scrollButton; | 231 | QAction* m_scrollButton; |
208 | 232 | ||
@@ -214,50 +238,54 @@ private slots: | |||
214 | 238 | ||
215 | ActionTypes m_spaceTarget; | 239 | ActionTypes m_spaceTarget; |
216 | size_t searchStart; | 240 | size_t searchStart; |
217 | #ifdef __ISEARCH | 241 | #ifdef __ISEARCH |
218 | QStack<searchrecord>* searchStack; | 242 | QStack<searchrecord>* searchStack; |
219 | bool dosearch(size_t start, CDrawBuffer& test, const QString& arg); | 243 | bool dosearch(size_t start, CDrawBuffer& test, const QString& arg); |
220 | #else | 244 | #else |
221 | bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg); | 245 | bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg); |
222 | #endif | 246 | #endif |
223 | QWidgetStack *editorStack; | 247 | QWidgetStack *editorStack; |
224 | QTReader* reader; | 248 | QTReader* reader; |
225 | QComboBox* m_fontSelector; | 249 | QComboBox* m_fontSelector; |
226 | QPEToolBar /* *menu,*/ *editBar; | 250 | // QPEToolBar /* *menu,*/ *editBar; |
251 | QToolBar /* *menu,*/ *editBar; | ||
227 | QFloatBar *searchBar, *regBar/*, *m_fontBar*/; | 252 | QFloatBar *searchBar, *regBar/*, *m_fontBar*/; |
228 | QToolBar /* *searchBar, *regBar,*/ *m_fontBar; | 253 | QToolBar /* *searchBar, *regBar,*/ *m_fontBar; |
229 | QLineEdit *searchEdit, *regEdit; | 254 | QLineEdit *searchEdit, *regEdit; |
230 | DocLnk *doc; | ||
231 | bool searchVisible; | 255 | bool searchVisible; |
232 | bool regVisible; | 256 | bool regVisible; |
233 | bool m_fontVisible, m_twoTouch; | 257 | bool m_fontVisible, m_twoTouch; |
234 | bool bFromDocView; | 258 | bool bFromDocView; |
235 | static unsigned long m_uid; | 259 | static unsigned long m_uid; |
236 | long unsigned get_unique_id() { return m_uid++; } | 260 | long unsigned get_unique_id() { return m_uid++; } |
237 | /* | 261 | /* |
238 | void resizeEvent( QResizeEvent * r) | 262 | void resizeEvent( QResizeEvent * r) |
239 | { | 263 | { |
240 | qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); | 264 | qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); |
241 | qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); | 265 | qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); |
242 | // bgroup->move( width()-bgroup->width(), 0 ); | 266 | // bgroup->move( width()-bgroup->width(), 0 ); |
243 | } | 267 | } |
244 | */ | 268 | */ |
245 | CList<Bkmk>* pBkmklist; | 269 | CList<Bkmk>* pBkmklist; |
270 | CList<Bkmk>* pOpenlist; | ||
246 | infowin* m_infoWin; | 271 | infowin* m_infoWin; |
272 | GraphicWin* m_graphicwin; | ||
247 | QProgressBar* pbar; | 273 | QProgressBar* pbar; |
248 | bool m_fBkmksChanged; | 274 | bool m_fBkmksChanged; |
249 | int m_nRegAction; | 275 | int m_nRegAction; |
250 | QString m_autogenstr; | 276 | QString m_autogenstr; |
251 | bool m_dontSave; | 277 | bool m_dontSave; |
252 | }; | 278 | }; |
253 | 279 | ||
254 | const int cAutoGen = 0; | 280 | const int cAutoGen = 0; |
255 | const int cAddBkmk = 1; | 281 | const int cAddBkmk = 1; |
256 | const int cDelBkmk = 2; | 282 | const int cDelBkmk = 2; |
257 | const int cGotoBkmk = 3; | 283 | const int cGotoBkmk = 3; |
258 | const int cRmBkmkFile = 4; | 284 | const int cRmBkmkFile = 4; |
259 | const int cJump = 5; | 285 | const int cJump = 5; |
260 | const int cMonoSpace = 6; | 286 | const int cMonoSpace = 6; |
261 | const int cOverlap = 7; | 287 | const int cOverlap = 7; |
262 | const int cSetTarget = 8; | 288 | const int cSetTarget = 8; |
289 | const int cOpenFile = 9; | ||
290 | |||
263 | #endif | 291 | #endif |