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(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0)
64 : QWidget(parent), category_(cat), title_(t), form_(form)
67 virtual ~PrefModule() {}
69 virtual void apply(LyXRC & rc) const = 0;
70 virtual void update(LyXRC const & rc) = 0;
72 lyx::docstring const & category() {
76 lyx::docstring const & title() {
81 lyx::docstring category_;
82 lyx::docstring title_;
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_firstKeymapPB_clicked(bool);
126 void on_secondKeymapPB_clicked(bool);
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);
256 void update_converter();
257 void switch_converter(int);
258 void converter_changed();
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 formatsChanged();
305 void updateButtons();
308 void switch_format(int);
309 void fileformat_changed();
311 void modify_format();
312 void remove_format();
316 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
320 PrefLanguage(QWidget * parent = 0);
323 void apply(LyXRC & rc) const;
324 void update(LyXRC const & rc);
327 std::vector<std::string> lang_;
332 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
336 PrefPrinter(QWidget * parent = 0);
339 void apply(LyXRC & rc) const;
340 void update(LyXRC const & rc);
344 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
348 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
349 ~PrefUserInterface() {}
351 void apply(LyXRC & rc) const;
352 void update(LyXRC const & rc);
361 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
365 PrefIdentity(QWidget * parent = 0);
368 void apply(LyXRC & rc) const;
369 void update(LyXRC const & rc);
373 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
377 QPrefsDialog(QPrefs *);
381 void apply(LyXRC & rc) const;
382 void update(LyXRC const & rc);
385 void change_adaptor();
388 void closeEvent(QCloseEvent * e);
391 void add(PrefModule * module);
395 std::vector<PrefModule *> modules_;
398 } // namespace frontend
401 #endif // PREFSDIALOG_H