Preferences for choosing the icon set to use. It works on the fly, but

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
This commit is contained in:
Enrico Forestieri 2011-03-25 05:01:06 +00:00
parent a9d65d0a4c
commit c6564028f0
3 changed files with 56 additions and 3 deletions

View 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:

View 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);

View File

@ -108,7 +108,41 @@
</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>
@ -118,7 +152,7 @@
</property>
</widget>
</item>
<item row="3" column="0" >
<item row="4" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>