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 "GuiDialogView.h"
16 #include "ControlPrefs.h"
20 #include "ui_PrefsUi.h"
22 #include "ui_PrefPlaintextUi.h"
23 #include "ui_PrefDateUi.h"
24 #include "ui_PrefKeyboardUi.h"
25 #include "ui_PrefLatexUi.h"
26 #include "ui_PrefScreenFontsUi.h"
27 #include "ui_PrefColorsUi.h"
28 #include "ui_PrefDisplayUi.h"
29 #include "ui_PrefPathsUi.h"
30 #include "ui_PrefSpellcheckerUi.h"
31 #include "ui_PrefConvertersUi.h"
32 #include "ui_PrefCopiersUi.h"
33 #include "ui_PrefFileformatsUi.h"
34 #include "ui_PrefLanguageUi.h"
35 #include "ui_PrefPrinterUi.h"
36 #include "ui_PrefUi.h"
37 #include "ui_PrefIdentityUi.h"
53 class PrefModule : public QWidget
57 PrefModule(docstring const & t,
58 GuiPrefs * form = 0, QWidget * parent = 0)
59 : QWidget(parent), title_(t), form_(form)
62 virtual void apply(LyXRC & rc) const = 0;
63 virtual void update(LyXRC const & rc) = 0;
65 docstring const & title() const { return title_; }
76 class PrefPlaintext : public PrefModule, public Ui::PrefPlaintextUi
80 PrefPlaintext(QWidget * parent = 0);
82 virtual void apply(LyXRC & rc) const;
83 virtual void update(LyXRC const & rc);
87 class PrefDate : public PrefModule, public Ui::PrefDateUi
91 PrefDate(QWidget * parent = 0);
93 virtual void apply(LyXRC & rc) const;
94 virtual void update(LyXRC const & rc);
98 class PrefKeyboard : public PrefModule, public Ui::PrefKeyboardUi
102 PrefKeyboard(GuiPrefs * form, QWidget * parent = 0);
104 virtual void apply(LyXRC & rc) const;
105 virtual void update(LyXRC const & rc);
108 void on_firstKeymapPB_clicked(bool);
109 void on_secondKeymapPB_clicked(bool);
110 void on_keymapCB_toggled(bool);
113 QString testKeymap(QString keymap);
117 class PrefLatex : public PrefModule, public Ui::PrefLatexUi
121 PrefLatex(GuiPrefs * form, QWidget * parent = 0);
123 virtual void apply(LyXRC & rc) const;
124 virtual void update(LyXRC const & rc);
128 class PrefScreenFonts : public PrefModule, public Ui::PrefScreenFontsUi
132 PrefScreenFonts(GuiPrefs * form, QWidget * parent = 0);
134 virtual void apply(LyXRC & rc) const;
135 virtual void update(LyXRC const & rc);
138 void select_roman(const QString&);
139 void select_sans(const QString&);
140 void select_typewriter(const QString&);
144 class PrefColors : public PrefModule, public Ui::PrefColorsUi
148 PrefColors(GuiPrefs * form, QWidget * parent = 0);
150 void apply(LyXRC & rc) const;
151 void update(LyXRC const & rc);
155 void change_lyxObjects_selection();
158 std::vector<Color_color> lcolors_;
159 // FIXME the use of mutable here is required due to the
160 // fact that initialization is not done in the controller
161 // but in the constructor.
162 std::vector<QString> curcolors_;
163 std::vector<QString> newcolors_;
168 class PrefDisplay : public PrefModule, public Ui::PrefDisplayUi
172 PrefDisplay(QWidget * parent = 0);
174 void apply(LyXRC & rc) const;
175 void update(LyXRC const & rc);
179 class PrefPaths : public PrefModule, public Ui::PrefPathsUi
183 PrefPaths(GuiPrefs * form, QWidget * parent = 0);
185 void apply(LyXRC & rc) const;
186 void update(LyXRC const & rc);
189 void select_templatedir();
190 void select_tempdir();
191 void select_backupdir();
192 void select_workingdir();
193 void select_lyxpipe();
198 class PrefSpellchecker : public PrefModule, public Ui::PrefSpellcheckerUi
202 PrefSpellchecker(GuiPrefs * form, QWidget * parent = 0);
204 void apply(LyXRC & rc) const;
205 void update(LyXRC const & rc);
212 class PrefConverters : public PrefModule, public Ui::PrefConvertersUi
216 PrefConverters(GuiPrefs * form, QWidget * parent = 0);
218 void apply(LyXRC & rc) const;
219 void update(LyXRC const & rc);
225 void update_converter();
226 void switch_converter();
227 void converter_changed();
228 void remove_converter();
229 void on_cacheCB_stateChanged(int state);
232 void updateButtons();
236 class PrefCopiers : public PrefModule, public Ui::PrefCopiersUi
240 PrefCopiers(GuiPrefs * form, QWidget * parent = 0);
242 void apply(LyXRC & rc) const;
243 void update(LyXRC const & rc);
248 void switch_copierLB(int nr);
249 void switch_copierCO(int nr);
250 void copiers_changed();
252 void modify_copier();
253 void remove_copier();
256 void updateButtons();
260 class PrefFileformats : public PrefModule, public Ui::PrefFileformatsUi
264 PrefFileformats(GuiPrefs * form, QWidget * parent = 0);
266 void apply(LyXRC & rc) const;
267 void update(LyXRC const & rc);
271 void formatsChanged();
273 void updateButtons();
276 void switch_format(int);
277 void fileformat_changed();
279 void modify_format();
280 void remove_format();
284 class PrefLanguage : public PrefModule, public Ui::PrefLanguageUi
288 PrefLanguage(QWidget * parent = 0);
290 void apply(LyXRC & rc) const;
291 void update(LyXRC const & rc);
294 std::vector<std::string> lang_;
298 class PrefPrinter : public PrefModule, public Ui::PrefPrinterUi
302 PrefPrinter(QWidget * parent = 0);
304 void apply(LyXRC & rc) const;
305 void update(LyXRC const & rc);
309 class PrefUserInterface : public PrefModule, public Ui::PrefUi
313 PrefUserInterface(GuiPrefs * form, QWidget * parent = 0);
315 void apply(LyXRC & rc) const;
316 void update(LyXRC const & rc);
321 void on_loadWindowSizeCB_toggled(bool);
326 class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
330 PrefIdentity(QWidget * parent = 0);
332 void apply(LyXRC & rc) const;
333 void update(LyXRC const & rc);
337 class GuiPrefsDialog : public QDialog, public Ui::PrefsUi
341 GuiPrefsDialog(GuiPrefs *);
343 void apply(LyXRC & rc) const;
344 void updateRc(LyXRC const & rc);
347 void change_adaptor();
350 void closeEvent(QCloseEvent * e);
353 void add(PrefModule * module);
357 std::vector<PrefModule *> modules_;
361 class GuiPrefs : public GuiView<GuiPrefsDialog>
364 GuiPrefs(GuiDialog &);
366 Converters & converters();
369 /// parent controller
370 ControlPrefs & controller()
371 { return static_cast<ControlPrefs &>(this->getController()); }
372 /// parent controller
373 ControlPrefs const & controller() const
374 { return static_cast<ControlPrefs const &>(this->getController()); }
377 virtual void applyView();
379 /// update (do we need this?)
380 virtual void update_contents();
383 virtual void build_dialog();
387 } // namespace frontend