00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef CTOOLBARPREFS_H
00010 #define CTOOLBARPREFS_H
00011
00012 #include <qvariant.h>
00013 #include <qwidget.h>
00014 #include <qtabdialog.h>
00015 #include <qtabwidget.h>
00016 #include <qspinbox.h>
00017 #include <qcheckbox.h>
00018 #include <qcombobox.h>
00019 #include <qlineedit.h>
00020 #ifdef USEQPE
00021 #include <qpe/menubutton.h>
00022 #include <qpe/config.h>
00023 #else
00024 #include "preferences.h"
00025 #endif
00026 #define USECOMBO
00027
00028 class QVBoxLayout;
00029 class QHBoxLayout;
00030 class QGridLayout;
00031
00032 class QLabel;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 class CFileBarPrefs : public QWidget
00055 {
00056 Q_OBJECT
00057
00058 Config& config;
00059 QCheckBox *open, *close, *info, *twotouch, *find, *scroll;
00060
00061 bool m_isChanged;
00062
00063 private slots:
00064 void isChanged(int _v) { m_isChanged = true; }
00065
00066 public:
00067 CFileBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00068 ~CFileBarPrefs();
00069 void saveall();
00070 bool isChanged() { return m_isChanged; }
00071 };
00072
00073 class CNavBarPrefs : public QWidget
00074 {
00075 Q_OBJECT
00076
00077 Config& config;
00078 QCheckBox *scroll, *navback, *navhome, *navforward;
00079 QCheckBox *pageup, *pagedown, *gotostart, *gotoend, *jump, *pageline;
00080
00081 bool m_isChanged;
00082
00083 private slots:
00084 void isChanged(int _v) { m_isChanged = true; }
00085
00086 public:
00087 CNavBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00088 ~CNavBarPrefs();
00089 void saveall();
00090 bool isChanged() { return m_isChanged; }
00091 };
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 class CViewBarPrefs : public QWidget
00113 {
00114 Q_OBJECT
00115 Config& config;
00116 QCheckBox *fullscreen, *rotate, *zoomin, *zoomout, *setfont, *encoding, *ideogram, *invert;
00117
00118 bool m_isChanged;
00119
00120 private slots:
00121 void isChanged(int _v) { m_isChanged = true; }
00122
00123 public:
00124 CViewBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00125 ~CViewBarPrefs();
00126 void saveall();
00127 bool isChanged() { return m_isChanged; }
00128
00129 };
00130
00131 class CMarkBarPrefs : public QWidget
00132 {
00133 Q_OBJECT
00134 Config& config;
00135 QCheckBox *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *startblock, *copyblock;
00136
00137 bool m_isChanged;
00138
00139 private slots:
00140 void isChanged(int _v) { m_isChanged = true; }
00141
00142 public:
00143 CMarkBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00144 ~CMarkBarPrefs();
00145 void saveall();
00146 bool isChanged() { return m_isChanged; }
00147
00148 };
00149
00150 class CIndBarPrefs : public QWidget
00151 {
00152 Q_OBJECT
00153 Config& config;
00154 QCheckBox *indannotate;
00155
00156 bool m_isChanged;
00157
00158 private slots:
00159 void isChanged(int _v) { m_isChanged = true; }
00160
00161 public:
00162 CIndBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00163 ~CIndBarPrefs();
00164 void saveall();
00165 bool isChanged() { return m_isChanged; }
00166
00167 };
00168
00169 class CMiscBarPrefs : public QWidget
00170 {
00171
00172 public:
00173
00174 CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00175 ~CMiscBarPrefs();
00176
00177 #ifdef USECOMBO
00178 QComboBox *tbpolicy, *tbposition, *qtscroll, *localscroll;
00179 #else
00180 MenuButton *tbpolicy, *tbposition, *qtscroll, *localscroll;
00181 #endif
00182 QCheckBox *tbmovable, *floating;
00183 };
00184
00185 class CBarPrefs : public QDialog
00186 {
00187 Q_OBJECT
00188 ;
00189 CMiscBarPrefs* misc;
00190 CFileBarPrefs* filebar;
00191 CNavBarPrefs* navbar;
00192 CViewBarPrefs* viewbar;
00193 CMarkBarPrefs* markbar;
00194 CIndBarPrefs* indbar;
00195 Config config;
00196
00197 void keyPressEvent(QKeyEvent* e)
00198 {
00199 switch (e->key())
00200 {
00201 case Key_Escape:
00202 e->accept();
00203 reject();
00204 break;
00205 case Key_Space:
00206 case Key_Return:
00207 e->accept();
00208 accept();
00209 break;
00210 default:
00211 QWidget::keyPressEvent(e);
00212 }
00213 }
00214 public:
00215 CBarPrefs(const QString& appdir, bool fs = true, QWidget* parent = 0, const char* name = 0);
00216 ~CBarPrefs()
00217 {
00218 if (result())
00219 {
00220 if (navbar->isChanged()) navbar->saveall();
00221 if (filebar->isChanged()) filebar->saveall();
00222 if (viewbar->isChanged()) viewbar->saveall();
00223 if (markbar->isChanged()) markbar->saveall();
00224 if (indbar->isChanged()) indbar->saveall();
00225 }
00226 }
00227 bool isChanged()
00228 {
00229 return
00230 (
00231 filebar->isChanged()
00232 ||
00233 navbar->isChanged()
00234 ||
00235 viewbar->isChanged()
00236 ||
00237 markbar->isChanged()
00238 ||
00239 indbar->isChanged()
00240 );
00241 }
00242 bool floating() { return misc->floating->isChecked(); }
00243 void floating(bool v) { misc->floating->setChecked(v); }
00244 int tbpolicy() { return misc->tbpolicy->currentItem(); }
00245 int qtscroll() { return misc->qtscroll->currentItem(); }
00246 int localscroll() { return misc->localscroll->currentItem(); }
00247 #ifdef USECOMBO
00248 void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); }
00249 void qtscroll(int v) { misc->qtscroll->setCurrentItem(v); }
00250 void localscroll(int v) { misc->localscroll->setCurrentItem(v); }
00251 #else
00252 void tbpolicy(int v) { misc->tbpolicy->select(v); }
00253 void qtscroll(int v) { misc->qtscroll->select(v); }
00254 void localscroll(int v) { misc->localscroll->select(v); }
00255 #endif
00256 bool tbmovable() { return misc->tbmovable->isChecked(); }
00257 void tbmovable(bool v) { misc->tbmovable->setChecked(v); }
00258 int tbposition() { return misc->tbposition->currentItem(); }
00259 #ifdef USECOMBO
00260 void tbposition(int v) { misc->tbposition->setCurrentItem(v); }
00261 #else
00262 void tbposition(int v) { misc->tbposition->select(v); }
00263 #endif
00264
00265 };
00266 #endif // CPREFS_H