]> git.lyx.org Git - features.git/blob - src/frontends/qt2/QPrefs.C
introduce namespace lyx::support
[features.git] / src / frontends / qt2 / QPrefs.C
1 /**
2  * \file QPrefs.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "support/lstrings.h"
14 #include "support/tostr.h"
15 #include "Lsstream.h"
16 #include <iomanip>
17
18 #include "ControlPrefs.h"
19 #include "QPrefsDialog.h"
20 #include "ui/QPrefAsciiModule.h"
21 #include "ui/QPrefDateModule.h"
22 #include "ui/QPrefKeyboardModule.h"
23 #include "ui/QPrefLatexModule.h"
24 #include "ui/QPrefScreenFontsModule.h"
25 #include "ui/QPrefColorsModule.h"
26 #include "ui/QPrefDisplayModule.h"
27 #include "ui/QPrefPathsModule.h"
28 #include "ui/QPrefSpellcheckerModule.h"
29 #include "ui/QPrefConvertersModule.h"
30 #include "ui/QPrefFileformatsModule.h"
31 #include "ui/QPrefLanguageModule.h"
32 #include "ui/QPrefPrinterModule.h"
33 #include "ui/QPrefUIModule.h"
34 #include "ui/QPrefIdentityModule.h"
35 #include "lyx_gui.h"
36 #include "QPrefs.h"
37 #include "Qt2BC.h"
38 #include "lyxrc.h"
39 #include "frnt_lang.h"
40 #include "helper_funcs.h"
41 #include "qt_helpers.h"
42 #include "lcolorcache.h"
43 #include "debug.h"
44
45 #include <boost/tuple/tuple.hpp>
46
47 #include <qpushbutton.h>
48 #include <qcheckbox.h>
49 #include <qlineedit.h>
50 #include <qspinbox.h>
51 #include <qcombobox.h>
52 #include <qlistbox.h>
53 #include <qlabel.h>
54 #include <qfontinfo.h>
55 #include "qcoloritem.h"
56
57 using namespace lyx::support;
58
59 using std::vector;
60 using std::pair;
61 using std::ostringstream;
62 using std::setfill;
63 using std::setw;
64 using std::endl;
65
66 typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
67
68
69 QPrefs::QPrefs()
70         : base_class(_("LyX: Preferences"))
71 {
72 }
73
74
75 void QPrefs::build_dialog()
76 {
77         dialog_.reset(new QPrefsDialog(this));
78
79         bcview().setOK(dialog_->savePB);
80         bcview().setApply(dialog_->applyPB);
81         bcview().setCancel(dialog_->closePB);
82         bcview().setRestore(dialog_->restorePB);
83
84         QPrefLanguageModule * langmod(dialog_->languageModule);
85
86         langmod->defaultLanguageCO->clear();
87         // store the lang identifiers for later
88         vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
89         lang_ = getSecond(langs);
90
91         vector<frnt::LanguagePair>::const_iterator lit  = langs.begin();
92         vector<frnt::LanguagePair>::const_iterator lend = langs.end();
93         for (; lit != lend; ++lit) {
94                 langmod->defaultLanguageCO->insertItem(toqstr(lit->first));
95         }
96
97         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
98         spellmod->spellCommandCO->insertItem(qt_("ispell"));
99         spellmod->spellCommandCO->insertItem(qt_("aspell"));
100         spellmod->spellCommandCO->insertItem(qt_("hspell"));
101 #ifdef USE_PSPELL
102         spellmod->spellCommandCO->insertItem(qt_("pspell (library)"));
103 #else
104 #ifdef USE_ASPELL
105         spellmod->spellCommandCO->insertItem(qt_("aspell (library)"));
106 #endif
107 #endif
108 }
109
110
111 void QPrefs::apply()
112 {
113         LyXRC & rc(controller().rc());
114
115         QPrefLanguageModule * langmod(dialog_->languageModule);
116
117         // FIXME: remove rtl_support bool
118         rc.rtl_support = langmod->rtlCB->isChecked();
119         rc.mark_foreign_language = langmod->markForeignCB->isChecked();
120         rc.language_auto_begin = langmod->autoBeginCB->isChecked();
121         rc.language_auto_end = langmod->autoEndCB->isChecked();
122         rc.language_use_babel = langmod->useBabelCB->isChecked();
123         rc.language_global_options = langmod->globalCB->isChecked();
124         rc.language_package = fromqstr(langmod->languagePackageED->text());
125         rc.language_command_begin = fromqstr(langmod->startCommandED->text());
126         rc.language_command_end = fromqstr(langmod->endCommandED->text());
127         rc.default_language = lang_[langmod->defaultLanguageCO->currentItem()];
128
129         QPrefUIModule * uimod(dialog_->uiModule);
130
131         rc.ui_file = fromqstr(uimod->uiFileED->text());
132         rc.bind_file = fromqstr(uimod->bindFileED->text());
133         rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked();
134         rc.wheel_jump = uimod->wheelMouseSB->value();
135         rc.autosave = uimod->autoSaveSB->value() * 60;
136         rc.make_backup = uimod->autoSaveCB->isChecked();
137         rc.num_lastfiles = uimod->lastfilesSB->value();
138
139
140         QPrefKeyboardModule * keymod(dialog_->keyboardModule);
141
142         // FIXME: can derive CB from the two EDs
143         rc.use_kbmap = keymod->keymapCB->isChecked();
144         rc.primary_kbmap = fromqstr(keymod->firstKeymapED->text());
145         rc.secondary_kbmap = fromqstr(keymod->secondKeymapED->text());
146
147
148         QPrefAsciiModule * ascmod(dialog_->asciiModule);
149
150         rc.ascii_linelen = ascmod->asciiLinelengthSB->value();
151         rc.ascii_roff_command = fromqstr(ascmod->asciiRoffED->text());
152
153
154         QPrefDateModule * datemod(dialog_->dateModule);
155
156         rc.date_insert_format = fromqstr(datemod->DateED->text());
157
158
159         QPrefLatexModule * latexmod(dialog_->latexModule);
160
161         rc.fontenc = fromqstr(latexmod->latexEncodingED->text());
162         rc.chktex_command = fromqstr(latexmod->latexChecktexED->text());
163         rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
164         rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text());
165         rc.default_papersize =
166                 static_cast<BufferParams::PAPER_SIZE>(latexmod->latexPaperSizeCO->currentItem());
167
168
169         QPrefDisplayModule * displaymod(dialog_->displayModule);
170
171         rc.preview = displaymod->previewCB->isChecked();
172
173         grfx::DisplayType dtype(grfx::ColorDisplay);
174
175         switch (displaymod->displayGraphicsCO->currentItem()) {
176                 case 3: dtype = grfx::NoDisplay; break;
177                 case 2: dtype = grfx::ColorDisplay; break;
178                 case 1: dtype = grfx::GrayscaleDisplay; break;
179                 case 0: dtype = grfx::MonochromeDisplay; break;
180         }
181         rc.display_graphics = dtype;
182
183 #ifdef WITH_WARNINGS
184 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
185 #endif
186 #if 0
187         if (old_value != rc.display_graphics) {
188                 grfx::GCache & gc = grfx::GCache::get();
189                 gc.changeDisplay();
190         }
191 #endif
192
193         QPrefPathsModule * pathsmod(dialog_->pathsModule);
194
195         rc.document_path = fromqstr(pathsmod->workingDirED->text());
196         rc.template_path = fromqstr(pathsmod->templateDirED->text());
197         rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
198         rc.use_tempdir = pathsmod->tempDirCB->isChecked();
199         rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
200         // FIXME: should be a checkbox only
201         rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
202
203
204         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
205
206         switch (spellmod->spellCommandCO->currentItem()) {
207                 case 0:
208                 case 1:
209                 case 2:
210                         rc.use_spell_lib = false;
211                         rc.isp_command = fromqstr(spellmod->spellCommandCO->currentText());
212                         break;
213                 case 3:
214                         rc.use_spell_lib = true;
215                         break;
216         }
217
218         // FIXME: remove isp_use_alt_lang
219         rc.isp_alt_lang = fromqstr(spellmod->altLanguageED->text());
220         rc.isp_use_alt_lang = !rc.isp_alt_lang.empty();
221         // FIXME: remove isp_use_esc_chars
222         rc.isp_esc_chars = fromqstr(spellmod->escapeCharactersED->text());
223         rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
224         // FIXME: remove isp_use_pers_dict
225         rc.isp_pers_dict = fromqstr(spellmod->persDictionaryED->text());
226         rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
227         rc.isp_accept_compound = spellmod->compoundWordCB->isChecked();
228         rc.isp_use_input_encoding = spellmod->inputEncodingCB->isChecked();
229
230
231         QPrefPrinterModule * printmod(dialog_->printerModule);
232
233         rc.print_adapt_output = printmod->printerAdaptCB->isChecked();
234         rc.print_command = fromqstr(printmod->printerCommandED->text());
235         rc.printer = fromqstr(printmod->printerNameED->text());
236
237         rc.print_pagerange_flag = fromqstr(printmod->printerPageRangeED->text());
238         rc.print_copies_flag = fromqstr(printmod->printerCopiesED->text());
239         rc.print_reverse_flag = fromqstr(printmod->printerReverseED->text());
240         rc.print_to_printer = fromqstr(printmod->printerToPrinterED->text());
241         rc.print_file_extension = fromqstr(printmod->printerExtensionED->text());
242         rc.print_spool_command = fromqstr(printmod->printerSpoolCommandED->text());
243         rc.print_paper_flag = fromqstr(printmod->printerPaperTypeED->text());
244         rc.print_evenpage_flag = fromqstr(printmod->printerEvenED->text());
245         rc.print_oddpage_flag = fromqstr(printmod->printerOddED->text());
246         rc.print_collcopies_flag = fromqstr(printmod->printerCollatedED->text());
247         rc.print_landscape_flag = fromqstr(printmod->printerLandscapeED->text());
248         rc.print_to_file = fromqstr(printmod->printerToFileED->text());
249         rc.print_extra_options = fromqstr(printmod->printerExtraED->text());
250         rc.print_spool_printerprefix = fromqstr(printmod->printerSpoolPrefixED->text());
251         rc.print_paper_dimension_flag = fromqstr(printmod->printerPaperSizeED->text());
252
253
254         QPrefIdentityModule * idmod(dialog_->identityModule);
255         rc.user_name = fromqstr(idmod->nameED->text());
256         rc.user_email = fromqstr(idmod->emailED->text());
257
258         QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
259
260         LyXRC const oldrc(rc);
261
262         boost::tie(rc.roman_font_name, rc.roman_font_foundry)
263                 = parseFontName(fromqstr(fontmod->screenRomanCO->currentText()));
264         boost::tie(rc.sans_font_name, rc.sans_font_foundry) =
265                 parseFontName(fromqstr(fontmod->screenSansCO->currentText()));
266         boost::tie(rc.typewriter_font_name, rc.typewriter_font_foundry) =
267                 parseFontName(fromqstr(fontmod->screenTypewriterCO->currentText()));
268
269         rc.zoom = fontmod->screenZoomSB->value();
270         rc.dpi = fontmod->screenDpiSB->value();
271         rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fromqstr(fontmod->screenTinyED->text()));
272         rc.font_sizes[LyXFont::SIZE_SCRIPT] = strToDbl(fromqstr(fontmod->screenSmallestED->text()));
273         rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = strToDbl(fromqstr(fontmod->screenSmallerED->text()));
274         rc.font_sizes[LyXFont::SIZE_SMALL] = strToDbl(fromqstr(fontmod->screenSmallED->text()));
275         rc.font_sizes[LyXFont::SIZE_NORMAL] = strToDbl(fromqstr(fontmod->screenNormalED->text()));
276         rc.font_sizes[LyXFont::SIZE_LARGE] = strToDbl(fromqstr(fontmod->screenLargeED->text()));
277         rc.font_sizes[LyXFont::SIZE_LARGER] = strToDbl(fromqstr(fontmod->screenLargerED->text()));
278         rc.font_sizes[LyXFont::SIZE_LARGEST] = strToDbl(fromqstr(fontmod->screenLargestED->text()));
279         rc.font_sizes[LyXFont::SIZE_HUGE] = strToDbl(fromqstr(fontmod->screenHugeED->text()));
280         rc.font_sizes[LyXFont::SIZE_HUGER] = strToDbl(fromqstr(fontmod->screenHugerED->text()));
281
282         if (rc.font_sizes != oldrc.font_sizes
283                 || rc.roman_font_name != oldrc.roman_font_name
284                 || rc.sans_font_name != oldrc.sans_font_name
285                 || rc.typewriter_font_name != oldrc.typewriter_font_name
286                 || rc.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) {
287                 controller().updateScreenFonts();
288         }
289
290         controller().setFormats(formats_);
291         controller().setConverters(converters_);
292
293         QPrefColorsModule * colmod(dialog_->colorsModule);
294
295         unsigned int i;
296
297         for (i = 0; i < colmod->lyxObjectsLB->count(); ++i) {
298                 QListBoxItem * ib(colmod->lyxObjectsLB->item(i));
299                 QColorItem * ci(static_cast<QColorItem*>(ib));
300
301                 LColor::color const col(dialog_->colors_[i]);
302                 QColor const & qcol(lcolorcache.get(col));
303
304                 // FIXME: dubious, but it's what xforms does
305                 if (qcol != ci->color()) {
306                         ostringstream ostr;
307
308                         ostr << '#' << std::setbase(16) << setfill('0')
309                              << setw(2) << ci->color().red()
310                              << setw(2) << ci->color().green()
311                              << setw(2) << ci->color().blue();
312
313                         string newhex(STRCONV(ostr.str()));
314                         controller().setColor(col, newhex);
315                 }
316         }
317 }
318
319
320 // FIXME: move to helper_funcs.h
321 namespace {
322
323 template<class A>
324 typename std::vector<A>::size_type
325 findPos(std::vector<A> const & vec, A const & val)
326 {
327         typename std::vector<A>::const_iterator it =
328                 std::find(vec.begin(), vec.end(), val);
329         if (it == vec.end())
330                 return 0;
331         return std::distance(vec.begin(), it);
332 }
333
334 void setComboxFont(QComboBox * cb, string const & family, string const & foundry)
335 {
336         string const name = makeFontName(family, foundry);
337         for (int i = 0; i < cb->count(); ++i) {
338                 if (fromqstr(cb->text(i)) == name) {
339                         cb->setCurrentItem(i);
340                         return;
341                 }
342         }
343
344         // Try matching without foundary name
345
346         // We count in reverse in order to prefer the Xft foundry
347         for (int i = cb->count() - 1; i >= 0; --i) {
348                 pair<string, string> tmp = parseFontName(fromqstr(cb->text(i)));
349                 if (compare_no_case(tmp.first, family) == 0) {
350                         cb->setCurrentItem(i);
351                         return;
352                 }
353         }
354
355         // Bleh, default fonts, and the names couldn't be found. Hack
356         // for bug 1063. Qt makes baby Jesus cry.
357
358         QFont font;
359
360         if (family == lyx_gui::roman_font_name()) {
361                 font.setStyleHint(QFont::Serif);
362                 font.setFamily(lyx_gui::roman_font_name().c_str());
363         } else if (family == lyx_gui::sans_font_name()) {
364                 font.setStyleHint(QFont::SansSerif);
365                 font.setFamily(lyx_gui::sans_font_name().c_str());
366         } else if (family == lyx_gui::typewriter_font_name()) {
367                 font.setStyleHint(QFont::TypeWriter);
368                 font.setFamily(lyx_gui::typewriter_font_name().c_str());
369         } else {
370                 lyxerr << "FAILED to find the default font !"
371                         << foundry << ", " << family << endl;
372                 return;
373         }
374
375         QFontInfo info(font);
376         lyxerr << "Apparent font is " << info.family() << endl;
377
378         for (int i = 0; i < cb->count(); ++i) {
379                 lyxerr << "Looking at " << fromqstr(cb->text(i)) << endl;
380                 if (compare_no_case(cb->text(i).latin1(), info.family().latin1()) == 0) {
381                         cb->setCurrentItem(i);
382                         return;
383                 }
384         }
385
386         lyxerr << "FAILED to find the font !"
387                 << foundry << ", " << family << endl;
388 }
389
390 } // end namespace anon
391
392
393 void QPrefs::update_contents()
394 {
395         LyXRC const & rc(controller().rc());
396
397         QPrefLanguageModule * langmod(dialog_->languageModule);
398
399         // FIXME: remove rtl_support bool
400         langmod->rtlCB->setChecked(rc.rtl_support);
401         langmod->markForeignCB->setChecked(rc.mark_foreign_language);
402         langmod->autoBeginCB->setChecked(rc.language_auto_begin);
403         langmod->autoEndCB->setChecked(rc.language_auto_end);
404         langmod->useBabelCB->setChecked(rc.language_use_babel);
405         langmod->globalCB->setChecked(rc.language_global_options);
406         langmod->languagePackageED->setText(toqstr(rc.language_package));
407         langmod->startCommandED->setText(toqstr(rc.language_command_begin));
408         langmod->endCommandED->setText(toqstr(rc.language_command_end));
409
410         int const pos = int(findPos(lang_, rc.default_language));
411         langmod->defaultLanguageCO->setCurrentItem(pos);
412
413         QPrefUIModule * uimod(dialog_->uiModule);
414
415         uimod->uiFileED->setText(toqstr(rc.ui_file));
416         uimod->bindFileED->setText(toqstr(rc.bind_file));
417         uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
418         uimod->wheelMouseSB->setValue(rc.wheel_jump);
419         // convert to minutes
420         int mins(rc.autosave / 60);
421         if (rc.autosave && !mins)
422                 mins = 1;
423         uimod->autoSaveSB->setValue(mins);
424         uimod->autoSaveCB->setChecked(rc.make_backup);
425         uimod->lastfilesSB->setValue(rc.num_lastfiles);
426
427
428         QPrefIdentityModule * idmod(dialog_->identityModule);
429         idmod->nameED->setText(toqstr(rc.user_name));
430         idmod->emailED->setText(toqstr(rc.user_email));
431
432
433         QPrefKeyboardModule * keymod(dialog_->keyboardModule);
434
435         // FIXME: can derive CB from the two EDs
436         keymod->keymapCB->setChecked(rc.use_kbmap);
437         // no idea why we need these. Fscking Qt.
438         keymod->firstKeymapED->setEnabled(rc.use_kbmap);
439         keymod->firstKeymapPB->setEnabled(rc.use_kbmap);
440         keymod->firstKeymapLA->setEnabled(rc.use_kbmap);
441         keymod->secondKeymapED->setEnabled(rc.use_kbmap);
442         keymod->secondKeymapPB->setEnabled(rc.use_kbmap);
443         keymod->secondKeymapLA->setEnabled(rc.use_kbmap);
444         keymod->firstKeymapED->setText(toqstr(rc.primary_kbmap));
445         keymod->secondKeymapED->setText(toqstr(rc.secondary_kbmap));
446
447
448         QPrefAsciiModule * ascmod(dialog_->asciiModule);
449
450         ascmod->asciiLinelengthSB->setValue(rc.ascii_linelen);
451         ascmod->asciiRoffED->setText(toqstr(rc.ascii_roff_command));
452
453
454         QPrefDateModule * datemod(dialog_->dateModule);
455
456         datemod->DateED->setText(toqstr(rc.date_insert_format));
457
458
459         QPrefLatexModule * latexmod(dialog_->latexModule);
460
461         latexmod->latexEncodingED->setText(toqstr(rc.fontenc));
462         latexmod->latexChecktexED->setText(toqstr(rc.chktex_command));
463         latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options);
464         latexmod->latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
465         latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize);
466
467
468         QPrefDisplayModule * displaymod(dialog_->displayModule);
469
470         displaymod->previewCB->setChecked(rc.preview);
471
472         int item = 2;
473
474         switch (rc.display_graphics) {
475                 case grfx::NoDisplay:           item = 3; break;
476                 case grfx::ColorDisplay:        item = 2; break;
477                 case grfx::GrayscaleDisplay:    item = 1; break;
478                 case grfx::MonochromeDisplay:   item = 0; break;
479                 default: break;
480         }
481         displaymod->displayGraphicsCO->setCurrentItem(item);
482
483
484         QPrefPathsModule * pathsmod(dialog_->pathsModule);
485
486         pathsmod->workingDirED->setText(toqstr(rc.document_path));
487         pathsmod->templateDirED->setText(toqstr(rc.template_path));
488         pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
489         pathsmod->tempDirCB->setChecked(rc.use_tempdir);
490         pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
491         // FIXME: should be a checkbox only
492         pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
493
494
495         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
496
497         spellmod->spellCommandCO->setCurrentItem(0);
498
499         if (rc.isp_command == "ispell") {
500                 spellmod->spellCommandCO->setCurrentItem(0);
501         } else if (rc.isp_command == "aspell") {
502                 spellmod->spellCommandCO->setCurrentItem(1);
503         } else if (rc.isp_command == "hspell") {
504                 spellmod->spellCommandCO->setCurrentItem(2);
505         }
506
507         if (rc.use_spell_lib) {
508 #if defined(USE_ASPELL) || defined(USE_PSPELL)
509                 spellmod->spellCommandCO->setCurrentItem(3);
510 #endif
511         }
512
513         // FIXME: remove isp_use_alt_lang
514         spellmod->altLanguageED->setText(toqstr(rc.isp_alt_lang));
515         // FIXME: remove isp_use_esc_chars
516         spellmod->escapeCharactersED->setText(toqstr(rc.isp_esc_chars));
517         // FIXME: remove isp_use_pers_dict
518         spellmod->persDictionaryED->setText(toqstr(rc.isp_pers_dict));
519         spellmod->compoundWordCB->setChecked(rc.isp_accept_compound);
520         spellmod->inputEncodingCB->setChecked(rc.isp_use_input_encoding);
521
522
523         QPrefPrinterModule * printmod(dialog_->printerModule);
524
525         printmod->printerAdaptCB->setChecked(rc.print_adapt_output);
526         printmod->printerCommandED->setText(toqstr(rc.print_command));
527         printmod->printerNameED->setText(toqstr(rc.printer));
528
529         printmod->printerPageRangeED->setText(toqstr(rc.print_pagerange_flag));
530         printmod->printerCopiesED->setText(toqstr(rc.print_copies_flag));
531         printmod->printerReverseED->setText(toqstr(rc.print_reverse_flag));
532         printmod->printerToPrinterED->setText(toqstr(rc.print_to_printer));
533         printmod->printerExtensionED->setText(toqstr(rc.print_file_extension));
534         printmod->printerSpoolCommandED->setText(toqstr(rc.print_spool_command));
535         printmod->printerPaperTypeED->setText(toqstr(rc.print_paper_flag));
536         printmod->printerEvenED->setText(toqstr(rc.print_evenpage_flag));
537         printmod->printerOddED->setText(toqstr(rc.print_oddpage_flag));
538         printmod->printerCollatedED->setText(toqstr(rc.print_collcopies_flag));
539         printmod->printerLandscapeED->setText(toqstr(rc.print_landscape_flag));
540         printmod->printerToFileED->setText(toqstr(rc.print_to_file));
541         printmod->printerExtraED->setText(toqstr(rc.print_extra_options));
542         printmod->printerSpoolPrefixED->setText(toqstr(rc.print_spool_printerprefix));
543         printmod->printerPaperSizeED->setText(toqstr(rc.print_paper_dimension_flag));
544
545
546         QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
547
548         setComboxFont(fontmod->screenRomanCO, rc.roman_font_name,
549                         rc.roman_font_foundry);
550         setComboxFont(fontmod->screenSansCO, rc.sans_font_name,
551                         rc.sans_font_foundry);
552         setComboxFont(fontmod->screenTypewriterCO, rc.typewriter_font_name,
553                         rc.typewriter_font_foundry);
554
555         dialog_->select_roman(fontmod->screenRomanCO->currentText());
556         dialog_->select_sans(fontmod->screenSansCO->currentText());
557         dialog_->select_typewriter(fontmod->screenTypewriterCO->currentText());
558
559         fontmod->screenZoomSB->setValue(rc.zoom);
560         fontmod->screenDpiSB->setValue(int(rc.dpi));
561         fontmod->screenTinyED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_TINY])));
562         fontmod->screenSmallestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT])));
563         fontmod->screenSmallerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE])));
564         fontmod->screenSmallED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SMALL])));
565         fontmod->screenNormalED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_NORMAL])));
566         fontmod->screenLargeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGE])));
567         fontmod->screenLargerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGER])));
568         fontmod->screenLargestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGEST])));
569         fontmod->screenHugeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGE])));
570         fontmod->screenHugerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGER])));
571
572         formats_ = formats;
573
574         dialog_->updateFormats();
575
576         converters_ = converters;
577
578         dialog_->updateConverters();
579 }