]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrefs.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiPrefs.cpp
index cae0dbc8127f3931d9d7e9955c8c98dd9f77a13d..4518838456d131f635df510acedb43869c3f44fb 100644 (file)
@@ -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));
@@ -1294,10 +1312,13 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
        setupUi(this);
 
 #if defined(USE_ASPELL)
-       spellcheckerCB->addItem("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("hunspell");
+       spellcheckerCB->addItem(qt_("hunspell"), QString("hunspell"));
 #endif
 
        if (theSpellChecker()) {
@@ -1323,7 +1344,8 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
 
 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();
@@ -1333,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);