summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReaderApp.h
authorgroucho <groucho>2003-05-07 09:01:39 (UTC)
committer groucho <groucho>2003-05-07 09:01:39 (UTC)
commit118d03d815a7615b9c53363218a7ac45b3f4c514 (patch) (unidiff)
tree356953e2413cddcec0f35bd47bb6439767da7051 /noncore/apps/opie-reader/QTReaderApp.h
parent00894537decf01c5a5cdc565b2740b5e67a2e90f (diff)
downloadopie-118d03d815a7615b9c53363218a7ac45b3f4c514.zip
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.gz
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.bz2
Incorporated TimWs current source tree and make it compile
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.h259
1 files changed, 205 insertions, 54 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h
index cb33e4a..2765d47 100644
--- a/noncore/apps/opie-reader/QTReaderApp.h
+++ b/noncore/apps/opie-reader/QTReaderApp.h
@@ -20,15 +20,19 @@
20#ifndef __QTREADERAPP_H 20#ifndef __QTREADERAPP_H
21#define __QTREADERAPP_H 21#define __QTREADERAPP_H
22 22
23//#define _SCROLLPIPE
23//#define __ISEARCH 24//#define __ISEARCH
24 25
25#define MAX_ENCODING 6 26//#define MAX_ENCODING 6
26#define MAX_ACTIONS 4 27#define MAX_ACTIONS 5
27 28
29#include "useqpe.h"
30#include <sys/timeb.h>
28#include <qmainwindow.h> 31#include <qmainwindow.h>
29#include "CExpander.h" 32#include "CExpander.h"
33#include "CEncoding.h"
30#include <qlist.h> 34#include <qlist.h>
31#include <qpe/filemanager.h> 35//#include <qpe/filemanager.h>
32#include <qmap.h> 36#include <qmap.h>
33#include <qlineedit.h> 37#include <qlineedit.h>
34#include <qstack.h> 38#include <qstack.h>
@@ -39,7 +43,10 @@ class QWidgetStack;
39class QToolButton; 43class QToolButton;
40class QPopupMenu; 44class QPopupMenu;
41class QToolBar; 45class QToolBar;
42//class QPEToolBar; 46#ifdef USEQPE
47class QPEToolBar;
48class QPEMenuBar;
49#endif
43class CBkmkSelector; 50class CBkmkSelector;
44class QProgressBar; 51class QProgressBar;
45class QAction; 52class QAction;
@@ -47,14 +54,74 @@ class CAnnoEdit;
47class QFloatBar; 54class QFloatBar;
48class CDrawBuffer; 55class CDrawBuffer;
49class QTReader; 56class QTReader;
50class QPixmap; 57class QImage;
58class Config;
51 59
52enum ActionTypes 60enum ActionTypes
53{ 61{
54 cesOpenFile = 0, 62 cesNone = 0,
63 cesOpenFile,
55 cesAutoScroll, 64 cesAutoScroll,
56 cesActionMark, 65 cesActionMark,
57 cesFullScreen 66 cesActionAnno,
67 cesFullScreen,
68 cesZoomIn,
69 cesZoomOut,
70 cesBack,
71 cesForward,
72 cesHome,
73 cesPageUp,
74 cesPageDown,
75 cesLineUp,
76 cesLineDown,
77 cesStartDoc,
78 cesEndDoc
79};
80/*
81*m_preferences_action, *m_close_action *m_info_action, *m_touch_action,
82*m_find_action, *m_jump_action, *m_setfont_action *m_goto_action,
83*m_delete_action; *m_autogen_action, *m_clear_action, *m_save_action;
84*m_tidy_action, *m_startBlock_action, *m_endBlock_action;
85*m_setenc_action, *m_setmono_action;
86*/
87enum ToolbarPolicy
88{
89 cesSingle = 0,
90 cesMenuTool,
91 cesMultiple
92};
93
94enum regedit_type
95{
96 cAutoGen,
97 cAddBkmk,
98 cJump,
99 cMonoSpace,
100 cSetTarget,
101#ifdef _SCROLLPIPE
102 cSetPipeTarget,
103#endif
104 cSetConfigName,
105 cMargin,
106 cExtraSpace,
107 cExtraLead
108};
109
110enum bkmk_action
111{
112 cOpenFile,
113 cGotoBkmk,
114 cDelBkmk,
115 cRmBkmkFile,
116 cLdConfig,
117 cRmConfig,
118 cExportLinks
119};
120
121enum fontselector_action
122{
123 cChooseFont,
124 cChooseEncoding
58}; 125};
59 126
60#ifdef __ISEARCH 127#ifdef __ISEARCH
@@ -74,11 +141,24 @@ class QTReaderApp : public QMainWindow
74 Q_OBJECT 141 Q_OBJECT
75 142
76 unsigned long m_savedpos; 143 unsigned long m_savedpos;
144 int m_debounce;
145 timeb m_lastkeytime;
77 bool m_annoIsEditing; 146 bool m_annoIsEditing;
147 bool m_propogatefontchange, m_bFloatingDialog;
148 bool m_url_clipboard, m_url_localfile, m_url_globalfile;
149 fontselector_action m_fontAction;
150 void doAction(ActionTypes a, QKeyEvent* e);
78 151
79 public: 152 public:
80 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 153 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
81 ~QTReaderApp(); 154 ~QTReaderApp();
155
156 void handlekey(QKeyEvent* e);
157 void hideEvent(QHideEvent*)
158 {
159 suspend();
160 }
161
82 void suspend(); 162 void suspend();
83 void openFile( const QString & ); 163 void openFile( const QString & );
84 164
@@ -90,27 +170,40 @@ class QTReaderApp : public QMainWindow
90 CAnnoEdit* m_annoWin; 170 CAnnoEdit* m_annoWin;
91 Bkmk* m_anno; 171 Bkmk* m_anno;
92// void resizeEvent(QResizeEvent* e); 172// void resizeEvent(QResizeEvent* e);
93 void keyPressEvent(QKeyEvent* e);
94 void closeEvent( QCloseEvent *e ); 173 void closeEvent( QCloseEvent *e );
95 void readbkmks(); 174 void readbkmks();
96 void do_mono(const QString&); 175 void do_mono(const QString&);
97 void do_jump(const QString&); 176 void do_jump(const QString&);
98 void do_overlap(const QString&);
99 void do_settarget(const QString&); 177 void do_settarget(const QString&);
100 int EncNameToInt(const QString&); 178#ifdef _SCROLLPIPE
179 //void do_setpipetarget(const QString&);
180#endif
181 void do_saveconfig(const QString&, bool);
182 bool readconfig(const QString&, bool);
183 bool PopulateConfig(const char*);
101 ActionTypes ActNameToInt(const QString&); 184 ActionTypes ActNameToInt(const QString&);
102 bool m_doAnnotation; 185 bool m_doAnnotation;
103 bool m_doDictionary; 186 bool m_doDictionary;
104 bool m_doClipboard; 187 bool m_doClipboard;
105 bool m_fullscreen; 188 bool m_fullscreen;
106 189 bool m_loadedconfig;
107 public: 190 public:
108 void saveprefs(); 191 void saveprefs();
192public slots:
193 void setDocument(const QString&);
109private slots: 194private slots:
195#ifdef _SCRIPT
196// void RunScript();
197#endif
198 void SaveConfig();
199 void LoadConfig();
200 void TidyConfig();
201 void ExportLinks();
110 void zoomin(); 202 void zoomin();
111 void zoomout(); 203 void zoomout();
204 void chooseencoding();
112 void setfullscreen(bool sfs); 205 void setfullscreen(bool sfs);
113 void setcontinuous(bool sfs); 206// void setcontinuous(bool sfs);
114 void setTwoTouch(bool _b); 207 void setTwoTouch(bool _b);
115 void restoreFocus(); 208 void restoreFocus();
116 void OnAnnotation(bool _b) 209 void OnAnnotation(bool _b)
@@ -126,20 +219,24 @@ private slots:
126 m_doClipboard = _b; 219 m_doClipboard = _b;
127 } 220 }
128 void OnWordSelected(const QString&, size_t, const QString&); 221 void OnWordSelected(const QString&, size_t, const QString&);
129 void showgraphic(QPixmap&); 222 void OnURLSelected(const QString& href);
223 void showgraphic(QImage&);
130 void addAnno(const QString&, const QString&, size_t); 224 void addAnno(const QString&, const QString&, size_t);
131 void addAnno(const QString&, const QString&); 225 void addAnno(const QString&, const QString&);
132 void addanno(); 226 void addanno();
133 void showAnnotation(); 227 void showAnnotation();
228 void do_setencoding(int i);
134 void do_setfont(const QString&); 229 void do_setfont(const QString&);
135 void encodingSelected(QAction*);
136 void buttonActionSelected(QAction*); 230 void buttonActionSelected(QAction*);
137 void msgHandler(const QCString&, const QByteArray&); 231 //void msgHandler(const QCString&, const QByteArray&);
138 void monospace(bool); 232 void monospace(bool);
139 void jump(); 233 void jump();
140 void setoverlap();
141 void settarget(); 234 void settarget();
142 void setspacing(); 235#ifdef _SCROLLPIPE
236 //void setpipetarget();
237 //void setpause(bool);
238#endif
239 //void setspacing();
143 void setfont(); 240 void setfont();
144 void clearBkmkList(); 241 void clearBkmkList();
145 void listBkmkFiles(); 242 void listBkmkFiles();
@@ -148,13 +245,14 @@ private slots:
148 void addbkmk(); 245 void addbkmk();
149 void savebkmks(); 246 void savebkmks();
150 //void importFiles(); 247 //void importFiles();
248 void showprefs();
249 void showtoolbarprefs();
151 void infoClose(); 250 void infoClose();
152 // void oldFile(); 251 // void oldFile();
153 void showinfo(); 252 void showinfo();
154 void setDocument(const QString&);
155 253
156 void indentplus(); 254// void indentplus();
157 void indentminus(); 255// void indentminus();
158 256
159 void fileOpen(); 257 void fileOpen();
160 void fileClose(); 258 void fileClose();
@@ -162,6 +260,9 @@ private slots:
162 void editCopy(); 260 void editCopy();
163 void editFind(); 261 void editFind();
164 262
263 void gotoStart();
264 void gotoEnd();
265
165 void pageup(); 266 void pageup();
166 void pagedn(); 267 void pagedn();
167 268
@@ -178,23 +279,25 @@ private slots:
178 279
179 void showEditTools(); 280 void showEditTools();
180 281
181 void stripcr(bool); 282// void stripcr(bool);
182 void onespace(bool); 283// void setfulljust(bool);
284// void onespace(bool);
183#ifdef REPALM 285#ifdef REPALM
184// void repalm(bool); 286// void repalm(bool);
185#endif 287#endif
186 void peanut(bool _b); 288// void peanut(bool _b);
187 void remap(bool); 289// void remap(bool);
188 void embolden(bool); 290// void embolden(bool);
189 void autofmt(bool); 291// void autofmt(bool);
190 void textfmt(bool); 292// void textfmt(bool);
191 void striphtml(bool); 293// void striphtml(bool);
192 void dehyphen(bool); 294// void dehyphen(bool);
193 void unindent(bool); 295// void depluck(bool);
194 void repara(bool); 296// void dejpluck(bool);
195 void dblspce(bool); 297// void unindent(bool);
298// void repara(bool);
299// void dblspce(bool);
196 void pagemode(bool); 300 void pagemode(bool);
197 void navkeys(bool);
198 // void gotobkmk(const QString& bm); 301 // void gotobkmk(const QString& bm);
199 void gotobkmk(int); 302 void gotobkmk(int);
200 void cancelbkmk(); 303 void cancelbkmk();
@@ -203,9 +306,38 @@ private slots:
203 void do_autogen(); 306 void do_autogen();
204 void do_regaction(); 307 void do_regaction();
205 void OnRedraw(); 308 void OnRedraw();
206 void OnActionPressed();
207 309
208 private: 310 private:
311 void writeUrl(const QString& file, const QString& href);
312 QAction *m_preferences_action, *m_open_action, *m_close_action;
313 QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action;
314 QAction *m_end_action, *m_jump_action, *m_pageline_action;
315 QAction *m_pageup_action, *m_pagedn_action, *m_back_action;
316 QAction *m_home_action, *m_forward_action, *m_zoomin_action;
317 QAction *m_zoomout_action, *m_setfont_action, *m_mark_action;
318 QAction *m_annotate_action, *m_goto_action, *m_delete_action;
319 QAction *m_autogen_action, *m_clear_action, *m_save_action;
320 QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action;
321 QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action;
322 QAction *m_loadconfig_action, *m_toolbarprefs_action, *m_tidyconfig_action;
323 QAction *m_exportlinks_action;
324 void addtoolbars(Config* config);
325 ToolbarPolicy m_tbpol, m_tbpolsave;
326 ToolBarDock m_tbposition;
327 bool m_tbmove, m_tbmovesave;
328 QToolBar* filebar();
329 QToolBar* viewbar();
330 QToolBar* navbar();
331 QToolBar* markbar();
332 void hidetoolbars();
333 void addfilebar(Config* _config, const QString& key, QAction* a);
334 void addviewbar(Config* _config, const QString& key, QAction* a);
335 void addnavbar(Config* _config, const QString& key, QAction* a);
336 void addmarkbar(Config* _config, const QString& key, QAction* a);
337 bool checkbar(Config* _config, const QString& key);
338#ifdef _SCRIPT
339 void SaveScript(const char* sname);
340#endif
209/* 341/*
210 void setstate(unsigned char* _sd, unsigned short _sdlen); 342 void setstate(unsigned char* _sd, unsigned short _sdlen);
211 void getstate(unsigned char*& data, unsigned short& len); 343 void getstate(unsigned char*& data, unsigned short& len);
@@ -216,7 +348,7 @@ private slots:
216 void updatefileinfo(); 348 void updatefileinfo();
217 bool openfrombkmk(Bkmk*); 349 bool openfrombkmk(Bkmk*);
218 QString m_targetapp, m_targetmsg; 350 QString m_targetapp, m_targetmsg;
219 void listbkmk(CList<Bkmk>*, const QString& _lab = QString::null); 351 bool listbkmk(CList<Bkmk>*, const QString& _lab = QString::null);
220 QString usefilebrowser(); 352 QString usefilebrowser();
221 void do_regedit(); 353 void do_regedit();
222 void colorChanged( const QColor &c ); 354 void colorChanged( const QColor &c );
@@ -230,13 +362,14 @@ private slots:
230 362
231 QAction* m_scrollButton; 363 QAction* m_scrollButton;
232 364
233 QAction* m_EncodingAction[MAX_ENCODING];
234
235 QAction* m_buttonAction[MAX_ACTIONS]; 365 QAction* m_buttonAction[MAX_ACTIONS];
236 366
237 CBkmkSelector* bkmkselector; 367 CBkmkSelector* bkmkselector;
238 368
239 ActionTypes m_spaceTarget; 369 ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget,
370 m_upTarget, m_downTarget;
371 bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll;
372 bool m_bcloseDisabled, m_disableesckey;
240 size_t searchStart; 373 size_t searchStart;
241#ifdef __ISEARCH 374#ifdef __ISEARCH
242 QStack<searchrecord>* searchStack; 375 QStack<searchrecord>* searchStack;
@@ -247,8 +380,13 @@ private slots:
247 QWidgetStack *editorStack; 380 QWidgetStack *editorStack;
248 QTReader* reader; 381 QTReader* reader;
249 QComboBox* m_fontSelector; 382 QComboBox* m_fontSelector;
250// QPEToolBar /* *menu,*/ *editBar; 383// QPEToolBar /* *menu,*/ *fileBar;
251 QToolBar /* *menu,*/ *editBar; 384 QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar;
385#ifdef USEQPE
386 QPEMenuBar *mb;
387#else
388 QMenuBar *mb;
389#endif
252 QFloatBar *searchBar, *regBar/*, *m_fontBar*/; 390 QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
253 QToolBar /* *searchBar, *regBar,*/ *m_fontBar; 391 QToolBar /* *searchBar, *regBar,*/ *m_fontBar;
254 QLineEdit *searchEdit, *regEdit; 392 QLineEdit *searchEdit, *regEdit;
@@ -261,8 +399,8 @@ private slots:
261 /* 399 /*
262 void resizeEvent( QResizeEvent * r) 400 void resizeEvent( QResizeEvent * r)
263 { 401 {
264 qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); 402// qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height());
265 qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); 403// qDebug("resize:(%u,%u)", r->size().width(), r->size().height());
266 // bgroup->move( width()-bgroup->width(), 0 ); 404 // bgroup->move( width()-bgroup->width(), 0 );
267 } 405 }
268 */ 406 */
@@ -272,20 +410,33 @@ private slots:
272 GraphicWin* m_graphicwin; 410 GraphicWin* m_graphicwin;
273 QProgressBar* pbar; 411 QProgressBar* pbar;
274 bool m_fBkmksChanged; 412 bool m_fBkmksChanged;
275 int m_nRegAction; 413// int m_nRegAction;
414 regedit_type m_nRegAction;
415 bkmk_action m_nBkmkAction;
276 QString m_autogenstr; 416 QString m_autogenstr;
277 bool m_dontSave; 417 bool m_dontSave;
278}; 418};
279 419
280const int cAutoGen = 0; 420//const int cAutoGen = 0;
281const int cAddBkmk = 1; 421//const int cAddBkmk = 1;
282const int cDelBkmk = 2; 422//const int cDelBkmk = 2;
283const int cGotoBkmk = 3; 423//const int cGotoBkmk = 3;
284const int cRmBkmkFile = 4; 424//const int cRmBkmkFile = 4;
285const int cJump = 5; 425//const int cJump = 5;
286const int cMonoSpace = 6; 426//const int cMonoSpace = 6;
287const int cOverlap = 7; 427//const int cOverlap = 7;
288const int cSetTarget = 8; 428//const int cSetTarget = 8;
289const int cOpenFile = 9; 429//const int cOpenFile = 9;
430//const int cSetPipeTarget = 10;
431//const int cSetConfigName = 11;
432//const int cMargin = 12;
433//const int cExtraSpace = 14;
434//const int cExtraLead = 15;
435//const int cGfxSize = 16;
436//const int cChooseFont = 2;
437//const int cChooseEncoding = 1;
290 438
291#endif 439#endif
440
441
442