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