]> git.lyx.org Git - features.git/commitdiff
Preferences for choosing the icon set to use. It works on the fly, but
authorEnrico Forestieri <forenr@lyx.org>
Fri, 25 Mar 2011 05:01:06 +0000 (05:01 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 25 Mar 2011 05:01:06 +0000 (05:01 +0000)
the size of icons may be wrong when switching between sets with different
normal icon size. One needs to save the preferences, restart LyX and choose
"Normal-sized icons" from the toolbar menu to have the real normal size.
A minor glitch is that the name of the icon sets is translatable, but
currently only the translation for "Default" works. The problem is that I
don't know how to ask gettext for an inverse translation when saving the
preferences. Another possibility would be hardcoding the order of the names
in the combo box (such that to not rely on their names), but that is ugly
and prone to errors if/when other sets are added.

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

src/LyXRC.cpp
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/ui/PrefDisplayUi.ui

index b0205a3fa25906a8668b70a55c941753fdda5246..215b9a606f1d5e1c6ab9045da71fad9e8d1e9319 100644 (file)
@@ -1736,7 +1736,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "#\n\n";
 
        case RC_ICON_SET:
-               os << "\\icon_set \"" << icon_set << "\"\n";
                if (ignore_system_lyxrc ||
                    icon_set != system_lyxrc.icon_set) {
                        os << "\\icon_set \"" << icon_set
@@ -2936,6 +2935,9 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_GROUP_LAYOUTS:
        case LyXRC::RC_HUNSPELLDIR_PATH:
        case LyXRC::RC_ICON_SET:
+               if (lyxrc_orig.icon_set != lyxrc_new.icon_set) {
+                       lyxrc.icon_set = lyxrc_new.icon_set;
+               }
        case LyXRC::RC_INDEX_ALTERNATIVES:
        case LyXRC::RC_INDEX_COMMAND:
        case LyXRC::RC_JBIBTEX_COMMAND:
index 61224ec7c2d665799556e4a3b24ca3e2739c755f..e65ca84a7f917f647670828d66c5efdccbe564bb 100644 (file)
@@ -1193,6 +1193,7 @@ 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()));
 }
 
@@ -1224,6 +1225,15 @@ 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();
@@ -1252,6 +1262,13 @@ 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);
index 1a813930ba24ea13e6965df0c8b6fd07120c382a..97425a9270d967e73eb1e30fa1c5670463631869 100644 (file)
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="2" >
+   <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" >
     <widget class="QCheckBox" name="paragraphMarkerCB" >
      <property name="toolTip" >
       <string>Mark end of paragraphs on screen with a pilcrow character.</string>
      </property>
     </widget>
    </item>
-   <item row="3" column="0" >
+   <item row="4" column="0" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>