X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiPrefs.cpp;h=4518838456d131f635df510acedb43869c3f44fb;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=1f58ba17cb2ed8dd72f5931c9af506284239f886;hpb=0e6b1220dee50b7b31de4af83ff1f5c669f54c3f;p=lyx.git diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 1f58ba17cb..4518838456 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -590,6 +590,8 @@ PrefLatex::PrefLatex(GuiPreferences * form) : PrefModule(qt_(catOutput), qt_("LaTeX"), form) { setupUi(this); + connect(latexEncodingCB, SIGNAL(clicked()), + this, SIGNAL(changed())); connect(latexEncodingED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); connect(latexChecktexED, SIGNAL(textChanged(QString)), @@ -623,6 +625,12 @@ PrefLatex::PrefLatex(GuiPreferences * form) } +void PrefLatex::on_latexEncodingCB_stateChanged(int state) +{ + latexEncodingED->setEnabled(state == Qt::Checked); +} + + void PrefLatex::on_latexBibtexCO_activated(int n) { QString const bibtex = latexBibtexCO->itemData(n).toString(); @@ -699,7 +707,10 @@ void PrefLatex::apply(LyXRC & rc) const else rc.index_command = fromqstr(index) + " " + fromqstr(idxopt); - rc.fontenc = fromqstr(latexEncodingED->text()); + if (latexEncodingCB->isChecked()) + rc.fontenc = fromqstr(latexEncodingED->text()); + else + rc.fontenc = "default"; rc.chktex_command = fromqstr(latexChecktexED->text()); rc.jbibtex_command = fromqstr(latexJBibtexED->text()); rc.jindex_command = fromqstr(latexJIndexED->text()); @@ -770,7 +781,14 @@ void PrefLatex::update(LyXRC const & rc) latexIndexOptionsLA->setText(qt_("Co&mmand:")); } - latexEncodingED->setText(toqstr(rc.fontenc)); + if (rc.fontenc == "default") { + latexEncodingCB->setChecked(false); + latexEncodingED->setEnabled(false); + } else { + latexEncodingCB->setChecked(true); + latexEncodingED->setEnabled(true); + latexEncodingED->setText(toqstr(rc.fontenc)); + } latexChecktexED->setText(toqstr(rc.chktex_command)); latexJBibtexED->setText(toqstr(rc.jbibtex_command)); latexJIndexED->setText(toqstr(rc.jindex_command)); @@ -1142,28 +1160,39 @@ PrefPaths::PrefPaths(GuiPreferences * form) : PrefModule(QString(), qt_("Paths"), form) { setupUi(this); - connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir())); - connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir())); - connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir())); - connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir())); + connect(workingDirPB, SIGNAL(clicked()), this, SLOT(selectWorkingdir())); - connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe())); - connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir())); - connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir())); connect(workingDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); - connect(exampleDirED, SIGNAL(textChanged(QString)), - this, SIGNAL(changed())); + + connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir())); connect(templateDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); - connect(backupDirED, SIGNAL(textChanged(QString)), + + connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir())); + connect(exampleDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); - connect(tempDirED, SIGNAL(textChanged(QString)), + + connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir())); + connect(backupDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + + connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe())); connect(lyxserverDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + + connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir())); connect(thesaurusDirED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + + connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir())); + connect(tempDirED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + + connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir())); + connect(hunspellDirED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + connect(pathPrefixED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); } @@ -1282,25 +1311,41 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form) { setupUi(this); - spellcheckerCB->addItem("aspell"); - spellcheckerCB->addItem("hunspell"); +#if defined(USE_ASPELL) + spellcheckerCB->addItem(qt_("aspell"), QString("aspell")); +#endif +#if defined(USE_ENCHANT) + spellcheckerCB->addItem(qt_("enchant"), QString("enchant")); +#endif +#if defined(USE_HUNSPELL) + spellcheckerCB->addItem(qt_("hunspell"), QString("hunspell")); +#endif - connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)), - this, SIGNAL(changed())); - connect(altLanguageED, SIGNAL(textChanged(QString)), - this, SIGNAL(changed())); - connect(escapeCharactersED, SIGNAL(textChanged(QString)), - this, SIGNAL(changed())); - connect(compoundWordCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(spellcheckContinuouslyCB, SIGNAL(clicked()), - this, SIGNAL(changed())); + if (theSpellChecker()) { + connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)), + this, SIGNAL(changed())); + connect(altLanguageED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + connect(escapeCharactersED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); + connect(compoundWordCB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(spellcheckContinuouslyCB, SIGNAL(clicked()), + this, SIGNAL(changed())); + } else { + spellcheckerCB->setEnabled(false); + altLanguageED->setEnabled(false); + escapeCharactersED->setEnabled(false); + compoundWordCB->setEnabled(false); + spellcheckContinuouslyCB->setEnabled(false); + } } void PrefSpellchecker::apply(LyXRC & rc) const { - rc.spellchecker = fromqstr(spellcheckerCB->currentText()); + rc.spellchecker = fromqstr(spellcheckerCB->itemData( + spellcheckerCB->currentIndex()).toString()); rc.spellchecker_alt_lang = fromqstr(altLanguageED->text()); rc.spellchecker_esc_chars = fromqstr(escapeCharactersED->text()); rc.spellchecker_accept_compound = compoundWordCB->isChecked(); @@ -1310,8 +1355,8 @@ void PrefSpellchecker::apply(LyXRC & rc) const void PrefSpellchecker::update(LyXRC const & rc) { - spellcheckerCB->setCurrentIndex(spellcheckerCB->findText( - toqstr(rc.spellchecker))); + spellcheckerCB->setCurrentIndex( + spellcheckerCB->findData(toqstr(rc.spellchecker))); altLanguageED->setText(toqstr(rc.spellchecker_alt_lang)); escapeCharactersED->setText(toqstr(rc.spellchecker_esc_chars)); compoundWordCB->setChecked(rc.spellchecker_accept_compound); @@ -1685,8 +1730,8 @@ void PrefFileformats::update(LyXRC const & rc) bool const init = defaultFormatCB->currentText().isEmpty(); updateView(); if (init) { - int const pos = defaultFormatCB->findData(toqstr( - rc.default_view_format)); + int const pos = + defaultFormatCB->findData(toqstr(rc.default_view_format)); defaultFormatCB->setCurrentIndex(pos); } } @@ -1859,10 +1904,12 @@ namespace { void PrefFileformats::updateViewers() { Format const f = currentFormat(); + viewerCO->blockSignals(true); viewerCO->clear(); viewerCO->addItem(qt_("None"), QString()); updateComboBox(viewer_alternatives, f.name(), viewerCO); viewerCO->addItem(qt_("Custom"), QString("custom viewer")); + viewerCO->blockSignals(false); int pos = viewerCO->findData(toqstr(f.viewer())); if (pos != -1) { @@ -1880,10 +1927,12 @@ void PrefFileformats::updateViewers() void PrefFileformats::updateEditors() { Format const f = currentFormat(); + editorCO->blockSignals(true); editorCO->clear(); editorCO->addItem(qt_("None"), QString()); updateComboBox(editor_alternatives, f.name(), editorCO); editorCO->addItem(qt_("Custom"), QString("custom editor")); + editorCO->blockSignals(false); int pos = editorCO->findData(toqstr(f.editor())); if (pos != -1) { @@ -1912,7 +1961,7 @@ void PrefFileformats::on_editorCO_currentIndexChanged(int i) bool const custom = editorCO->itemData(i).toString() == "custom editor"; editorED->setEnabled(custom); if (!custom) - currentFormat().setViewer(fromqstr(editorCO->itemData(i).toString())); + currentFormat().setEditor(fromqstr(editorCO->itemData(i).toString())); }