mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
Make the use of system's theme icons configurable
A lyxrc variable is added and a checkbox is added to the LyX->preferences dialog.
This commit is contained in:
parent
b1f6ab69f2
commit
147dcb4cb9
@ -53,6 +53,10 @@
|
|||||||
# Incremented to format 11, by gb
|
# Incremented to format 11, by gb
|
||||||
# Split pdf format into pdf and pdf6
|
# Split pdf format into pdf and pdf6
|
||||||
|
|
||||||
|
# Incremented to format 12, by vfr
|
||||||
|
# Add option to use the system's theme icons
|
||||||
|
# No conversion necessary.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
@ -308,5 +312,6 @@ conversions = [
|
|||||||
[ 8, []],
|
[ 8, []],
|
||||||
[ 9, [ remove_default_language ]],
|
[ 9, [ remove_default_language ]],
|
||||||
[ 10, []],
|
[ 10, []],
|
||||||
[ 11, [split_pdf_format]]
|
[ 11, [split_pdf_format]],
|
||||||
|
[ 12, []]
|
||||||
]
|
]
|
||||||
|
@ -55,7 +55,7 @@ namespace os = support::os;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static unsigned int const LYXRC_FILEFORMAT = 11; // gb: Split pdf format into pdf and pdf6
|
static unsigned int const LYXRC_FILEFORMAT = 12; // vfr: System theme's icons
|
||||||
|
|
||||||
// when adding something to this array keep it sorted!
|
// when adding something to this array keep it sorted!
|
||||||
LexerKeyword lyxrcTags[] = {
|
LexerKeyword lyxrcTags[] = {
|
||||||
@ -203,6 +203,7 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\use_qimage", LyXRC::RC_USE_QIMAGE },
|
{ "\\use_qimage", LyXRC::RC_USE_QIMAGE },
|
||||||
// compatibility with versions older than 1.4.0 only
|
// compatibility with versions older than 1.4.0 only
|
||||||
{ "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
|
{ "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
|
||||||
|
{ "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
|
||||||
{ "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
|
{ "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
|
||||||
{ "\\user_email", LyXRC::RC_USER_EMAIL },
|
{ "\\user_email", LyXRC::RC_USER_EMAIL },
|
||||||
{ "\\user_name", LyXRC::RC_USER_NAME },
|
{ "\\user_name", LyXRC::RC_USER_NAME },
|
||||||
@ -228,6 +229,7 @@ LyXRC::LyXRC()
|
|||||||
void LyXRC::setDefaults()
|
void LyXRC::setDefaults()
|
||||||
{
|
{
|
||||||
icon_set = string();
|
icon_set = string();
|
||||||
|
use_system_theme_icons = false;
|
||||||
bind_file = "cua";
|
bind_file = "cua";
|
||||||
def_file = "default";
|
def_file = "default";
|
||||||
ui_file = "default";
|
ui_file = "default";
|
||||||
@ -833,6 +835,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
|||||||
lexrc >> icon_set;
|
lexrc >> icon_set;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_USE_SYSTEM_THEME_ICONS:
|
||||||
|
lexrc >> use_system_theme_icons;
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_SCREEN_FONT_ROMAN:
|
case RC_SCREEN_FONT_ROMAN:
|
||||||
if (lexrc.next()) {
|
if (lexrc.next()) {
|
||||||
roman_font_name = lexrc.getString();
|
roman_font_name = lexrc.getString();
|
||||||
@ -1701,6 +1707,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_USE_SYSTEM_THEME_ICONS:
|
||||||
|
if (ignore_system_lyxrc ||
|
||||||
|
use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
|
||||||
|
os << "\\use_system_theme_icons "
|
||||||
|
<< convert<string>(use_system_theme_icons)
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
|
if (tag != RC_LAST)
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_SCREEN_DPI:
|
case RC_SCREEN_DPI:
|
||||||
if (ignore_system_lyxrc ||
|
if (ignore_system_lyxrc ||
|
||||||
dpi != system_lyxrc.dpi) {
|
dpi != system_lyxrc.dpi) {
|
||||||
@ -3023,6 +3039,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
case LyXRC::RC_USE_TOOLTIP:
|
case LyXRC::RC_USE_TOOLTIP:
|
||||||
case LyXRC::RC_USE_PIXMAP_CACHE:
|
case LyXRC::RC_USE_PIXMAP_CACHE:
|
||||||
case LyXRC::RC_USE_QIMAGE:
|
case LyXRC::RC_USE_QIMAGE:
|
||||||
|
case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
|
||||||
case LyXRC::RC_VIEWDVI_PAPEROPTION:
|
case LyXRC::RC_VIEWDVI_PAPEROPTION:
|
||||||
case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
|
case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
|
||||||
case LyXRC::RC_SINGLE_INSTANCE:
|
case LyXRC::RC_SINGLE_INSTANCE:
|
||||||
|
@ -185,6 +185,7 @@ public:
|
|||||||
RC_USE_TOOLTIP,
|
RC_USE_TOOLTIP,
|
||||||
RC_USE_PIXMAP_CACHE,
|
RC_USE_PIXMAP_CACHE,
|
||||||
RC_USE_QIMAGE,
|
RC_USE_QIMAGE,
|
||||||
|
RC_USE_SYSTEM_THEME_ICONS,
|
||||||
RC_VIEWDVI_PAPEROPTION,
|
RC_VIEWDVI_PAPEROPTION,
|
||||||
RC_VIEWER,
|
RC_VIEWER,
|
||||||
RC_VIEWER_ALTERNATIVES,
|
RC_VIEWER_ALTERNATIVES,
|
||||||
@ -465,6 +466,8 @@ public:
|
|||||||
std::string user_email;
|
std::string user_email;
|
||||||
/// icon set name
|
/// icon set name
|
||||||
std::string icon_set;
|
std::string icon_set;
|
||||||
|
/// whether to use the icons from the theme
|
||||||
|
bool use_system_theme_icons;
|
||||||
/// True if the TeX engine cannot handle posix paths
|
/// True if the TeX engine cannot handle posix paths
|
||||||
bool windows_style_tex_paths;
|
bool windows_style_tex_paths;
|
||||||
/// True if the TeX engine can handle file names containing spaces
|
/// True if the TeX engine can handle file names containing spaces
|
||||||
|
@ -549,12 +549,14 @@ QPixmap getPixmap(QString const & path, QString const & name, QString const & ex
|
|||||||
QIcon getIcon(FuncRequest const & f, bool unknown)
|
QIcon getIcon(FuncRequest const & f, bool unknown)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= 0x040600)
|
#if (QT_VERSION >= 0x040600)
|
||||||
QString action = toqstr(lyxaction.getActionName(f.action()));
|
if (lyxrc.use_system_theme_icons) {
|
||||||
if (!f.argument().empty())
|
QString action = toqstr(lyxaction.getActionName(f.action()));
|
||||||
action += " " + toqstr(f.argument());
|
if (!f.argument().empty())
|
||||||
QString const theme_icon = themeIconName(action);
|
action += " " + toqstr(f.argument());
|
||||||
if (QIcon::hasThemeIcon(theme_icon))
|
QString const theme_icon = themeIconName(action);
|
||||||
return QIcon::fromTheme(theme_icon);
|
if (QIcon::hasThemeIcon(theme_icon))
|
||||||
|
return QIcon::fromTheme(theme_icon);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString icon = iconName(f, unknown);
|
QString icon = iconName(f, unknown);
|
||||||
|
@ -2513,6 +2513,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(iconSetCO, SIGNAL(activated(int)),
|
connect(iconSetCO, SIGNAL(activated(int)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
|
connect(useSystemThemeIconsCB, SIGNAL(clicked()),
|
||||||
|
this, SIGNAL(changed()));
|
||||||
connect(lastfilesSB, SIGNAL(valueChanged(int)),
|
connect(lastfilesSB, SIGNAL(valueChanged(int)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(tooltipCB, SIGNAL(toggled(bool)),
|
connect(tooltipCB, SIGNAL(toggled(bool)),
|
||||||
@ -2531,6 +2533,7 @@ void PrefUserInterface::apply(LyXRC & rc) const
|
|||||||
iconSetCO->currentIndex()).toString());
|
iconSetCO->currentIndex()).toString());
|
||||||
|
|
||||||
rc.ui_file = internal_path(fromqstr(uiFileED->text()));
|
rc.ui_file = internal_path(fromqstr(uiFileED->text()));
|
||||||
|
rc.use_system_theme_icons = useSystemThemeIconsCB->isChecked();
|
||||||
rc.num_lastfiles = lastfilesSB->value();
|
rc.num_lastfiles = lastfilesSB->value();
|
||||||
rc.use_tooltip = tooltipCB->isChecked();
|
rc.use_tooltip = tooltipCB->isChecked();
|
||||||
}
|
}
|
||||||
@ -2542,6 +2545,11 @@ void PrefUserInterface::update(LyXRC const & rc)
|
|||||||
if (iconset < 0)
|
if (iconset < 0)
|
||||||
iconset = 0;
|
iconset = 0;
|
||||||
iconSetCO->setCurrentIndex(iconset);
|
iconSetCO->setCurrentIndex(iconset);
|
||||||
|
#if (QT_VERSION < 0x040600)
|
||||||
|
useSystemThemeIconsCB->hide();
|
||||||
|
themeIconsLA->hide();
|
||||||
|
#endif
|
||||||
|
useSystemThemeIconsCB->setChecked(rc.use_system_theme_icons);
|
||||||
uiFileED->setText(toqstr(external_path(rc.ui_file)));
|
uiFileED->setText(toqstr(external_path(rc.ui_file)));
|
||||||
lastfilesSB->setValue(rc.num_lastfiles);
|
lastfilesSB->setValue(rc.num_lastfiles);
|
||||||
tooltipCB->setChecked(rc.use_tooltip);
|
tooltipCB->setChecked(rc.use_tooltip);
|
||||||
|
@ -100,6 +100,23 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="themeIconsLA">
|
||||||
|
<property name="text" >
|
||||||
|
<string>Use icons from system's &theme:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy" >
|
||||||
|
<cstring>useSystemThemeIconsCB</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="useSystemThemeIconsCB"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -200,6 +217,7 @@
|
|||||||
<tabstop>uiFileED</tabstop>
|
<tabstop>uiFileED</tabstop>
|
||||||
<tabstop>uiFilePB</tabstop>
|
<tabstop>uiFilePB</tabstop>
|
||||||
<tabstop>iconSetCO</tabstop>
|
<tabstop>iconSetCO</tabstop>
|
||||||
|
<tabstop>useSystemThemeIconsCB</tabstop>
|
||||||
<tabstop>tooltipCB</tabstop>
|
<tabstop>tooltipCB</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<includes>
|
<includes>
|
||||||
|
Loading…
Reference in New Issue
Block a user