4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
13 #ifndef QPREFSDIALOG_H
14 #define QPREFSDIALOG_H
19 #include "ui/PrefsUi.h"
24 #include <QCloseEvent>
26 #include "ui/PrefPlaintextUi.h"
27 #include "ui/PrefDateUi.h"
28 #include "ui/PrefKeyboardUi.h"
29 #include "ui/PrefLatexUi.h"
30 #include "ui/PrefScreenFontsUi.h"
31 #include "ui/PrefColorsUi.h"
32 #include "ui/PrefCygwinPathUi.h"
33 #include "ui/PrefDisplayUi.h"
34 #include "ui/PrefPathsUi.h"
35 #include "ui/PrefSpellcheckerUi.h"
36 #include "ui/PrefConvertersUi.h"
37 #include "ui/PrefCopiersUi.h"
38 #include "ui/PrefFileformatsUi.h"
39 #include "ui/PrefLanguageUi.h"
40 #include "ui/PrefPrinterUi.h"
41 #include "ui/PrefUi.h"
42 #include "ui/PrefIdentityUi.h"
49 class PrefModule : public QWidget
53 PrefModule(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0)
54 : QWidget(parent), category_(cat), title_(t), form_(form)
57 virtual ~PrefModule() {}
59 virtual void apply(LyXRC & rc) const = 0;
60 virtual void update(LyXRC const & rc) = 0;
62 lyx::docstring const & category() {
66 lyx::docstring const & title() {
71 lyx::docstring category_;
72 lyx::docstring title_;
80 class PrefPlaintext : public PrefModule, public Ui::QPrefPlaintextUi
84 PrefPlaintext(QWidget * parent = 0);
87 virtual void apply(LyXRC & rc) const;
88 virtual void update(LyXRC const & rc);
92 class PrefDate : public PrefModule, public Ui::QPrefDateUi
96 PrefDate(QWidget * parent = 0);
99 virtual void apply(LyXRC & rc) const;
100 virtual void update(LyXRC const & rc);
104 class PrefKeyboard : public PrefModule, public Ui::QPrefKeyboardUi
108 PrefKeyboard(QPrefs * form, QWidget * parent = 0);
111 virtual void apply(LyXRC & rc) const;
112 virtual void update(LyXRC const & rc);
115 void on_firstKeymapPB_clicked(bool);
116 void on_secondKeymapPB_clicked(bool);
117 void on_keymapCB_toggled(bool);
120 QString testKeymap(QString keymap);
124 class PrefLatex : public PrefModule, public Ui::QPrefLatexUi
128 PrefLatex(QPrefs * form, QWidget * parent = 0);
131 virtual void apply(LyXRC & rc) const;
132 virtual void update(LyXRC const & rc);
136 class PrefScreenFonts : public PrefModule, public Ui::QPrefScreenFontsUi
140 PrefScreenFonts(QPrefs * form, QWidget * parent = 0);
141 ~PrefScreenFonts() {}
143 virtual void apply(LyXRC & rc) const;
144 virtual void update(LyXRC const & rc);
147 void select_roman(const QString&);
148 void select_sans(const QString&);
149 void select_typewriter(const QString&);
153 class PrefColors : public PrefModule, public Ui::QPrefColorsUi
157 PrefColors(QPrefs * form, QWidget * parent = 0);
160 void apply(LyXRC & rc) const;
161 void update(LyXRC const & rc);
167 std::vector<LColor_color> lcolors_;
168 // FIXME the use of mutable here is required due to the
169 // fact that initialization is not done in the controller
170 // but in the constructor.
171 mutable std::vector<QString> curcolors_;
172 std::vector<QString> newcolors_;
177 class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
181 PrefCygwinPath(QWidget * parent = 0);
184 void apply(LyXRC & rc) const;
185 void update(LyXRC const & rc);
189 class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
193 PrefDisplay(QWidget * parent = 0);
196 void apply(LyXRC & rc) const;
197 void update(LyXRC const & rc);
201 class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
205 PrefPaths(QPrefs * form, QWidget * parent = 0);
208 void apply(LyXRC & rc) const;
209 void update(LyXRC const & rc);
212 void select_templatedir();
213 void select_tempdir();
214 void select_backupdir();
215 void select_workingdir();
216 void select_lyxpipe();
221 class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
225 PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
226 ~PrefSpellchecker() {}
228 void apply(LyXRC & rc) const;
229 void update(LyXRC const & rc);
236 class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
240 PrefConverters(QPrefs * form, QWidget * parent = 0);
243 void apply(LyXRC & rc) const;
244 void update(LyXRC const & rc);
250 void update_converter();
251 void switch_converter();
252 void converter_changed();
253 void remove_converter();
254 void on_cacheCB_stateChanged(int state);
257 void updateButtons();
261 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
265 PrefCopiers(QPrefs * form, QWidget * parent = 0);
268 void apply(LyXRC & rc) const;
269 void update(LyXRC const & rc);
274 void switch_copierLB(int nr);
275 void switch_copierCO(int nr);
276 void copiers_changed();
278 void modify_copier();
279 void remove_copier();
282 void updateButtons();
286 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
290 PrefFileformats(QPrefs * form, QWidget * parent = 0);
291 ~PrefFileformats() {}
293 void apply(LyXRC & rc) const;
294 void update(LyXRC const & rc);
298 void formatsChanged();
300 void updateButtons();
303 void switch_format(int);
304 void fileformat_changed();
306 void modify_format();
307 void remove_format();
311 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
315 PrefLanguage(QWidget * parent = 0);
318 void apply(LyXRC & rc) const;
319 void update(LyXRC const & rc);
322 std::vector<std::string> lang_;
327 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
331 PrefPrinter(QWidget * parent = 0);
334 void apply(LyXRC & rc) const;
335 void update(LyXRC const & rc);
339 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
343 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
344 ~PrefUserInterface() {}
346 void apply(LyXRC & rc) const;
347 void update(LyXRC const & rc);
352 void on_loadWindowSizeCB_toggled(bool);
357 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
361 PrefIdentity(QWidget * parent = 0);
364 void apply(LyXRC & rc) const;
365 void update(LyXRC const & rc);
369 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
373 QPrefsDialog(QPrefs *);
377 void apply(LyXRC & rc) const;
378 void updateRc(LyXRC const & rc);
381 void change_adaptor();
384 void closeEvent(QCloseEvent * e);
387 void add(PrefModule * module);
391 std::vector<PrefModule *> modules_;
394 } // namespace frontend
397 #endif // PREFSDIALOG_H