mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
GuiDocument: Further encoding GUI improvement
Move the odd "(no inputenc)" option out of the encoding list.
This commit is contained in:
parent
175711046d
commit
682eabbe8e
@ -937,6 +937,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(encodingSwitched(int)));
|
||||
connect(langModule->customEncodingCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(langModule->noInputencCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(langModule->languagePackageCO, SIGNAL(activated(int)),
|
||||
@ -962,9 +964,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
toqstr("auto-legacy"));
|
||||
langModule->encodingCO->addItem(qt_("ASCII"), toqstr("ascii"));
|
||||
langModule->encodingCO->addItem(qt_("Custom"), toqstr("custom"));
|
||||
// Always put the default encoding in the first position.
|
||||
langModule->customEncodingCO->addItem(qt_("Traditional (inputenc not loaded)"),
|
||||
toqstr("auto-legacy-plain"));
|
||||
|
||||
QMap<QString,QString> encodingmap;
|
||||
for (auto const & encvar : encodings) {
|
||||
if (!encvar.unsafe() && !encvar.guiName().empty())
|
||||
@ -2258,6 +2258,10 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
|
||||
langModule->encodingCO->itemData(
|
||||
langModule->encodingCO->currentIndex()).toString() == "custom");
|
||||
langModule->encodingCO->setEnabled(tex_fonts);
|
||||
langModule->noInputencCB->setEnabled(tex_fonts
|
||||
&& langModule->encodingCO->currentIndex() < 2);
|
||||
if (!tex_fonts)
|
||||
langModule->noInputencCB->setChecked(false);
|
||||
|
||||
fontModule->fontsDefaultCO->setEnabled(tex_fonts);
|
||||
fontModule->fontsDefaultLA->setEnabled(tex_fonts);
|
||||
@ -2280,6 +2284,11 @@ void GuiDocument::encodingSwitched(int i)
|
||||
langModule->customEncodingCO->setEnabled(
|
||||
!fontModule->osFontsCB->isChecked()
|
||||
&& langModule->encodingCO->itemData(i).toString() == "custom");
|
||||
langModule->noInputencCB->setEnabled(!fontModule->osFontsCB->isChecked()
|
||||
&& langModule->encodingCO->currentIndex() < 2);
|
||||
if (!langModule->noInputencCB->isEnabled())
|
||||
langModule->noInputencCB->setChecked(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3233,6 +3242,9 @@ void GuiDocument::applyView()
|
||||
else
|
||||
bp_.inputenc = fromqstr(langModule->customEncodingCO->itemData(
|
||||
langModule->customEncodingCO->currentIndex()).toString());
|
||||
if (langModule->noInputencCB->isChecked()
|
||||
&& (encoding == "auto-legacy" || encoding == "utf8"))
|
||||
bp_.inputenc += "-plain";
|
||||
|
||||
bp_.quotes_style = (InsetQuotesParams::QuoteStyle) langModule->quoteStyleCO->itemData(
|
||||
langModule->quoteStyleCO->currentIndex()).toInt();
|
||||
@ -3724,13 +3736,20 @@ void GuiDocument::paramsToDialog()
|
||||
langModule->quoteStyleCO->findData(bp_.quotes_style));
|
||||
langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
|
||||
|
||||
int p = langModule->encodingCO->findData(toqstr(bp_.inputenc));
|
||||
QString inputenc = toqstr(bp_.inputenc);
|
||||
bool plain = false;
|
||||
if (inputenc.endsWith("-plain")) {
|
||||
inputenc = inputenc.left(inputenc.lastIndexOf("-plain"));
|
||||
plain = true;
|
||||
}
|
||||
langModule->noInputencCB->setChecked(plain);
|
||||
int p = langModule->encodingCO->findData(inputenc);
|
||||
if (p != -1)
|
||||
langModule->encodingCO->setCurrentIndex(p);
|
||||
else {
|
||||
langModule->encodingCO->setCurrentIndex(
|
||||
langModule->encodingCO->findData("custom"));
|
||||
p = langModule->customEncodingCO->findData(toqstr(bp_.inputenc));
|
||||
p = langModule->customEncodingCO->findData(inputenc);
|
||||
if (p != -1)
|
||||
langModule->customEncodingCO->setCurrentIndex(p);
|
||||
else
|
||||
|
@ -79,6 +79,33 @@
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="customEncodingCO">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>If you selected a custom output encoding to the left, yo can specifiy it here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="languagePackageCO">
|
||||
<property name="toolTip">
|
||||
<string>Select which language package LyX should use</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="languagePackageLA">
|
||||
<property name="text">
|
||||
<string>Language pa&ckage:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>languagePackageCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="encodingLA">
|
||||
<property name="text">
|
||||
@ -102,37 +129,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="customEncodingCO">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="languagePackageLE">
|
||||
<property name="toolTip">
|
||||
<string>If you selected a custom output encoding to the left, yo can specifiy it here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="languagePackageLA">
|
||||
<property name="text">
|
||||
<string>Language pa&ckage:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>languagePackageCO</cstring>
|
||||
<string>Enter the command to load the language package (default: \usepackage{babel})</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="languagePackageCO">
|
||||
<widget class="QCheckBox" name="noInputencCB">
|
||||
<property name="toolTip">
|
||||
<string>Select which language package LyX should use</string>
|
||||
<string>If this is checked, LyX does not load the inputenc LaTeX package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="languagePackageLE">
|
||||
<property name="toolTip">
|
||||
<string>Enter the command to load the language package (default: \usepackage{babel})</string>
|
||||
<property name="text">
|
||||
<string>Do not load &inputenc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user