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/QPrefsUi.h"
24 #include <QCloseEvent>
26 #include "ui/QPrefPlaintextUi.h"
27 #include "ui/QPrefDateUi.h"
28 #include "ui/QPrefKeyboardUi.h"
29 #include "ui/QPrefLatexUi.h"
30 #include "ui/QPrefScreenFontsUi.h"
31 #include "ui/QPrefColorsUi.h"
32 #include "ui/QPrefCygwinPathUi.h"
33 #include "ui/QPrefDisplayUi.h"
34 #include "ui/QPrefPathsUi.h"
35 #include "ui/QPrefSpellcheckerUi.h"
36 #include "ui/QPrefConvertersUi.h"
37 #include "ui/QPrefCopiersUi.h"
38 #include "ui/QPrefFileformatsUi.h"
39 #include "ui/QPrefLanguageUi.h"
40 #include "ui/QPrefPrinterUi.h"
41 #include "ui/QPrefUi.h"
42 #include "ui/QPrefIdentityUi.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();
256 void updateButtons();
260 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
264 PrefCopiers(QPrefs * form, QWidget * parent = 0);
267 void apply(LyXRC & rc) const;
268 void update(LyXRC const & rc);
273 void switch_copierLB(int nr);
274 void switch_copierCO(int nr);
275 void copiers_changed();
277 void modify_copier();
278 void remove_copier();
281 void updateButtons();
285 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
289 PrefFileformats(QPrefs * form, QWidget * parent = 0);
290 ~PrefFileformats() {}
292 void apply(LyXRC & rc) const;
293 void update(LyXRC const & rc);
297 void formatsChanged();
299 void updateButtons();
302 void switch_format(int);
303 void fileformat_changed();
305 void modify_format();
306 void remove_format();
310 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
314 PrefLanguage(QWidget * parent = 0);
317 void apply(LyXRC & rc) const;
318 void update(LyXRC const & rc);
321 std::vector<std::string> lang_;
326 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
330 PrefPrinter(QWidget * parent = 0);
333 void apply(LyXRC & rc) const;
334 void update(LyXRC const & rc);
338 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
342 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
343 ~PrefUserInterface() {}
345 void apply(LyXRC & rc) const;
346 void update(LyXRC const & rc);
351 void on_loadWindowSizeCB_toggled(bool);
356 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
360 PrefIdentity(QWidget * parent = 0);
363 void apply(LyXRC & rc) const;
364 void update(LyXRC const & rc);
368 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
372 QPrefsDialog(QPrefs *);
376 void apply(LyXRC & rc) const;
377 void updateRc(LyXRC const & rc);
380 void change_adaptor();
383 void closeEvent(QCloseEvent * e);
386 void add(PrefModule * module);
390 std::vector<PrefModule *> modules_;
393 } // namespace frontend
396 #endif // PREFSDIALOG_H