From: Enrico Forestieri Date: Fri, 25 Mar 2011 14:21:28 +0000 (+0000) Subject: Move to PrefUi the icon set choice and solve problem with translation X-Git-Tag: 2.0.0~420 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=36bf758ed9d4c4fb9cd123fd9ef38ac5ba7e3f46;p=features.git Move to PrefUi the icon set choice and solve problem with translation of icon set names. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38046 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc index cdbb2c5fa3..849382ce42 100644 --- a/lib/ui/stdtoolbars.inc +++ b/lib/ui/stdtoolbars.inc @@ -68,33 +68,49 @@ ToolbarSet Toolbar "standard" "Standard" Layouts - Item "New document" "buffer-new" - Item "Open document" "file-open" - Item "Save document" "buffer-write" - Item "Print document" "dialog-show print" + Item "Default" "layout" + Item "Numbered list" "layout Enumerate" + Item "Itemized list" "layout Itemize" + Item "List" "layout List" + Item "Description" "layout Description" + Item "Increase depth" "depth-increment" + Item "Decrease depth" "depth-decrement" + Item "Paragraph settings" "layout-paragraph" + Separator + Item "Toggle emphasis" "font-emph" + Item "Toggle noun" "font-noun" + Item "Apply last" "textstyle-apply" + Item "Text style" "dialog-show character" + Separator + Item "Insert math" "math-mode on" + Item "Insert graphics" "dialog-show-new-inset graphics" + TableInsert "Insert table" + Separator + Item "View" "buffer-view" Separator Item "Check spelling" "dialog-show spellchecker" + Item "Thesaurus" "thesaurus-entry" Separator + Item "Toggle outline" "dialog-toggle toc" + End + + Toolbar "file" "File" + Item "New document" "buffer-new" + Item "Open document" "file-open" + Item "Save document" "buffer-write" + End + + Toolbar "edit" "Edit" Item "Undo" "undo" Item "Redo" "redo" + Separator Item "Cut" "cut" Item "Copy" "copy" Item "Paste" "paste" + Separator Item "Find and replace" "dialog-show findreplace" Item "Find and replace (advanced)" "dialog-toggle findreplaceadv" Item "Navigate back" "bookmark-goto 0" - Separator - Item "Toggle emphasis" "font-emph" - Item "Toggle noun" "font-noun" - Item "Apply last" "textstyle-apply" - Separator - Item "Insert math" "math-mode on" - Item "Insert graphics" "dialog-show-new-inset graphics" - TableInsert "Insert table" - Separator - Item "Toggle outline" "dialog-toggle toc" - Item "Toggle math toolbar" "toolbar-toggle math" - Item "Toggle table toolbar" "toolbar-toggle table" End Toolbar "view/update" "View/Update" @@ -102,21 +118,12 @@ ToolbarSet Item "Update" "buffer-update" Item "View master document" "master-buffer-view" Item "Update master document" "master-buffer-update" - Item "Enable Forward/Reverse Search" "buffer-toggle-output-sync" Separator StickyPopupMenu "view-others" "View other formats" StickyPopupMenu "update-others" "Update other formats" End Toolbar "extra" "Extra" - Item "Default" "layout" - Item "Numbered list" "layout Enumerate" - Item "Itemized list" "layout Itemize" - Item "List" "layout List" - Item "Description" "layout Description" - Item "Increase depth" "depth-increment" - Item "Decrease depth" "depth-decrement" - Separator Item "Insert figure float" "float-insert figure" Item "Insert table float" "float-insert table" Item "Insert label" "label-insert" @@ -134,9 +141,6 @@ ToolbarSet Item "Insert math macro" "math-macro newmacroname newcommand" Item "Include file" "dialog-show-new-inset include" Separator - Item "Text style" "dialog-show character" - Item "Paragraph settings" "layout-paragraph" - Item "Thesaurus" "thesaurus-entry" End Toolbar "table" "Table" diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index e65ca84a7f..446027f2cf 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1193,7 +1193,6 @@ PrefDisplay::PrefDisplay(GuiPreferences * form) connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed())); - connect(iconSetCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); } @@ -1225,15 +1224,6 @@ void PrefDisplay::apply(LyXRC & rc) const break; } - switch (iconSetCO->currentIndex()) { - case 0: - rc.icon_set.clear(); - break; - default: - rc.icon_set = fromqstr(iconSetCO->currentText().toLower()); - break; - } - rc.display_graphics = displayGraphicsCB->isChecked(); rc.preview_scale_factor = previewSizeSB->value(); rc.paragraph_markers = paragraphMarkerCB->isChecked(); @@ -1262,13 +1252,6 @@ void PrefDisplay::update(LyXRC const & rc) break; } - string name = rc.icon_set.empty() ? "default" : rc.icon_set; - name[0] = uppercase(name[0]); - int iconset = iconSetCO->findText(qt_(name)); - if (iconset < 0) - iconset = 0; - iconSetCO->setCurrentIndex(iconset); - displayGraphicsCB->setChecked(rc.display_graphics); instantPreviewCO->setEnabled(rc.display_graphics); previewSizeSB->setValue(rc.preview_scale_factor); @@ -2438,6 +2421,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) this, SLOT(selectUi())); connect(uiFileED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(iconSetCO, SIGNAL(activated(int)), + this, SIGNAL(changed())); connect(restoreCursorCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(loadSessionCB, SIGNAL(clicked()), @@ -2457,11 +2442,25 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) connect(tooltipCB, SIGNAL(toggled(bool)), 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); } 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.ui_file = internal_path(fromqstr(uiFileED->text())); rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); @@ -2482,6 +2481,17 @@ void PrefUserInterface::apply(LyXRC & rc) const void PrefUserInterface::update(LyXRC const & rc) { + unsigned int iconset = 0; + if (!rc.icon_set.empty()) { + for ( ; iconset < icon_names_.size(); ++iconset) { + if (rc.icon_set == icon_names_[iconset].first) + break; + } + } + iconset = iconSetCO->findText(icon_names_[iconset].second); + if (iconset < 0) + iconset = 0; + iconSetCO->setCurrentIndex(iconset); uiFileED->setText(toqstr(external_path(rc.ui_file))); restoreCursorCB->setChecked(rc.use_lastfilepos); loadSessionCB->setChecked(rc.load_session); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index d567ca683a..3a6cd7289a 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -46,6 +46,7 @@ #include "ui_ShortcutUi.h" #include +#include #include @@ -426,6 +427,10 @@ public: public Q_SLOTS: void selectUi(); void on_clearSessionPB_clicked(); + +private: + /// icon names and their translations + std::vector > icon_names_; }; diff --git a/src/frontends/qt4/ui/PrefDisplayUi.ui b/src/frontends/qt4/ui/PrefDisplayUi.ui index 97425a9270..1a813930ba 100644 --- a/src/frontends/qt4/ui/PrefDisplayUi.ui +++ b/src/frontends/qt4/ui/PrefDisplayUi.ui @@ -108,41 +108,7 @@ - - - - Icon &Set: - - - iconSetCO - - - - - - - The icon set to use. Warning: size of icons may be wrong -until you save the preferences, restart LyX and choose -"Normal-sized icons" from the toolbar menu. - - - - Default - - - - - Liber - - - - - Oxygen - - - - - + Mark end of paragraphs on screen with a pilcrow character. @@ -152,7 +118,7 @@ until you save the preferences, restart LyX and choose - + Qt::Vertical diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index 70bead5457..dce282a650 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -52,7 +52,26 @@ - + + + + &Icon Set: + + + iconSetCO + + + + + + + The icon set to use. Warning: size of icons may be wrong +until you save the preferences, restart LyX and choose +"Normal-sized icons" from the toolbar menu. + + + + Automatic help @@ -83,7 +102,7 @@ - + Session @@ -122,7 +141,7 @@ - Clear all session &information + &Clear all session information @@ -142,7 +161,7 @@ - + Documents @@ -262,7 +281,7 @@ - + Qt::Vertical