#include "debug.h"
#include "qt_helpers.h"
-#include "ColorCache.h"
+#include "GuiApplication.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "gettext.h"
#include "LColor.h"
-#include "ColorCache.h"
#include "controllers/ControlPrefs.h"
{
string const name = makeFontName(family, foundry);
for (int i = 0; i < cb->count(); ++i) {
- if (fromqstr(cb->text(i)) == name) {
- cb->setCurrentItem(i);
+ if (fromqstr(cb->itemText(i)) == name) {
+ cb->setCurrentIndex(i);
return;
}
}
// We count in reverse in order to prefer the Xft foundry
for (int i = cb->count() - 1; i >= 0; --i) {
- pair<string, string> tmp = parseFontName(fromqstr(cb->text(i)));
+ pair<string, string> tmp = parseFontName(fromqstr(cb->itemText(i)));
if (compare_no_case(tmp.first, family) == 0) {
- cb->setCurrentItem(i);
+ cb->setCurrentIndex(i);
return;
}
}
// We count in reverse in order to prefer the Xft foundry
for (int i = cb->count() - 1; i >= 0; --i) {
- pair<string, string> tmp = parseFontName(fromqstr(cb->text(i)));
+ pair<string, string> tmp = parseFontName(fromqstr(cb->itemText(i)));
if (compare_no_case(tmp.first, tmpfam.first) == 0) {
- cb->setCurrentItem(i);
+ cb->setCurrentIndex(i);
return;
}
}
QFont font;
- if (family == lyx_gui::roman_font_name()) {
+ if (family == theApp->romanFontName()) {
font.setStyleHint(QFont::Serif);
font.setFamily(family.c_str());
- } else if (family == lyx_gui::sans_font_name()) {
+ } else if (family == theApp->sansFontName()) {
font.setStyleHint(QFont::SansSerif);
font.setFamily(family.c_str());
- } else if (family == lyx_gui::typewriter_font_name()) {
+ } else if (family == theApp->typewriterFontName()) {
font.setStyleHint(QFont::TypeWriter);
font.setFamily(family.c_str());
} else {
lyxerr << "Apparent font is " << default_font_name << endl;
for (int i = 0; i < cb->count(); ++i) {
- lyxerr << "Looking at " << fromqstr(cb->text(i)) << endl;
- if (compare_no_case(fromqstr(cb->text(i)),
+ lyxerr << "Looking at " << fromqstr(cb->itemText(i)) << endl;
+ if (compare_no_case(fromqstr(cb->itemText(i)),
default_font_name) == 0) {
- cb->setCurrentItem(i);
+ cb->setCurrentIndex(i);
return;
}
}
PrefAscii::PrefAscii(QWidget * parent)
-: PrefModule(_(Outputs), _("Plain text"), 0, parent)
+: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Plain text")), 0, parent)
{
setupUi(this);
connect(asciiLinelengthSB, SIGNAL(valueChanged(int)),
PrefDate::PrefDate(QWidget * parent)
-: PrefModule(_(Outputs), _("Date format"), 0, parent)
+: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Date format")), 0, parent)
{
setupUi(this);
connect(DateED, SIGNAL(textChanged(const QString&)),
PrefKeyboard::PrefKeyboard(QPrefs * form, QWidget * parent)
-: PrefModule(_(LookAndFeel), _("Keyboard"), form, parent)
+: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Keyboard")), form, parent)
{
setupUi(this);
PrefLatex::PrefLatex(QPrefs * form, QWidget * parent)
-: PrefModule(_(Outputs), _("LaTeX"), form, parent)
+: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("LaTeX")), form, parent)
{
setupUi(this);
connect(latexEncodingED, SIGNAL(textChanged(const QString&)),
rc.auto_reset_options = latexAutoresetCB->isChecked();
rc.view_dvi_paper_option = fromqstr(latexDviPaperED->text());
rc.default_papersize =
- form_->controller().toPaperSize(latexPaperSizeCO->currentItem());
+ form_->controller().toPaperSize(latexPaperSizeCO->currentIndex());
}
PrefScreenFonts::PrefScreenFonts(QPrefs * form, QWidget * parent)
-: PrefModule(_(LookAndFeel), _("Screen fonts"), form, parent)
+: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Screen fonts")), form, parent)
{
setupUi(this);
QFontDatabase fontdb;
QStringList families(fontdb.families());
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
- screenRomanCO->insertItem(*it);
- screenSansCO->insertItem(*it);
- screenTypewriterCO->insertItem(*it);
+ screenRomanCO->addItem(*it);
+ screenSansCO->addItem(*it);
+ screenTypewriterCO->addItem(*it);
}
connect(screenRomanCO, SIGNAL(activated(const QString&)),
this, SIGNAL(changed()));
PrefColors::PrefColors(QPrefs * form, QWidget * parent)
-: PrefModule(_(LookAndFeel), _("Colors"), form, parent)
+: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Colors")), form, parent)
{
setupUi(this);
|| lc == LColor::ignore) continue;
lcolors_.push_back(lc);
- QColor color = QColor(lcolorcache.get(lc));
+ QColor color = QColor(guiApp->colorCache().get(lc));
prefcolors_.push_back(color.name());
QPixmap coloritem(32, 32);
coloritem.fill(color);
- QListWidgetItem * newItem = new QListWidgetItem(QIcon(coloritem),
+ // This is not a memory leak:
+ /*QListWidgetItem * newItem =*/ new QListWidgetItem(QIcon(coloritem),
toqstr(lcolor.getGUIName(lc)), lyxObjectsLW);
}
newcolors_ = prefcolors_;
- connect(colorChangePB, SIGNAL(clicked()),
+ connect(colorChangePB, SIGNAL(clicked()),
this, SLOT(change_color()));
- connect(lyxObjectsLW, SIGNAL(itemActivated(QListWidgetItem*)),
+ connect(lyxObjectsLW, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(change_color()));
}
-void PrefColors::apply(LyXRC & rc) const
+void PrefColors::apply(LyXRC & /*rc*/) const
{
- for (int i = 0; i < lcolors_.size(); ++i) {
+ for (unsigned int i = 0; i < lcolors_.size(); ++i) {
if (prefcolors_[i]!=newcolors_[i])
form_->controller().setColor(lcolors_[i], fromqstr(newcolors_[i]));
}
}
-void PrefColors::update(LyXRC const & rc)
+void PrefColors::update(LyXRC const & /*rc*/)
{
}
{
int const row = lyxObjectsLW->currentRow();
QString color = newcolors_[row];
- QColor c(QColorDialog::getColor(QColor(color),
- qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget()));
+ QColor c(QColorDialog::getColor(QColor(color),
+ qApp->focusWidget()));
if (c.name()!=color) {
newcolors_[row] = c.name();
QPixmap coloritem(32, 32);
coloritem.fill(c);
lyxObjectsLW->currentItem()->setIcon(QIcon(coloritem));
- emit changed();
+ // emit signal
+ changed();
}
}
PrefCygwinPath::PrefCygwinPath(QWidget * parent)
-: PrefModule(_(Outputs), _("Paths"), 0, parent)
+: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Paths")), 0, parent)
{
setupUi(this);
connect(pathCB, SIGNAL(toggled(bool)),
PrefDisplay::PrefDisplay(QWidget * parent)
-: PrefModule(_(LookAndFeel), _("Graphics"), 0, parent)
+: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("Graphics")), 0, parent)
{
setupUi(this);
connect(instantPreviewCO, SIGNAL(activated(int)),
void PrefDisplay::apply(LyXRC & rc) const
{
- switch (instantPreviewCO->currentItem()) {
+ switch (instantPreviewCO->currentIndex()) {
case 0: rc.preview = LyXRC::PREVIEW_OFF; break;
case 1: rc.preview = LyXRC::PREVIEW_NO_MATH; break;
case 2: rc.preview = LyXRC::PREVIEW_ON; break;
}
lyx::graphics::DisplayType dtype;
- switch (displayGraphicsCO->currentItem()) {
+ switch (displayGraphicsCO->currentIndex()) {
case 3: dtype = lyx::graphics::NoDisplay; break;
case 2: dtype = lyx::graphics::ColorDisplay; break;
case 1: dtype = lyx::graphics::GrayscaleDisplay; break;
PrefPaths::PrefPaths(QPrefs * form, QWidget * parent)
-: PrefModule(string(), _("Paths"), form, parent)
+: PrefModule(string(), lyx::to_utf8(_("Paths")), form, parent)
{
setupUi(this);
connect(templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
lyxserverDirED->setText(external_path(rc.lyxpipes));
}
-// NB: the _() is OK here because it gets passed back and we toqstr() them
+// NB: the lyx::to_utf8(_() is OK here because it gets passed back and we toqstr()) them
void PrefPaths::select_templatedir()
{
- string file(form_->controller().browsedir(fromqstr(templateDirED->text()), _("Select a document templates directory")));
+ string file(form_->controller().browsedir(fromqstr(templateDirED->text()), lyx::to_utf8(_("Select a document templates directory"))));
if (!file.empty())
templateDirED->setText(toqstr(file));
}
void PrefPaths::select_tempdir()
{
- string file(form_->controller().browsedir(fromqstr(tempDirED->text()), _("Select a temporary directory")));
+ string file(form_->controller().browsedir(fromqstr(tempDirED->text()), lyx::to_utf8(_("Select a temporary directory"))));
if (!file.empty())
tempDirED->setText(toqstr(file));
}
void PrefPaths::select_backupdir()
{
- string file(form_->controller().browsedir(fromqstr(backupDirED->text()), _("Select a backups directory")));
+ string file(form_->controller().browsedir(fromqstr(backupDirED->text()), lyx::to_utf8(_("Select a backups directory"))));
if (!file.empty())
backupDirED->setText(toqstr(file));
}
void PrefPaths::select_workingdir()
{
- string file(form_->controller().browsedir(fromqstr(workingDirED->text()), _("Select a document directory")));
+ string file(form_->controller().browsedir(fromqstr(workingDirED->text()), lyx::to_utf8(_("Select a document directory"))));
if (!file.empty())
workingDirED->setText(toqstr(file));
}
void PrefPaths::select_lyxpipe()
{
- string file(form_->controller().browse(fromqstr(lyxserverDirED->text()), _("Give a filename for the LyX server pipe")));
+ string file(form_->controller().browse(fromqstr(lyxserverDirED->text()), lyx::to_utf8(_("Give a filename for the LyX server pipe"))));
if (!file.empty())
lyxserverDirED->setText(toqstr(file));
}
PrefSpellchecker::PrefSpellchecker(QPrefs * form, QWidget * parent)
-: PrefModule(_(LanguageSettings), _("Spellchecker"), form, parent)
+: PrefModule(lyx::to_utf8(_(LanguageSettings)), lyx::to_utf8(_("Spellchecker")), form, parent)
{
setupUi(this);
connect(inputEncodingCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
- spellCommandCO->insertItem(qt_("ispell"));
- spellCommandCO->insertItem(qt_("aspell"));
- spellCommandCO->insertItem(qt_("hspell"));
+ spellCommandCO->addItem(qt_("ispell"));
+ spellCommandCO->addItem(qt_("aspell"));
+ spellCommandCO->addItem(qt_("hspell"));
#ifdef USE_PSPELL
- spellCommandCO->insertItem(qt_("pspell (library)"));
+ spellCommandCO->addItem(qt_("pspell (library)"));
#else
#ifdef USE_ASPELL
- spellCommandCO->insertItem(qt_("aspell (library)"));
+ spellCommandCO->addItem(qt_("aspell (library)"));
#endif
#endif
}
void PrefSpellchecker::apply(LyXRC & rc) const
{
- switch (spellCommandCO->currentItem()) {
+ switch (spellCommandCO->currentIndex()) {
case 0:
case 1:
case 2:
PrefConverters::PrefConverters(QPrefs * form, QWidget * parent)
-: PrefModule(string(), _("Converters"), form, parent)
+: PrefModule(string(), lyx::to_utf8(_("Converters")), form, parent)
{
setupUi(this);
- connect(converterNewPB, SIGNAL(clicked()),
+ connect(converterNewPB, SIGNAL(clicked()),
this, SLOT(new_converter()));
- connect(converterRemovePB, SIGNAL(clicked()),
+ connect(converterRemovePB, SIGNAL(clicked()),
this, SLOT(remove_converter()));
- connect(converterModifyPB, SIGNAL(clicked()),
+ connect(converterModifyPB, SIGNAL(clicked()),
this, SLOT(modify_converter()));
- connect(convertersLW, SIGNAL(currentRowChanged(int)),
+ connect(convertersLW, SIGNAL(currentRowChanged(int)),
this, SLOT(switch_converter(int)));
- connect(converterFromCO, SIGNAL(activated(const QString&)),
+ connect(converterFromCO, SIGNAL(activated(const QString&)),
this, SLOT(converter_changed()));
- connect(converterToCO, SIGNAL(activated(const QString&)),
+ connect(converterToCO, SIGNAL(activated(const QString&)),
this, SLOT(converter_changed()));
- connect(converterED, SIGNAL(textChanged(const QString&)),
+ connect(converterED, SIGNAL(textChanged(const QString&)),
this, SLOT(converter_changed()));
- connect(converterFlagED, SIGNAL(textChanged(const QString&)),
+ connect(converterFlagED, SIGNAL(textChanged(const QString&)),
this, SLOT(converter_changed()));
- connect(converterNewPB, SIGNAL(clicked()),
+ connect(converterNewPB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- connect(converterRemovePB, SIGNAL(clicked()),
+ connect(converterRemovePB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- connect(converterModifyPB, SIGNAL(clicked()),
+ connect(converterModifyPB, SIGNAL(clicked()),
this, SIGNAL(changed()));
}
-void PrefConverters::apply(LyXRC & rc) const
+void PrefConverters::apply(LyXRC & /*rc*/) const
{
}
-void PrefConverters::update(LyXRC const & rc)
+void PrefConverters::update(LyXRC const & /*rc*/)
{
updateGui();
}
Formats::const_iterator cit = form_->formats().begin();
Formats::const_iterator end = form_->formats().end();
for (; cit != end; ++cit) {
- converterFromCO->insertItem(toqstr(cit->prettyname()));
- converterToCO->insertItem(toqstr(cit->prettyname()));
+ converterFromCO->addItem(toqstr(cit->prettyname()));
+ converterToCO->addItem(toqstr(cit->prettyname()));
}
convertersLW->clear();
// restore selection
if (!current.isEmpty()) {
- QList<QListWidgetItem *> const item =
+ QList<QListWidgetItem *> const item =
convertersLW->findItems(current, Qt::MatchExactly);
if (item.size()>0)
convertersLW->setCurrentItem(item.at(0));
void PrefConverters::updateButtons()
{
Format const & from(form_->formats().get(
- converterFromCO->currentItem()));
+ converterFromCO->currentIndex()));
Format const & to(form_->formats().get(
- converterToCO->currentItem()));
+ converterToCO->currentIndex()));
int const sel = form_->converters().getNumber(from.name(), to.name());
bool const known = !(sel < 0);
bool const valid = !(converterED->text().isEmpty()
// specify unique from/to or it doesn't appear. This is really bad UI
void PrefConverters::new_converter()
{
- Format const & from(form_->formats().get(converterFromCO->currentItem()));
- Format const & to(form_->formats().get(converterToCO->currentItem()));
+ Format const & from(form_->formats().get(converterFromCO->currentIndex()));
+ Format const & to(form_->formats().get(converterToCO->currentIndex()));
string const command(fromqstr(converterED->text()));
string const flags(fromqstr(converterFlagED->text()));
QString const current_text =
convertersLW->currentItem()->text();
- Format const & from(form_->formats().get(converterFromCO->currentItem()));
- Format const & to(form_->formats().get(converterToCO->currentItem()));
+ Format const & from(form_->formats().get(converterFromCO->currentIndex()));
+ Format const & to(form_->formats().get(converterToCO->currentIndex()));
string flags(fromqstr(converterFlagED->text()));
string name(fromqstr(converterED->text()));
void PrefConverters::remove_converter()
{
- Format const & from(form_->formats().get(converterFromCO->currentItem()));
- Format const & to(form_->formats().get(converterToCO->currentItem()));
+ Format const & from(form_->formats().get(converterFromCO->currentIndex()));
+ Format const & to(form_->formats().get(converterToCO->currentIndex()));
form_->converters().erase(from.name(), to.name());
updateGui();
}
PrefCopiers::PrefCopiers(QPrefs * form, QWidget * parent)
-: PrefModule(string(), _("Copiers"), form, parent)
+: PrefModule(string(), lyx::to_utf8(_("Copiers")), form, parent)
{
setupUi(this);
connect(copierNewPB, SIGNAL(clicked()), this, SLOT(new_copier()));
connect(copierRemovePB, SIGNAL(clicked()), this, SLOT(remove_copier()));
connect(copierModifyPB, SIGNAL(clicked()), this, SLOT(modify_copier()));
- connect(AllCopiersLW, SIGNAL(currentRowChanged(int)),
+ connect(AllCopiersLW, SIGNAL(currentRowChanged(int)),
this, SLOT(switch_copierLB(int)));
connect(copierFormatCO, SIGNAL(activated(int)), this, SLOT(switch_copierCO(int)));
connect(copierNewPB, SIGNAL(clicked()),
}
-void PrefCopiers::apply(LyXRC & rc) const
+void PrefCopiers::apply(LyXRC & /*rc*/) const
{
}
-void PrefCopiers::update(LyXRC const & rc)
+void PrefCopiers::update(LyXRC const & /*rc*/)
{
update();
}
for (Formats::const_iterator it = form_->formats().begin(),
end = form_->formats().end();
it != end; ++it) {
- copierFormatCO->insertItem(toqstr(it->prettyname()));
+ copierFormatCO->addItem(toqstr(it->prettyname()));
}
// The browser widget
// restore selection
if (!current.isEmpty()) {
- QList<QListWidgetItem *> item =
+ QList<QListWidgetItem *> item =
AllCopiersLW->findItems(current, Qt::MatchExactly);
if (item.size()>0)
AllCopiersLW->setCurrentItem(item.at(0));
copierED->clear();
int const combo_size = copierFormatCO->count();
for (int i = 0; i < combo_size; ++i) {
- QString const text = copierFormatCO->text(i);
+ QString const text = copierFormatCO->itemText(i);
if (text == gui_name) {
copierFormatCO->setCurrentIndex(i);
copierED->setText(command);
QString selected = copierFormatCO->currentText();
bool known = false;
- for (unsigned int i = 0; i != AllCopiersLW->count(); i++) {
+ for (int i = 0; i < AllCopiersLW->count(); ++i) {
if (AllCopiersLW->item(i)->text() == selected)
known = true;
}
PrefFileformats::PrefFileformats(QPrefs * form, QWidget * parent)
-: PrefModule(string(), _("File formats"), form, parent)
+: PrefModule(string(), lyx::to_utf8(_("File formats")), form, parent)
{
setupUi(this);
connect(formatNewPB, SIGNAL(clicked()), this, SLOT(new_format()));
connect(formatRemovePB, SIGNAL(clicked()), this, SLOT(remove_format()));
connect(formatModifyPB, SIGNAL(clicked()), this, SLOT(modify_format()));
- connect(formatsLW, SIGNAL(currentRowChanged(int)),
+ connect(formatsLW, SIGNAL(currentRowChanged(int)),
this, SLOT(switch_format(int)));
connect(formatED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(guiNameED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(viewerED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(editorED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(documentCB, SIGNAL(toggled(bool)), this, SLOT(fileformat_changed()));
+ connect(vectorCB, SIGNAL(toggled(bool)), this, SLOT(fileformat_changed()));
connect(formatNewPB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(formatRemovePB, SIGNAL(clicked()),
}
-void PrefFileformats::apply(LyXRC & rc) const
+void PrefFileformats::apply(LyXRC & /*rc*/) const
{
}
-void PrefFileformats::update(LyXRC const & rc)
+void PrefFileformats::update(LyXRC const & /*rc*/)
{
update();
}
viewerED->setText(toqstr(f.viewer()));
editorED->setText(toqstr(f.editor()));
documentCB->setChecked((f.documentFormat()));
+ vectorCB->setChecked((f.vectorFormat()));
formatRemovePB->setEnabled(
!form_->converters().formatIsUsed(f.name()));
int const sel = form_->formats().getNumber(fromqstr(format));
bool gui_name_known = false;
int where = sel;
- for (unsigned int i = 0; i != formatsLW->count(); i++) {
+ for (int i = 0; i < formatsLW->count(); ++i) {
if (formatsLW->item(i)->text() == gui_name) {
gui_name_known = true;
where = formatsLW->item(i)->type();
string const old_viewer(f.viewer());
string const old_editor(f.editor());
bool const old_document(f.documentFormat());
+ bool const old_vector(f.vectorFormat());
string const new_pretty(fromqstr(gui_name));
string const new_shortcut(fromqstr(shortcutED->text()));
string const new_viewer(fromqstr(viewerED->text()));
string const new_editor(fromqstr(editorED->text()));
bool const new_document(documentCB->isChecked());
+ bool const new_vector(vectorCB->isChecked());
bool modified = ((old_pretty != new_pretty) || (old_shortcut != new_shortcut)
|| (old_extension != new_extension) || (old_viewer != new_viewer)
- || (old_editor != new_editor) || old_document != new_document);
+ || old_editor != new_editor || old_document != new_document
+ || old_vector != new_vector);
formatModifyPB->setEnabled(
valid && known && modified && !known_otherwise);
string const shortcut = fromqstr(shortcutED->text());
string const viewer = fromqstr(viewerED->text());
string const editor = fromqstr(editorED->text());
- bool const document = documentCB->isChecked();
+ int flags = Format::none;
+ if (documentCB->isChecked())
+ flags |= Format::document;
+ if (vectorCB->isChecked())
+ flags |= Format::vector;
form_->formats().add(name, extension, prettyname, shortcut, viewer,
- editor, document);
+ editor, flags);
form_->formats().sort();
update();
string const shortcut = fromqstr(shortcutED->text());
string const viewer = fromqstr(viewerED->text());
string const editor = fromqstr(editorED->text());
- bool const document = documentCB->isChecked();
+ int flags = Format::none;
+ if (documentCB->isChecked())
+ flags |= Format::document;
+ if (vectorCB->isChecked())
+ flags |= Format::vector;
form_->formats().add(name, extension, prettyname, shortcut, viewer,
- editor, document);
+ editor, flags);
form_->formats().sort();
formatsLW->setUpdatesEnabled(false);
string const current_text = form_->formats().get(nr).name();
if (form_->converters().formatIsUsed(current_text)) {
Alert::error(_("Format in use"),
- _("Cannot remove a Format used by a Converter. "
- "Remove the converter first."));
+ _("Cannot remove a Format used by a Converter. "
+ "Remove the converter first."));
return;
}
PrefLanguage::PrefLanguage(QWidget * parent)
-: PrefModule(string(), _("Language"), 0, parent)
+: PrefModule(string(), lyx::to_utf8(_("Language")), 0, parent)
{
setupUi(this);
std::vector<LanguagePair>::const_iterator lit = langs.begin();
std::vector<LanguagePair>::const_iterator lend = langs.end();
for (; lit != lend; ++lit) {
- defaultLanguageCO->insertItem(toqstr(lit->first));
+ defaultLanguageCO->addItem(toqstr(lit->first));
}
}
rc.language_package = fromqstr(languagePackageED->text());
rc.language_command_begin = fromqstr(startCommandED->text());
rc.language_command_end = fromqstr(endCommandED->text());
- rc.default_language = lang_[defaultLanguageCO->currentItem()];
+ rc.default_language = lang_[defaultLanguageCO->currentIndex()];
}
PrefPrinter::PrefPrinter(QWidget * parent)
-: PrefModule(_(Outputs), _("Printer"), 0, parent)
+: PrefModule(lyx::to_utf8(_(Outputs)), lyx::to_utf8(_("Printer")), 0, parent)
{
setupUi(this);
PrefUserInterface::PrefUserInterface(QPrefs * form, QWidget * parent)
-: PrefModule(_(LookAndFeel), _("User interface"), form, parent)
+: PrefModule(lyx::to_utf8(_(LookAndFeel)), lyx::to_utf8(_("User interface")), form, parent)
{
setupUi(this);
this, SIGNAL(changed()));
connect(loadSessionCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
+ connect(loadWindowSizeCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(loadWindowSizeCB, SIGNAL(toggled(bool)),
+ windowWidthLA, SLOT(setDisabled(bool)));
+ connect(loadWindowSizeCB, SIGNAL(toggled(bool)),
+ windowHeightLA, SLOT(setDisabled(bool)));
+ connect(loadWindowSizeCB, SIGNAL(toggled(bool)),
+ windowWidthSB, SLOT(setDisabled(bool)));
+ connect(loadWindowSizeCB, SIGNAL(toggled(bool)),
+ windowHeightSB, SLOT(setDisabled(bool)));
+ connect(loadWindowLocationCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(windowWidthSB, SIGNAL(valueChanged(int)),
+ this, SIGNAL(changed()));
+ connect(windowHeightSB, SIGNAL(valueChanged(int)),
+ this, SIGNAL(changed()));
connect(cursorFollowsCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(autoSaveSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
- lastfilesSB->setMaxValue(maxlastfiles);
+ lastfilesSB->setMaximum(maxlastfiles);
}
rc.bind_file = internal_path(bindFileED->text());
rc.use_lastfilepos = restoreCursorCB->isChecked();
rc.load_session = loadSessionCB->isChecked();
+ if (loadWindowSizeCB->isChecked()) {
+ rc.geometry_width = 0;
+ rc.geometry_height = 0;
+ } else {
+ rc.geometry_width = windowWidthSB->value();
+ rc.geometry_height = windowHeightSB->value();
+ }
+ rc.geometry_xysaved = loadWindowLocationCB->isChecked();
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.autosave = autoSaveSB->value() * 60;
rc.make_backup = autoSaveCB->isChecked();
bindFileED->setText(external_path(rc.bind_file));
restoreCursorCB->setChecked(rc.use_lastfilepos);
loadSessionCB->setChecked(rc.load_session);
+ bool loadWindowSize = rc.geometry_width == 0 && rc.geometry_height == 0;
+ loadWindowSizeCB->setChecked(loadWindowSize);
+ windowWidthSB->setEnabled(!loadWindowSize);
+ windowHeightSB->setEnabled(!loadWindowSize);
+ windowWidthLA->setEnabled(!loadWindowSize);
+ windowHeightLA->setEnabled(!loadWindowSize);
+ if (!loadWindowSize) {
+ windowWidthSB->setValue(rc.geometry_width);
+ windowHeightSB->setValue(rc.geometry_height);
+ }
+ loadWindowLocationCB->setChecked(rc.geometry_xysaved);
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
// convert to minutes
int mins(rc.autosave / 60);
PrefIdentity::PrefIdentity(QWidget * parent)
-: PrefModule(string(), _("Identity"), 0, parent)
+: PrefModule(string(), lyx::to_utf8(_("Identity")), 0, parent)
{
setupUi(this);
add(formats);
add(new PrefCopiers(form_));
-
+
add(new PrefLanguage);
add(new PrefPrinter);
add(new PrefUserInterface(form_));
add(new PrefIdentity);
- prefsPS->setCurrentPanel(_("User interface"));
+ prefsPS->setCurrentPanel(lyx::to_utf8(_("User interface")));
form_->bcview().setOK(savePB);
form_->bcview().setApply(applyPB);