#include <iomanip>
#include <sstream>
#include <algorithm>
+#include <math.h>
using namespace Ui;
lastPath = fallback_dir;
FileDialog dlg(title);
- dlg.setButton2(label1, dir1);
+ dlg.setButton1(label1, dir1);
dlg.setButton2(label2, dir2);
FileDialog::Result result;
this, SIGNAL(changed()));
connect(latexBibtexED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ connect(latexJBibtexCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
connect(latexJBibtexED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(latexIndexCO, SIGNAL(activated(int)),
QString const bibtex = latexBibtexCO->itemData(n).toString();
if (bibtex.isEmpty()) {
latexBibtexED->clear();
- latexBibtexOptionsLA->setText(qt_("Co&mmand:"));
+ latexBibtexOptionsLA->setText(qt_("C&ommand:"));
return;
}
for (LyXRC::CommandSet::const_iterator it = bibtex_alternatives.begin();
}
+void PrefLatex::on_latexJBibtexCO_activated(int n)
+{
+ QString const jbibtex = latexJBibtexCO->itemData(n).toString();
+ if (jbibtex.isEmpty()) {
+ latexJBibtexED->clear();
+ latexJBibtexOptionsLA->setText(qt_("Co&mmand:"));
+ return;
+ }
+ for (LyXRC::CommandSet::const_iterator it = jbibtex_alternatives.begin();
+ it != jbibtex_alternatives.end(); ++it) {
+ QString const bib = toqstr(*it);
+ int ind = bib.indexOf(" ");
+ QString sel_command = bib.left(ind);
+ QString sel_options = ind < 0 ? QString() : bib.mid(ind + 1);
+ if (jbibtex == sel_command) {
+ if (ind < 0)
+ latexJBibtexED->clear();
+ else
+ latexJBibtexED->setText(sel_options.trimmed());
+ }
+ }
+ latexJBibtexOptionsLA->setText(qt_("Opt&ions:"));
+}
+
+
void PrefLatex::on_latexIndexCO_activated(int n)
{
QString const index = latexIndexCO->itemData(n).toString();
else
rc.bibtex_command = fromqstr(bibtex) + " " + fromqstr(bibopt);
+ // If jbibtex is not empty, jbibopt contains the options, otherwise
+ // it is a customized bibtex command with options.
+ QString const jbibtex = latexJBibtexCO->itemData(
+ latexJBibtexCO->currentIndex()).toString();
+ QString const jbibopt = latexJBibtexED->text();
+ if (jbibtex.isEmpty())
+ rc.jbibtex_command = fromqstr(jbibopt);
+ else if (jbibopt.isEmpty())
+ rc.jbibtex_command = fromqstr(jbibtex);
+ else
+ rc.jbibtex_command = fromqstr(jbibtex) + " " + fromqstr(jbibopt);
+
// If index is not empty, idxopt contains the options, otherwise
// it is a customized index command with options.
QString const index = latexIndexCO->itemData(
else
rc.fontenc = "default";
rc.chktex_command = fromqstr(latexChecktexED->text());
- rc.jbibtex_command = fromqstr(latexJBibtexED->text());
rc.jindex_command = fromqstr(latexJIndexED->text());
rc.nomencl_command = fromqstr(latexNomenclED->text());
rc.auto_reset_options = latexAutoresetCB->isChecked();
{
latexBibtexCO->clear();
+ latexBibtexCO->addItem(qt_("Automatic"), "automatic");
latexBibtexCO->addItem(qt_("Custom"), QString());
for (LyXRC::CommandSet::const_iterator it = rc.bibtex_alternatives.begin();
it != rc.bibtex_alternatives.end(); ++it) {
} else {
latexBibtexED->setText(toqstr(rc.bibtex_command));
latexBibtexCO->setCurrentIndex(0);
- latexBibtexOptionsLA->setText(qt_("Co&mmand:"));
+ latexBibtexOptionsLA->setText(qt_("C&ommand:"));
+ }
+
+ latexJBibtexCO->clear();
+
+ latexJBibtexCO->addItem(qt_("Automatic"), "automatic");
+ latexJBibtexCO->addItem(qt_("Custom"), QString());
+ for (LyXRC::CommandSet::const_iterator it = rc.jbibtex_alternatives.begin();
+ it != rc.jbibtex_alternatives.end(); ++it) {
+ QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
+ latexJBibtexCO->addItem(command, command);
+ }
+
+ jbibtex_alternatives = rc.jbibtex_alternatives;
+
+ QString const jbib = toqstr(rc.jbibtex_command);
+ ind = jbib.indexOf(" ");
+ sel_command = jbib.left(ind);
+ sel_options = ind < 0 ? QString() : jbib.mid(ind + 1);
+
+ pos = latexJBibtexCO->findData(sel_command);
+ if (pos != -1) {
+ latexJBibtexCO->setCurrentIndex(pos);
+ latexJBibtexED->setText(sel_options.trimmed());
+ latexJBibtexOptionsLA->setText(qt_("Opt&ions:"));
+ } else {
+ latexJBibtexED->setText(toqstr(rc.bibtex_command));
+ latexJBibtexCO->setCurrentIndex(0);
+ latexJBibtexOptionsLA->setText(qt_("Co&mmand:"));
}
latexIndexCO->clear();
latexEncodingED->setText(toqstr(rc.fontenc));
}
latexChecktexED->setText(toqstr(rc.chktex_command));
- latexJBibtexED->setText(toqstr(rc.jbibtex_command));
latexJIndexED->setText(toqstr(rc.jindex_command));
latexNomenclED->setText(toqstr(rc.nomencl_command));
latexAutoresetCB->setChecked(rc.auto_reset_options);
parseFontName(screenTypewriterCO->currentText(),
rc.typewriter_font_name, rc.typewriter_font_foundry);
- rc.zoom = screenZoomSB->value();
+ rc.defaultZoom = screenZoomSB->value();
rc.font_sizes[FONT_SIZE_TINY] = widgetToDoubleStr(screenTinyED);
rc.font_sizes[FONT_SIZE_SCRIPT] = widgetToDoubleStr(screenSmallestED);
rc.font_sizes[FONT_SIZE_FOOTNOTE] = widgetToDoubleStr(screenSmallerED);
|| rc.roman_font_name != oldrc.roman_font_name
|| rc.sans_font_name != oldrc.sans_font_name
|| rc.typewriter_font_name != oldrc.typewriter_font_name
- || rc.zoom != oldrc.zoom) {
+ || rc.defaultZoom != oldrc.defaultZoom) {
// The global QPixmapCache is used in GuiPainter to cache text
// painting so we must reset it in case any of the above
// parameter is changed.
selectSans(screenSansCO->currentText());
selectTypewriter(screenTypewriterCO->currentText());
- screenZoomSB->setValue(rc.zoom);
+ screenZoomSB->setValue(rc.defaultZoom);
updateScreenFontSizes(rc);
pixmapCacheCB->setChecked(rc.use_pixmap_cache);
#if defined(Q_WS_X11) || defined(QPA_XCB)
pixmapCacheCB->setEnabled(false);
#endif
-
+ pixmapCacheCB->hide();
}
{
for (int row = 0 ; row < lyxObjectsLW->count() ; ++row) {
// skip colors that are taken from system palette
- bool const hide = syscolorsCB->isChecked()
+ bool const disable = syscolorsCB->isChecked()
&& guiApp->colorCache().isSystem(lcolors_[row]);
- lyxObjectsLW->item(row)->setHidden(hide);
- }
+ QListWidgetItem * const item = lyxObjectsLW->item(row);
+ Qt::ItemFlags const flags = item->flags();
+ if (disable)
+ item->setFlags(flags & ~Qt::ItemIsEnabled);
+ else
+ item->setFlags(flags | Qt::ItemIsEnabled);
+ }
}
void PrefColors::changeLyxObjectsSelection()
this, SIGNAL(changed()));
connect(needauthForbiddenCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
- connect(needauthCB, SIGNAL(toggled(bool)),
- this, SIGNAL(changed()));
converterED->setValidator(new NoNewLineValidator(converterED));
converterFlagED->setValidator(new NoNewLineValidator(converterFlagED));
- maxAgeLE->setValidator(new QDoubleValidator(maxAgeLE));
+ maxAgeLE->setValidator(new QDoubleValidator(0, HUGE_VAL, 6, maxAgeLE));
//converterDefGB->setFocusProxy(convertersLW);
}
}
+static void setCheckboxBlockSignals(QCheckBox *cb, bool checked) {
+ cb->blockSignals(true);
+ cb->setChecked(checked);
+ cb->blockSignals(false);
+}
+
+
void PrefConverters::updateRC(LyXRC const & rc)
{
cacheCB->setChecked(rc.use_converter_cache);
needauthForbiddenCB->setChecked(rc.use_converter_needauth_forbidden);
- needauthCB->setChecked(rc.use_converter_needauth);
+ setCheckboxBlockSignals(needauthCB, rc.use_converter_needauth);
QString max_age;
doubleToWidget(maxAgeLE, (double(rc.converter_cache_maxage) / 86400.0), 'g', 6);
updateGui();
}
+void PrefConverters::on_needauthCB_toggled(bool checked)
+{
+ if (checked) {
+ changed();
+ return;
+ }
+
+ int ret = frontend::Alert::prompt(
+ _("SECURITY WARNING!"), _("Unchecking this option has the effect that potentially harmful converters would be run without asking your permission first. This is UNSAFE and NOT recommended, unless you know what you are doing. Are you sure you would like to proceed ? The recommended and safe answer is NO!"),
+ 0, 0, _("&No"), _("&Yes"));
+ if (ret == 1)
+ changed();
+ else
+ setCheckboxBlockSignals(needauthCB, true);
+}
+
+
/////////////////////////////////////////////////////////////////////
//
// FormatValidator
this, SIGNAL(changed()));
connect(defaultOTFFormatCB, SIGNAL(activated(QString)),
this, SIGNAL(changed()));
+ connect(defaultPlatexFormatCB, SIGNAL(activated(QString)),
+ this, SIGNAL(changed()));
connect(viewerCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
connect(editorCO, SIGNAL(activated(int)),
return split(l10n_format, '|');
}
-} // namespace anon
+} // namespace
void PrefFileformats::applyRC(LyXRC & rc) const
QString const default_otf_format = defaultOTFFormatCB->itemData(
defaultOTFFormatCB->currentIndex()).toString();
rc.default_otf_view_format = fromqstr(default_otf_format);
+ QString const default_platex_format = defaultPlatexFormatCB->itemData(
+ defaultPlatexFormatCB->currentIndex()).toString();
+ rc.default_platex_view_format = fromqstr(default_platex_format);
}
pos = defaultOTFFormatCB->findData(toqstr(rc.default_otf_view_format));
defaultOTFFormatCB->setCurrentIndex(pos);
defaultOTFFormatCB->setCurrentIndex(pos);
+ pos = defaultPlatexFormatCB->findData(toqstr(rc.default_platex_view_format));
+ defaultPlatexFormatCB->setCurrentIndex(pos);
+ defaultPlatexFormatCB->setCurrentIndex(pos);
}
}
QString const current = formatsCB->currentText();
QString const current_def = defaultFormatCB->currentText();
QString const current_def_otf = defaultOTFFormatCB->currentText();
+ QString const current_def_platex = defaultPlatexFormatCB->currentText();
// update comboboxes with formats
formatsCB->blockSignals(true);
defaultFormatCB->blockSignals(true);
defaultOTFFormatCB->blockSignals(true);
+ defaultPlatexFormatCB->blockSignals(true);
formatsCB->clear();
defaultFormatCB->clear();
defaultOTFFormatCB->clear();
+ defaultPlatexFormatCB->clear();
form_->formats().sort();
for (Format const & f : form_->formats()) {
QString const prettyname = toqstr(translateIfPossible(f.prettyname()));
QVariant(toqstr(f.name())));
defaultOTFFormatCB->addItem(prettyname,
QVariant(toqstr(f.name())));
- } else if (form_->converters().isReachable("latex", f.name())
- || form_->converters().isReachable("pdflatex", f.name()))
- defaultFormatCB->addItem(prettyname,
+ } else {
+ if (form_->converters().isReachable("latex", f.name())
+ || form_->converters().isReachable("pdflatex", f.name()))
+ defaultFormatCB->addItem(prettyname,
QVariant(toqstr(f.name())));
+ if (form_->converters().isReachable("platex", f.name()))
+ defaultPlatexFormatCB->addItem(prettyname,
+ QVariant(toqstr(f.name())));
+ }
}
// restore selections
defaultFormatCB->setCurrentIndex(item < 0 ? 0 : item);
item = defaultOTFFormatCB->findText(current_def_otf, Qt::MatchExactly);
defaultOTFFormatCB->setCurrentIndex(item < 0 ? 0 : item);
+ item = defaultPlatexFormatCB->findText(current_def_platex, Qt::MatchExactly);
+ defaultPlatexFormatCB->setCurrentIndex(item < 0 ? 0 : item);
formatsCB->blockSignals(false);
defaultFormatCB->blockSignals(false);
defaultOTFFormatCB->blockSignals(false);
+ defaultPlatexFormatCB->blockSignals(false);
}
}
}
}
-}
+} // namespace
void PrefFileformats::updateViewers()
bool GuiPreferences::initialiseParams(string const &)
{
rc_ = lyxrc;
- formats_ = lyx::formats;
+ formats_ = theFormats();
converters_ = theConverters();
converters_.update(formats_);
movers_ = theMovers();
Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
theBufferList().recordCurrentAuthor(author);
- lyx::formats = formats_;
+ theFormats() = formats_;
theConverters() = converters_;
- theConverters().update(lyx::formats);
+ theConverters().update(formats_);
theConverters().buildGraph();
theBufferList().invalidateConverterCache();
-
+
theMovers() = movers_;
vector<string>::const_iterator it = colors_.begin();