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/QPrefAsciiUi.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"
45 class UiWidget: public QWidget, public UI
48 UiWidget(QWidget * parent = 0): QWidget(parent)
59 class PrefModule : public QWidget
63 PrefModule(std::string const & cat, std::string const & t, QPrefs * form = 0, QWidget * parent = 0)
64 : category_(cat), title_(t), form_(form), QWidget(parent)
67 virtual ~PrefModule() {}
69 virtual void apply(LyXRC & rc) const = 0;
70 virtual void update(LyXRC const & rc) = 0;
72 std::string const & category() {
76 std::string const & title() {
81 std::string category_;
90 class PrefAscii : public PrefModule, public Ui::QPrefAsciiUi
94 PrefAscii(QWidget * parent = 0);
97 virtual void apply(LyXRC & rc) const;
98 virtual void update(LyXRC const & rc);
102 class PrefDate : public PrefModule, public Ui::QPrefDateUi
106 PrefDate(QWidget * parent = 0);
109 virtual void apply(LyXRC & rc) const;
110 virtual void update(LyXRC const & rc);
114 class PrefKeyboard : public PrefModule, public Ui::QPrefKeyboardUi
118 PrefKeyboard(QPrefs * form, QWidget * parent = 0);
121 virtual void apply(LyXRC & rc) const;
122 virtual void update(LyXRC const & rc);
125 void on_firstKeymapED_clicked();
126 void on_secondKeymapED_clicked();
129 QString testKeymap(QString keymap);
133 class PrefLatex : public PrefModule, public Ui::QPrefLatexUi
137 PrefLatex(QPrefs * form, QWidget * parent = 0);
140 virtual void apply(LyXRC & rc) const;
141 virtual void update(LyXRC const & rc);
145 class PrefScreenFonts : public PrefModule, public Ui::QPrefScreenFontsUi
149 PrefScreenFonts(QPrefs * form, QWidget * parent = 0);
150 ~PrefScreenFonts() {}
152 virtual void apply(LyXRC & rc) const;
153 virtual void update(LyXRC const & rc);
156 void select_roman(const QString&);
157 void select_sans(const QString&);
158 void select_typewriter(const QString&);
162 class PrefColors : public PrefModule, public Ui::QPrefColorsUi
166 PrefColors(QPrefs * form, QWidget * parent = 0);
169 void apply(LyXRC & rc) const;
170 void update(LyXRC const & rc);
176 std::vector<LColor_color> lcolors_;
177 std::vector<QString> prefcolors_;
178 std::vector<QString> newcolors_;
183 class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
187 PrefCygwinPath(QWidget * parent = 0);
190 void apply(LyXRC & rc) const;
191 void update(LyXRC const & rc);
195 class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
199 PrefDisplay(QWidget * parent = 0);
202 void apply(LyXRC & rc) const;
203 void update(LyXRC const & rc);
207 class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
211 PrefPaths(QPrefs * form, QWidget * parent = 0);
214 void apply(LyXRC & rc) const;
215 void update(LyXRC const & rc);
218 void select_templatedir();
219 void select_tempdir();
220 void select_backupdir();
221 void select_workingdir();
222 void select_lyxpipe();
227 class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
231 PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
232 ~PrefSpellchecker() {}
234 void apply(LyXRC & rc) const;
235 void update(LyXRC const & rc);
242 class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
246 PrefConverters(QPrefs * form, QWidget * parent = 0);
249 void apply(LyXRC & rc) const;
250 void update(LyXRC const & rc);
255 void switch_converter(int);
256 void converter_changed();
257 void new_converter();
258 void modify_converter();
259 void remove_converter();
262 void updateButtons();
266 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
270 PrefCopiers(QPrefs * form, QWidget * parent = 0);
273 void apply(LyXRC & rc) const;
274 void update(LyXRC const & rc);
279 void switch_copierLB(int nr);
280 void switch_copierCO(int nr);
281 void copiers_changed();
283 void modify_copier();
284 void remove_copier();
287 void updateButtons();
291 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
295 PrefFileformats(QPrefs * form, QWidget * parent = 0);
296 ~PrefFileformats() {}
298 void apply(LyXRC & rc) const;
299 void update(LyXRC const & rc);
303 void setConverters(PrefConverters *);
306 void updateButtons();
309 void switch_format(int);
310 void fileformat_changed();
312 void modify_format();
313 void remove_format();
316 PrefConverters * converters_;
321 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
325 PrefLanguage(QWidget * parent = 0);
328 void apply(LyXRC & rc) const;
329 void update(LyXRC const & rc);
332 std::vector<std::string> lang_;
337 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
341 PrefPrinter(QWidget * parent = 0);
344 void apply(LyXRC & rc) const;
345 void update(LyXRC const & rc);
349 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
353 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
354 ~PrefUserInterface() {}
356 void apply(LyXRC & rc) const;
357 void update(LyXRC const & rc);
366 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
370 PrefIdentity(QWidget * parent = 0);
373 void apply(LyXRC & rc) const;
374 void update(LyXRC const & rc);
378 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
382 QPrefsDialog(QPrefs *);
386 void apply(LyXRC & rc) const;
387 void update(LyXRC const & rc);
390 void change_adaptor();
393 void closeEvent(QCloseEvent * e);
396 void add(PrefModule * module);
400 std::vector<PrefModule *> modules_;
403 } // namespace frontend
406 #endif // PREFSDIALOG_H