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 std::vector<QString> prefcolors_;
169 std::vector<QString> newcolors_;
174 class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
178 PrefCygwinPath(QWidget * parent = 0);
181 void apply(LyXRC & rc) const;
182 void update(LyXRC const & rc);
186 class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
190 PrefDisplay(QWidget * parent = 0);
193 void apply(LyXRC & rc) const;
194 void update(LyXRC const & rc);
198 class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
202 PrefPaths(QPrefs * form, QWidget * parent = 0);
205 void apply(LyXRC & rc) const;
206 void update(LyXRC const & rc);
209 void select_templatedir();
210 void select_tempdir();
211 void select_backupdir();
212 void select_workingdir();
213 void select_lyxpipe();
218 class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
222 PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
223 ~PrefSpellchecker() {}
225 void apply(LyXRC & rc) const;
226 void update(LyXRC const & rc);
233 class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
237 PrefConverters(QPrefs * form, QWidget * parent = 0);
240 void apply(LyXRC & rc) const;
241 void update(LyXRC const & rc);
247 void update_converter();
248 void switch_converter();
249 void converter_changed();
250 void remove_converter();
253 void updateButtons();
257 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
261 PrefCopiers(QPrefs * form, QWidget * parent = 0);
264 void apply(LyXRC & rc) const;
265 void update(LyXRC const & rc);
270 void switch_copierLB(int nr);
271 void switch_copierCO(int nr);
272 void copiers_changed();
274 void modify_copier();
275 void remove_copier();
278 void updateButtons();
282 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
286 PrefFileformats(QPrefs * form, QWidget * parent = 0);
287 ~PrefFileformats() {}
289 void apply(LyXRC & rc) const;
290 void update(LyXRC const & rc);
294 void formatsChanged();
296 void updateButtons();
299 void switch_format(int);
300 void fileformat_changed();
302 void modify_format();
303 void remove_format();
307 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
311 PrefLanguage(QWidget * parent = 0);
314 void apply(LyXRC & rc) const;
315 void update(LyXRC const & rc);
318 std::vector<std::string> lang_;
323 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
327 PrefPrinter(QWidget * parent = 0);
330 void apply(LyXRC & rc) const;
331 void update(LyXRC const & rc);
335 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
339 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
340 ~PrefUserInterface() {}
342 void apply(LyXRC & rc) const;
343 void update(LyXRC const & rc);
348 void on_loadWindowSizeCB_toggled(bool);
353 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
357 PrefIdentity(QWidget * parent = 0);
360 void apply(LyXRC & rc) const;
361 void update(LyXRC const & rc);
365 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
369 QPrefsDialog(QPrefs *);
373 void apply(LyXRC & rc) const;
374 void updateRc(LyXRC const & rc);
377 void change_adaptor();
380 void closeEvent(QCloseEvent * e);
383 void add(PrefModule * module);
387 std::vector<PrefModule *> modules_;
390 } // namespace frontend
393 #endif // PREFSDIALOG_H