]> git.lyx.org Git - features.git/commitdiff
Move to PrefUi the icon set choice and solve problem with translation
authorEnrico Forestieri <forenr@lyx.org>
Fri, 25 Mar 2011 14:21:28 +0000 (14:21 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 25 Mar 2011 14:21:28 +0000 (14:21 +0000)
of icon set names.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38046 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdtoolbars.inc
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/ui/PrefDisplayUi.ui
src/frontends/qt4/ui/PrefUi.ui

index cdbb2c5fa37a684070f4943b06198e575f1f952a..849382ce427f1d360d93aad731b19d099ccf178c 100644 (file)
@@ -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"
index e65ca84a7f917f647670828d66c5efdccbe564bb..446027f2cfcc2c8ac5c8b3952a311afe551dfd43 100644 (file)
@@ -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);
index d567ca683a198195804198e703aff0fb6868d200..3a6cd7289ac5f991dbcdb98af8996d7103ddc94e 100644 (file)
@@ -46,6 +46,7 @@
 #include "ui_ShortcutUi.h"
 
 #include <string>
+#include <utility>
 #include <vector>
 
 
@@ -426,6 +427,10 @@ public:
 public Q_SLOTS:
        void selectUi();
        void on_clearSessionPB_clicked();
+
+private:
+       /// icon names and their translations
+       std::vector<std::pair<std::string, QString> > icon_names_;
 };
 
 
index 97425a9270d967e73eb1e30fa1c5670463631869..1a813930ba24ea13e6965df0c8b6fd07120c382a 100644 (file)
      </property>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <widget class="QLabel" name="iconSetLA" >
-     <property name="text" >
-      <string>Icon &amp;Set:</string>
-     </property>
-     <property name="buddy" >
-      <cstring>iconSetCO</cstring>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1" >
-    <widget class="QComboBox" name="iconSetCO" >
-     <property name="toolTip" >
-      <string>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.</string>
-     </property>
-     <item>
-      <property name="text" >
-       <string>Default</string>
-      </property>
-     </item>
-     <item>
-      <property name="text" >
-       <string>Liber</string>
-      </property>
-     </item>
-     <item>
-      <property name="text" >
-       <string>Oxygen</string>
-      </property>
-     </item>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="2" >
+   <item row="2" column="0" colspan="2" >
     <widget class="QCheckBox" name="paragraphMarkerCB" >
      <property name="toolTip" >
       <string>Mark end of paragraphs on screen with a pilcrow character.</string>
@@ -152,7 +118,7 @@ until you save the preferences, restart LyX and choose
      </property>
     </widget>
    </item>
-   <item row="4" column="0" >
+   <item row="3" column="0" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
index 70bead54570488abaa3f45f65cc988396b19770e..dce282a65052a1abed3f80dc95c236d10d08881c 100644 (file)
      </property>
     </spacer>
    </item>
-   <item row="1" column="0" colspan="4">
+   <item row="1" column="0" >
+    <widget class="QLabel" name="iconSetLA" >
+     <property name="text" >
+      <string>&amp;Icon Set:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>iconSetCO</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QComboBox" name="iconSetCO" >
+     <property name="toolTip" >
+      <string>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.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="4">
     <widget class="QGroupBox" name="pixmapCacheGB_2">
      <property name="title">
       <string>Automatic help</string>
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" colspan="4">
+   <item row="3" column="0" colspan="4">
     <widget class="QGroupBox" name="GeometryGB">
      <property name="title">
       <string>Session</string>
       <item row="3" column="0">
        <widget class="QPushButton" name="clearSessionPB">
         <property name="text">
-         <string>Clear all session &amp;information</string>
+         <string>&amp;Clear all session information</string>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" colspan="4">
+   <item row="4" column="0" colspan="4">
     <widget class="QGroupBox" name="documentsGB">
      <property name="title">
       <string>Documents</string>
      </layout>
     </widget>
    </item>
-   <item row="4" column="0" colspan="4">
+   <item row="5" column="0" colspan="4">
     <spacer>
      <property name="orientation">
       <enum>Qt::Vertical</enum>