summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ToolbarPrefs.h
blob: 9df894028029315e11c31a9c570596b8da68af48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/****************************************************************************
 ** Form interface generated from reading ui file 'Prefs.ui'
 **
 ** Created: Tue Feb 11 23:53:32 2003
 **      by:  The User Interface Compiler (uic)
 **
 ** WARNING! All changes made in this file will be lost!
 ****************************************************************************/
#ifndef CTOOLBARPREFS_H
#define CTOOLBARPREFS_H

#include <qvariant.h>
#include <qwidget.h>
#include <qtabdialog.h>
#include <qtabwidget.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlineedit.h>
#ifdef USEQPE
#include <qpe/menubutton.h>
#include <qpe/config.h>
#else
#include "preferences.h"
#endif
#define USECOMBO

class QVBoxLayout; 
class QHBoxLayout; 
class QGridLayout; 
//class QCheckBox;
class QLabel;
//class QSpinBox;
/*
class CBarPrefs1 : public QWidget
{ 
    Q_OBJECT

	Config& config;
    QCheckBox *open, *close, *info, *twotouch,*find,*scroll,*navigation,*page,*startend,*jump,*pageline;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CBarPrefs1( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CBarPrefs1();
    void saveall();
    bool isChanged() { return m_isChanged; }
};
*/
class CFileBarPrefs : public QWidget
{ 
    Q_OBJECT

	Config& config;
    QCheckBox *open, *close, *info, *twotouch, *find, *scroll;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CFileBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CFileBarPrefs();
    void saveall();
    bool isChanged() { return m_isChanged; }
};

class CNavBarPrefs : public QWidget
{ 
    Q_OBJECT

	Config& config;
    QCheckBox *scroll, *navback, *navhome, *navforward;
    QCheckBox *pageup, *pagedown, *gotostart, *gotoend, *jump, *pageline;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CNavBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CNavBarPrefs();
    void saveall();
    bool isChanged() { return m_isChanged; }
};
/*
class CBarPrefs2 : public QWidget
{ 
    Q_OBJECT
	Config& config;
    QCheckBox *fullscreen, *zoom, *setfont, *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *block, *indannotate, *encoding, *ideogram;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CBarPrefs2( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CBarPrefs2();
    void saveall();
    bool isChanged() { return m_isChanged; }

};
*/
class CViewBarPrefs : public QWidget
{ 
    Q_OBJECT
	Config& config;
    QCheckBox *fullscreen, *rotate, *zoomin, *zoomout, *setfont, *encoding, *ideogram, *invert;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CViewBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CViewBarPrefs();
    void saveall();
    bool isChanged() { return m_isChanged; }

};

class CMarkBarPrefs : public QWidget
{ 
    Q_OBJECT
	Config& config;
    QCheckBox *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *startblock, *copyblock;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CMarkBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CMarkBarPrefs();
    void saveall();
    bool isChanged() { return m_isChanged; }

};

class CIndBarPrefs : public QWidget
{ 
    Q_OBJECT
	Config& config;
    QCheckBox *indannotate;

    bool m_isChanged;

    private slots:
	void isChanged(int _v) { m_isChanged = true; }

 public:
    CIndBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CIndBarPrefs();
    void saveall();
    bool isChanged() { return m_isChanged; }

};

class CMiscBarPrefs : public QWidget
{ 

public:

    CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~CMiscBarPrefs();

#ifdef USECOMBO
    QComboBox *tbpolicy, *tbposition, *qtscroll, *localscroll;
#else
    MenuButton *tbpolicy, *tbposition, *qtscroll, *localscroll;
#endif
    QCheckBox *tbmovable, *floating;
};

class CBarPrefs : public QDialog
{
    Q_OBJECT
	;
    CMiscBarPrefs* misc;
    CFileBarPrefs* filebar;
    CNavBarPrefs* navbar;
    CViewBarPrefs* viewbar;
    CMarkBarPrefs* markbar;
    CIndBarPrefs* indbar;
    Config config;

    void keyPressEvent(QKeyEvent* e)
	{
	    switch (e->key())
	    {
		case Key_Escape:
		    e->accept();
		    reject();
		    break;
		case Key_Space:
		case Key_Return:
		    e->accept();
		    accept();
		    break;
		default:
		    QWidget::keyPressEvent(e);
	    }
	}
 public:
    CBarPrefs(const QString& appdir, bool fs = true, QWidget* parent = 0, const char* name = 0);
    ~CBarPrefs()
	{
	    if (result())
	    {
		if (navbar->isChanged()) navbar->saveall();
		if (filebar->isChanged()) filebar->saveall();
		if (viewbar->isChanged()) viewbar->saveall();
		if (markbar->isChanged()) markbar->saveall();
		if (indbar->isChanged()) indbar->saveall();
	    }
	}
    bool isChanged()
	{
	    return
		(
		    filebar->isChanged()
		    ||
		    navbar->isChanged()
		    ||
		    viewbar->isChanged()
		    ||
		    markbar->isChanged()
		    ||
		    indbar->isChanged()
	        );
	}
    bool floating() { return misc->floating->isChecked(); }
    void floating(bool v) { misc->floating->setChecked(v); }
    int tbpolicy() { return misc->tbpolicy->currentItem(); }
    int qtscroll() { return misc->qtscroll->currentItem(); }
    int localscroll() { return misc->localscroll->currentItem(); }
#ifdef USECOMBO
    void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); }
    void qtscroll(int v) { misc->qtscroll->setCurrentItem(v); }
    void localscroll(int v) { misc->localscroll->setCurrentItem(v); }
#else
    void tbpolicy(int v) { misc->tbpolicy->select(v); }
    void qtscroll(int v) { misc->qtscroll->select(v); }
    void localscroll(int v) { misc->localscroll->select(v); }
#endif
    bool tbmovable() { return misc->tbmovable->isChecked(); }
    void tbmovable(bool v) { misc->tbmovable->setChecked(v); }
    int tbposition() { return misc->tbposition->currentItem(); }
#ifdef USECOMBO
    void tbposition(int v) { misc->tbposition->setCurrentItem(v); }
#else
    void tbposition(int v) { misc->tbposition->select(v); }
#endif

};
#endif // CPREFS_H