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"
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 & t,
60 GuiPrefs * form = 0, QWidget * parent = 0)
61 : QWidget(parent), title_(t), form_(form)
64 virtual void apply(LyXRC & rc) const = 0;
65 virtual void update(LyXRC const & rc) = 0;
67 docstring const & title() const { return title_; }
78 class PrefPlaintext : public PrefModule, public Ui::PrefPlaintextUi
82 PrefPlaintext(QWidget * parent = 0);
84 virtual void apply(LyXRC & rc) const;
85 virtual void update(LyXRC const & rc);
89 class PrefDate : public PrefModule, public Ui::PrefDateUi
93 PrefDate(QWidget * parent = 0);
95 virtual void apply(LyXRC & rc) const;
96 virtual void update(LyXRC const & rc);
100 class PrefKeyboard : public PrefModule, public Ui::PrefKeyboardUi
104 PrefKeyboard(GuiPrefs * form, QWidget * parent = 0);
106 virtual void apply(LyXRC & rc) const;
107 virtual void update(LyXRC const & rc);
110 void on_firstKeymapPB_clicked(bool);
111 void on_secondKeymapPB_clicked(bool);
112 void on_keymapCB_toggled(bool);
115 QString testKeymap(QString keymap);
119 class PrefLatex : public PrefModule, public Ui::PrefLatexUi
123 PrefLatex(GuiPrefs * form, QWidget * parent = 0);
125 virtual void apply(LyXRC & rc) const;
126 virtual void update(LyXRC const & rc);
130 class PrefScreenFonts : public PrefModule, public Ui::PrefScreenFontsUi
134 PrefScreenFonts(GuiPrefs * form, QWidget * parent = 0);
136 virtual void apply(LyXRC & rc) const;
137 virtual void update(LyXRC const & rc);
140 void select_roman(const QString&);
141 void select_sans(const QString&);
142 void select_typewriter(const QString&);
146 class PrefColors : public PrefModule, public Ui::PrefColorsUi
150 PrefColors(GuiPrefs * form, QWidget * parent = 0);
152 void apply(LyXRC & rc) const;
153 void update(LyXRC const & rc);
157 void change_lyxObjects_selection();
160 std::vector<Color_color> lcolors_;
161 // FIXME the use of mutable here is required due to the
162 // fact that initialization is not done in the controller
163 // but in the constructor.
164 std::vector<QString> curcolors_;
165 std::vector<QString> newcolors_;
170 class PrefCygwinPath : public PrefModule, public Ui::PrefCygwinPathUi
174 PrefCygwinPath(QWidget * parent = 0);
176 void apply(LyXRC & rc) const;
177 void update(LyXRC const & rc);
181 class PrefDisplay : public PrefModule, public Ui::PrefDisplayUi
185 PrefDisplay(QWidget * parent = 0);
187 void apply(LyXRC & rc) const;
188 void update(LyXRC const & rc);
192 class PrefPaths : public PrefModule, public Ui::PrefPathsUi
196 PrefPaths(GuiPrefs * form, QWidget * parent = 0);
198 void apply(LyXRC & rc) const;
199 void update(LyXRC const & rc);
202 void select_templatedir();
203 void select_tempdir();
204 void select_backupdir();
205 void select_workingdir();
206 void select_lyxpipe();
211 class PrefSpellchecker : public PrefModule, public Ui::PrefSpellcheckerUi
215 PrefSpellchecker(GuiPrefs * form, QWidget * parent = 0);
217 void apply(LyXRC & rc) const;
218 void update(LyXRC const & rc);
225 class PrefConverters : public PrefModule, public Ui::PrefConvertersUi
229 PrefConverters(GuiPrefs * form, QWidget * parent = 0);
231 void apply(LyXRC & rc) const;
232 void update(LyXRC const & rc);
238 void update_converter();
239 void switch_converter();
240 void converter_changed();
241 void remove_converter();
242 void on_cacheCB_stateChanged(int state);
245 void updateButtons();
249 class PrefCopiers : public PrefModule, public Ui::PrefCopiersUi
253 PrefCopiers(GuiPrefs * form, QWidget * parent = 0);
255 void apply(LyXRC & rc) const;
256 void update(LyXRC const & rc);
261 void switch_copierLB(int nr);
262 void switch_copierCO(int nr);
263 void copiers_changed();
265 void modify_copier();
266 void remove_copier();
269 void updateButtons();
273 class PrefFileformats : public PrefModule, public Ui::PrefFileformatsUi
277 PrefFileformats(GuiPrefs * form, QWidget * parent = 0);
279 void apply(LyXRC & rc) const;
280 void update(LyXRC const & rc);
284 void formatsChanged();
286 void updateButtons();
289 void switch_format(int);
290 void fileformat_changed();
292 void modify_format();
293 void remove_format();
297 class PrefLanguage : public PrefModule, public Ui::PrefLanguageUi
301 PrefLanguage(QWidget * parent = 0);
303 void apply(LyXRC & rc) const;
304 void update(LyXRC const & rc);
307 std::vector<std::string> lang_;
311 class PrefPrinter : public PrefModule, public Ui::PrefPrinterUi
315 PrefPrinter(QWidget * parent = 0);
317 void apply(LyXRC & rc) const;
318 void update(LyXRC const & rc);
322 class PrefUserInterface : public PrefModule, public Ui::PrefUi
326 PrefUserInterface(GuiPrefs * form, QWidget * parent = 0);
328 void apply(LyXRC & rc) const;
329 void update(LyXRC const & rc);
334 void on_loadWindowSizeCB_toggled(bool);
339 class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
343 PrefIdentity(QWidget * parent = 0);
345 void apply(LyXRC & rc) const;
346 void update(LyXRC const & rc);
350 class GuiPrefsDialog : public QDialog, public Ui::PrefsUi
354 GuiPrefsDialog(GuiPrefs *);
356 void apply(LyXRC & rc) const;
357 void updateRc(LyXRC const & rc);
360 void change_adaptor();
363 void closeEvent(QCloseEvent * e);
366 void add(PrefModule * module);
370 std::vector<PrefModule *> modules_;
377 : public QController<ControlPrefs, GuiView<GuiPrefsDialog> >
382 Converters & converters();
388 virtual void apply();
390 /// update (do we need this?)
391 virtual void update_contents();
394 virtual void build_dialog();
398 } // namespace frontend