4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "QDialogView.h"
20 #include "ui_PrefsUi.h"
25 #include <QCloseEvent>
27 #include "ui_PrefPlaintextUi.h"
28 #include "ui_PrefDateUi.h"
29 #include "ui_PrefKeyboardUi.h"
30 #include "ui_PrefLatexUi.h"
31 #include "ui_PrefScreenFontsUi.h"
32 #include "ui_PrefColorsUi.h"
33 #include "ui_PrefCygwinPathUi.h"
34 #include "ui_PrefDisplayUi.h"
35 #include "ui_PrefPathsUi.h"
36 #include "ui_PrefSpellcheckerUi.h"
37 #include "ui_PrefConvertersUi.h"
38 #include "ui_PrefCopiersUi.h"
39 #include "ui_PrefFileformatsUi.h"
40 #include "ui_PrefLanguageUi.h"
41 #include "ui_PrefPrinterUi.h"
42 #include "ui_PrefUi.h"
43 #include "ui_PrefIdentityUi.h"
55 class PrefModule : public QWidget
59 PrefModule(docstring const & cat, docstring const & t,
60 QPrefs * form = 0, QWidget * parent = 0)
61 : QWidget(parent), category_(cat), title_(t), form_(form)
64 virtual void apply(LyXRC & rc) const = 0;
65 virtual void update(LyXRC const & rc) = 0;
67 docstring const & category() const { return category_; }
68 docstring const & title() const { return title_; }
80 class PrefPlaintext : public PrefModule, public Ui::QPrefPlaintextUi
84 PrefPlaintext(QWidget * parent = 0);
86 virtual void apply(LyXRC & rc) const;
87 virtual void update(LyXRC const & rc);
91 class PrefDate : public PrefModule, public Ui::QPrefDateUi
95 PrefDate(QWidget * parent = 0);
97 virtual void apply(LyXRC & rc) const;
98 virtual void update(LyXRC const & rc);
102 class PrefKeyboard : public PrefModule, public Ui::QPrefKeyboardUi
106 PrefKeyboard(QPrefs * form, QWidget * parent = 0);
108 virtual void apply(LyXRC & rc) const;
109 virtual void update(LyXRC const & rc);
112 void on_firstKeymapPB_clicked(bool);
113 void on_secondKeymapPB_clicked(bool);
114 void on_keymapCB_toggled(bool);
117 QString testKeymap(QString keymap);
121 class PrefLatex : public PrefModule, public Ui::QPrefLatexUi
125 PrefLatex(QPrefs * form, QWidget * parent = 0);
127 virtual void apply(LyXRC & rc) const;
128 virtual void update(LyXRC const & rc);
132 class PrefScreenFonts : public PrefModule, public Ui::QPrefScreenFontsUi
136 PrefScreenFonts(QPrefs * form, QWidget * parent = 0);
138 virtual void apply(LyXRC & rc) const;
139 virtual void update(LyXRC const & rc);
142 void select_roman(const QString&);
143 void select_sans(const QString&);
144 void select_typewriter(const QString&);
148 class PrefColors : public PrefModule, public Ui::QPrefColorsUi
152 PrefColors(QPrefs * form, QWidget * parent = 0);
154 void apply(LyXRC & rc) const;
155 void update(LyXRC const & rc);
159 void change_lyxObjects_selection();
162 std::vector<Color_color> lcolors_;
163 // FIXME the use of mutable here is required due to the
164 // fact that initialization is not done in the controller
165 // but in the constructor.
166 std::vector<QString> curcolors_;
167 std::vector<QString> newcolors_;
172 class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
176 PrefCygwinPath(QWidget * parent = 0);
178 void apply(LyXRC & rc) const;
179 void update(LyXRC const & rc);
183 class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
187 PrefDisplay(QWidget * parent = 0);
189 void apply(LyXRC & rc) const;
190 void update(LyXRC const & rc);
194 class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
198 PrefPaths(QPrefs * form, QWidget * parent = 0);
200 void apply(LyXRC & rc) const;
201 void update(LyXRC const & rc);
204 void select_templatedir();
205 void select_tempdir();
206 void select_backupdir();
207 void select_workingdir();
208 void select_lyxpipe();
213 class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
217 PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
219 void apply(LyXRC & rc) const;
220 void update(LyXRC const & rc);
227 class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
231 PrefConverters(QPrefs * form, QWidget * parent = 0);
233 void apply(LyXRC & rc) const;
234 void update(LyXRC const & rc);
240 void update_converter();
241 void switch_converter();
242 void converter_changed();
243 void remove_converter();
244 void on_cacheCB_stateChanged(int state);
247 void updateButtons();
251 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
255 PrefCopiers(QPrefs * form, QWidget * parent = 0);
257 void apply(LyXRC & rc) const;
258 void update(LyXRC const & rc);
263 void switch_copierLB(int nr);
264 void switch_copierCO(int nr);
265 void copiers_changed();
267 void modify_copier();
268 void remove_copier();
271 void updateButtons();
275 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
279 PrefFileformats(QPrefs * form, QWidget * parent = 0);
281 void apply(LyXRC & rc) const;
282 void update(LyXRC const & rc);
286 void formatsChanged();
288 void updateButtons();
291 void switch_format(int);
292 void fileformat_changed();
294 void modify_format();
295 void remove_format();
299 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
303 PrefLanguage(QWidget * parent = 0);
305 void apply(LyXRC & rc) const;
306 void update(LyXRC const & rc);
309 std::vector<std::string> lang_;
313 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
317 PrefPrinter(QWidget * parent = 0);
319 void apply(LyXRC & rc) const;
320 void update(LyXRC const & rc);
324 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
328 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
330 void apply(LyXRC & rc) const;
331 void update(LyXRC const & rc);
336 void on_loadWindowSizeCB_toggled(bool);
341 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
345 PrefIdentity(QWidget * parent = 0);
347 void apply(LyXRC & rc) const;
348 void update(LyXRC const & rc);
352 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
356 QPrefsDialog(QPrefs *);
358 void apply(LyXRC & rc) const;
359 void updateRc(LyXRC const & rc);
362 void change_adaptor();
365 void closeEvent(QCloseEvent * e);
368 void add(PrefModule * module);
372 std::vector<PrefModule *> modules_;
379 : public QController<ControlPrefs, QView<QPrefsDialog> >
384 Converters & converters();
390 virtual void apply();
392 /// update (do we need this?)
393 virtual void update_contents();
396 virtual void build_dialog();
400 } // namespace frontend