From 6e03eb57fa0b5275cdac867d5e50fcbbca9f3e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 25 Mar 2011 15:14:52 +0000 Subject: [PATCH] GuiPrefs.{cpp,h}: use text/data interface for icon set ui. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38049 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiPrefs.cpp | 26 ++++++-------------------- src/frontends/qt4/GuiPrefs.h | 5 ----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 09600212cf..0827d851ac 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2443,23 +2443,16 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) this, SIGNAL(changed())); lastfilesSB->setMaximum(maxlastfiles); - icon_names_.clear(); - icon_names_.push_back(make_pair("default", qt_("Default"))); - icon_names_.push_back(make_pair("liber", qt_("Liber"))); - icon_names_.push_back(make_pair("oxygen", qt_("Oxygen"))); - iconSetCO->addItem(icon_names_[0].second); - iconSetCO->addItem(icon_names_[1].second); - iconSetCO->addItem(icon_names_[2].second); + iconSetCO->addItem(qt_("Default"), "default"); + iconSetCO->addItem(qt_("Liber"), "liber"); + iconSetCO->addItem(qt_("Oxygen"), "oxygen"); } void PrefUserInterface::apply(LyXRC & rc) const { - int const iconset = iconSetCO->currentIndex(); - if (iconset > 0) - rc.icon_set = icon_names_[iconset].first; - else - rc.icon_set.clear(); + rc.icon_set = fromqstr(iconSetCO->itemData( + iconSetCO->currentIndex()).toString()); rc.ui_file = internal_path(fromqstr(uiFileED->text())); rc.use_lastfilepos = restoreCursorCB->isChecked(); @@ -2481,14 +2474,7 @@ void PrefUserInterface::apply(LyXRC & rc) const void PrefUserInterface::update(LyXRC const & rc) { - int iconset = 0; - if (!rc.icon_set.empty()) { - for ( ; iconset < int(icon_names_.size()); ++iconset) { - if (rc.icon_set == icon_names_[iconset].first) - break; - } - } - iconset = iconSetCO->findText(icon_names_[iconset].second); + int iconset = iconSetCO->findData(toqstr(rc.icon_set)); if (iconset < 0) iconset = 0; iconSetCO->setCurrentIndex(iconset); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 3a6cd7289a..d567ca683a 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -46,7 +46,6 @@ #include "ui_ShortcutUi.h" #include -#include #include @@ -427,10 +426,6 @@ public: public Q_SLOTS: void selectUi(); void on_clearSessionPB_clicked(); - -private: - /// icon names and their translations - std::vector > icon_names_; };