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);
161 std::vector<LColor_color> lcolors_;
162 // FIXME the use of mutable here is required due to the
163 // fact that initialization is not done in the controller
164 // but in the constructor.
165 mutable std::vector<QString> curcolors_;
166 std::vector<QString> newcolors_;
171 class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
175 PrefCygwinPath(QWidget * parent = 0);
177 void apply(LyXRC & rc) const;
178 void update(LyXRC const & rc);
182 class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
186 PrefDisplay(QWidget * parent = 0);
188 void apply(LyXRC & rc) const;
189 void update(LyXRC const & rc);
193 class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
197 PrefPaths(QPrefs * form, QWidget * parent = 0);
199 void apply(LyXRC & rc) const;
200 void update(LyXRC const & rc);
203 void select_templatedir();
204 void select_tempdir();
205 void select_backupdir();
206 void select_workingdir();
207 void select_lyxpipe();
212 class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
216 PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
218 void apply(LyXRC & rc) const;
219 void update(LyXRC const & rc);
226 class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
230 PrefConverters(QPrefs * form, QWidget * parent = 0);
232 void apply(LyXRC & rc) const;
233 void update(LyXRC const & rc);
239 void update_converter();
240 void switch_converter();
241 void converter_changed();
242 void remove_converter();
243 void on_cacheCB_stateChanged(int state);
246 void updateButtons();
250 class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
254 PrefCopiers(QPrefs * form, QWidget * parent = 0);
256 void apply(LyXRC & rc) const;
257 void update(LyXRC const & rc);
262 void switch_copierLB(int nr);
263 void switch_copierCO(int nr);
264 void copiers_changed();
266 void modify_copier();
267 void remove_copier();
270 void updateButtons();
274 class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
278 PrefFileformats(QPrefs * form, QWidget * parent = 0);
280 void apply(LyXRC & rc) const;
281 void update(LyXRC const & rc);
285 void formatsChanged();
287 void updateButtons();
290 void switch_format(int);
291 void fileformat_changed();
293 void modify_format();
294 void remove_format();
298 class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
302 PrefLanguage(QWidget * parent = 0);
304 void apply(LyXRC & rc) const;
305 void update(LyXRC const & rc);
308 std::vector<std::string> lang_;
312 class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
316 PrefPrinter(QWidget * parent = 0);
318 void apply(LyXRC & rc) const;
319 void update(LyXRC const & rc);
323 class PrefUserInterface : public PrefModule, public Ui::QPrefUi
327 PrefUserInterface(QPrefs * form, QWidget * parent = 0);
329 void apply(LyXRC & rc) const;
330 void update(LyXRC const & rc);
335 void on_loadWindowSizeCB_toggled(bool);
340 class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
344 PrefIdentity(QWidget * parent = 0);
346 void apply(LyXRC & rc) const;
347 void update(LyXRC const & rc);
351 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
355 QPrefsDialog(QPrefs *);
357 void apply(LyXRC & rc) const;
358 void updateRc(LyXRC const & rc);
361 void change_adaptor();
364 void closeEvent(QCloseEvent * e);
367 void add(PrefModule * module);
371 std::vector<PrefModule *> modules_;
378 : public QController<ControlPrefs, QView<QPrefsDialog> >
383 Converters & converters();
389 virtual void apply();
391 /// update (do we need this?)
392 virtual void update_contents();
395 virtual void build_dialog();
399 } // namespace frontend