]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QPrefsDialog.h
renaming in frontends/qt4/ui: s/Q//g
[lyx.git] / src / frontends / qt4 / QPrefsDialog.h
1 // -*- C++ -*-
2 /**
3  * \file QPrefsDialog.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QPREFSDIALOG_H
14 #define QPREFSDIALOG_H
15
16 #include "LColor.h"
17 #include "lyxrc.h"
18
19 #include "ui/PrefsUi.h"
20
21 #include <vector>
22
23 #include <QDialog>
24 #include <QCloseEvent>
25
26 #include "ui/PrefPlaintextUi.h"
27 #include "ui/PrefDateUi.h"
28 #include "ui/PrefKeyboardUi.h"
29 #include "ui/PrefLatexUi.h"
30 #include "ui/PrefScreenFontsUi.h"
31 #include "ui/PrefColorsUi.h"
32 #include "ui/PrefCygwinPathUi.h"
33 #include "ui/PrefDisplayUi.h"
34 #include "ui/PrefPathsUi.h"
35 #include "ui/PrefSpellcheckerUi.h"
36 #include "ui/PrefConvertersUi.h"
37 #include "ui/PrefCopiersUi.h"
38 #include "ui/PrefFileformatsUi.h"
39 #include "ui/PrefLanguageUi.h"
40 #include "ui/PrefPrinterUi.h"
41 #include "ui/PrefUi.h"
42 #include "ui/PrefIdentityUi.h"
43
44 namespace lyx {
45 namespace frontend {
46
47 class QPrefs;
48
49 class PrefModule : public QWidget
50 {
51         Q_OBJECT
52 public:
53         PrefModule(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0)
54                 : QWidget(parent), category_(cat), title_(t), form_(form)
55         {
56         }
57         virtual ~PrefModule() {}
58
59         virtual void apply(LyXRC & rc) const = 0;
60         virtual void update(LyXRC const & rc) = 0;
61
62         lyx::docstring const & category() {
63                 return category_;
64         }
65
66         lyx::docstring const & title() {
67                 return title_;
68         }
69
70 protected:
71         lyx::docstring category_;
72         lyx::docstring title_;
73         QPrefs * form_;
74
75 Q_SIGNALS:
76         void changed();
77 };
78
79
80 class PrefPlaintext :  public PrefModule, public Ui::QPrefPlaintextUi
81 {
82         Q_OBJECT
83 public:
84         PrefPlaintext(QWidget * parent = 0);
85         ~PrefPlaintext() {}
86
87         virtual void apply(LyXRC & rc) const;
88         virtual void update(LyXRC const & rc);
89 };
90
91
92 class PrefDate :  public PrefModule, public Ui::QPrefDateUi
93 {
94         Q_OBJECT
95 public:
96         PrefDate(QWidget * parent = 0);
97         ~PrefDate() {}
98
99         virtual void apply(LyXRC & rc) const;
100         virtual void update(LyXRC const & rc);
101 };
102
103
104 class PrefKeyboard :  public PrefModule, public Ui::QPrefKeyboardUi
105 {
106         Q_OBJECT
107 public:
108         PrefKeyboard(QPrefs * form, QWidget * parent = 0);
109         ~PrefKeyboard() {}
110
111         virtual void apply(LyXRC & rc) const;
112         virtual void update(LyXRC const & rc);
113
114 private Q_SLOTS:
115         void on_firstKeymapPB_clicked(bool);
116         void on_secondKeymapPB_clicked(bool);
117         void on_keymapCB_toggled(bool);
118
119 private:
120         QString testKeymap(QString keymap);
121 };
122
123
124 class PrefLatex :  public PrefModule, public Ui::QPrefLatexUi
125 {
126         Q_OBJECT
127 public:
128         PrefLatex(QPrefs * form, QWidget * parent = 0);
129         ~PrefLatex() {}
130
131         virtual void apply(LyXRC & rc) const;
132         virtual void update(LyXRC const & rc);
133 };
134
135
136 class PrefScreenFonts :  public PrefModule, public Ui::QPrefScreenFontsUi
137 {
138         Q_OBJECT
139 public:
140         PrefScreenFonts(QPrefs * form, QWidget * parent = 0);
141         ~PrefScreenFonts() {}
142
143         virtual void apply(LyXRC & rc) const;
144         virtual void update(LyXRC const & rc);
145
146 private Q_SLOTS:
147         void select_roman(const QString&);
148         void select_sans(const QString&);
149         void select_typewriter(const QString&);
150 };
151
152
153 class PrefColors :  public PrefModule, public Ui::QPrefColorsUi
154 {
155         Q_OBJECT
156 public:
157         PrefColors(QPrefs * form, QWidget * parent = 0);
158         ~PrefColors() {}
159
160         void apply(LyXRC & rc) const;
161         void update(LyXRC const & rc);
162
163 private Q_SLOTS:
164         void change_color();
165
166 private:
167         std::vector<LColor_color> lcolors_;
168         // FIXME the use of mutable here is required due to the
169         // fact that initialization is not done in the controller
170         // but in the constructor.
171         mutable std::vector<QString> curcolors_;
172         std::vector<QString> newcolors_;
173
174 };
175
176
177 class PrefCygwinPath :  public PrefModule, public Ui::QPrefCygwinPathUi
178 {
179         Q_OBJECT
180 public:
181         PrefCygwinPath(QWidget * parent = 0);
182         ~PrefCygwinPath() {}
183
184         void apply(LyXRC & rc) const;
185         void update(LyXRC const & rc);
186 };
187
188
189 class PrefDisplay :  public PrefModule, public Ui::QPrefDisplayUi
190 {
191         Q_OBJECT
192 public:
193         PrefDisplay(QWidget * parent = 0);
194         ~PrefDisplay() {}
195
196         void apply(LyXRC & rc) const;
197         void update(LyXRC const & rc);
198 };
199
200
201 class PrefPaths :  public PrefModule, public Ui::QPrefPathsUi
202 {
203         Q_OBJECT
204 public:
205         PrefPaths(QPrefs * form, QWidget * parent = 0);
206         ~PrefPaths() {}
207
208         void apply(LyXRC & rc) const;
209         void update(LyXRC const & rc);
210
211 private Q_SLOTS:
212         void select_templatedir();
213         void select_tempdir();
214         void select_backupdir();
215         void select_workingdir();
216         void select_lyxpipe();
217
218 };
219
220
221 class PrefSpellchecker :  public PrefModule, public Ui::QPrefSpellcheckerUi
222 {
223         Q_OBJECT
224 public:
225         PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
226         ~PrefSpellchecker() {}
227
228         void apply(LyXRC & rc) const;
229         void update(LyXRC const & rc);
230
231 private Q_SLOTS:
232         void select_dict();
233 };
234
235
236 class PrefConverters :  public PrefModule, public Ui::QPrefConvertersUi
237 {
238         Q_OBJECT
239 public:
240         PrefConverters(QPrefs * form, QWidget * parent = 0);
241         ~PrefConverters() {}
242
243         void apply(LyXRC & rc) const;
244         void update(LyXRC const & rc);
245
246 public Q_SLOTS:
247         void updateGui();
248
249 private Q_SLOTS:
250         void update_converter();
251         void switch_converter();
252         void converter_changed();
253         void remove_converter();
254         void on_cacheCB_stateChanged(int state);
255
256 private:
257         void updateButtons();
258 };
259
260
261 class PrefCopiers :  public PrefModule, public Ui::QPrefCopiersUi
262 {
263         Q_OBJECT
264 public:
265         PrefCopiers(QPrefs * form, QWidget * parent = 0);
266         ~PrefCopiers() {}
267
268         void apply(LyXRC & rc) const;
269         void update(LyXRC const & rc);
270
271         void update();
272
273 private Q_SLOTS:
274         void switch_copierLB(int nr);
275         void switch_copierCO(int nr);
276         void copiers_changed();
277         void new_copier();
278         void modify_copier();
279         void remove_copier();
280
281 private:
282         void updateButtons();
283 };
284
285
286 class PrefFileformats :  public PrefModule, public Ui::QPrefFileformatsUi
287 {
288         Q_OBJECT
289 public:
290         PrefFileformats(QPrefs * form, QWidget * parent = 0);
291         ~PrefFileformats() {}
292
293         void apply(LyXRC & rc) const;
294         void update(LyXRC const & rc);
295
296         void update();
297 Q_SIGNALS:
298         void formatsChanged();
299 private:
300         void updateButtons();
301
302 private Q_SLOTS:
303         void switch_format(int);
304         void fileformat_changed();
305         void new_format();
306         void modify_format();
307         void remove_format();
308 };
309
310
311 class PrefLanguage :  public PrefModule, public Ui::QPrefLanguageUi
312 {
313         Q_OBJECT
314 public:
315         PrefLanguage(QWidget * parent = 0);
316         ~PrefLanguage() {}
317
318         void apply(LyXRC & rc) const;
319         void update(LyXRC const & rc);
320
321 private:
322         std::vector<std::string> lang_;
323
324 };
325
326
327 class PrefPrinter :  public PrefModule, public Ui::QPrefPrinterUi
328 {
329         Q_OBJECT
330 public:
331         PrefPrinter(QWidget * parent = 0);
332         ~PrefPrinter() {}
333
334         void apply(LyXRC & rc) const;
335         void update(LyXRC const & rc);
336 };
337
338
339 class PrefUserInterface :  public PrefModule, public Ui::QPrefUi
340 {
341         Q_OBJECT
342 public:
343         PrefUserInterface(QPrefs * form, QWidget * parent = 0);
344         ~PrefUserInterface() {}
345
346         void apply(LyXRC & rc) const;
347         void update(LyXRC const & rc);
348
349 public Q_SLOTS:
350         void select_ui();
351         void select_bind();
352         void on_loadWindowSizeCB_toggled(bool);
353
354 };
355
356
357 class PrefIdentity :  public PrefModule, public Ui::QPrefIdentityUi
358 {
359         Q_OBJECT
360 public:
361         PrefIdentity(QWidget * parent = 0);
362         ~PrefIdentity() {}
363
364         void apply(LyXRC & rc) const;
365         void update(LyXRC const & rc);
366 };
367
368 ///
369 class QPrefsDialog : public QDialog, public Ui::QPrefsUi
370 {
371         Q_OBJECT
372 public:
373         QPrefsDialog(QPrefs *);
374
375         ~QPrefsDialog();
376
377         void apply(LyXRC & rc) const;
378         void updateRc(LyXRC const & rc);
379
380 public Q_SLOTS:
381         void change_adaptor();
382
383 protected:
384         void closeEvent(QCloseEvent * e);
385
386 private:
387         void add(PrefModule * module);
388
389 private:
390         QPrefs * form_;
391         std::vector<PrefModule *> modules_;
392 };
393
394 } // namespace frontend
395 } // namespace lyx
396
397 #endif // PREFSDIALOG_H