Mercurial > octave
diff libgui/src/resource-manager.cc @ 30772:36dc11ee220d
reorganize GUIs icons
* FigureWindow.cc (FigureWIndow.cc): use QIcon::fromTheme
* ToolBarButton.cc (get_icon): dito
* libgui/src/icons/*.png: moved into tango/128x128/, octave/128x128/
or cursor/
* libgui/src/icons/*.svg: moved into tango/scalable/ or octave/scalable/
* libgui/src/cursors/licence.md of cursors
* libgui/src/icons/licence.md of icons
* libgui/src/icons/icons_license: removed ol file
* documentation.cc (construct_toolbar): use standard icon names for zoom icons
* m-editor/file-editor.cc (construct): dito
* main-window.cc (main_window) call ressource_manger::config_icon_theme
* module.mk: update icon paths
* octave-dock-widget.cc (label_dock_widget): use QIcon::fromTheme;
(octave_dock_widget): use QIcon::fromTheme and update icon paths in css;
(make_window): update icon paths in css;
(make_widget): update icon paths in css;
(set_style): update icon paths in css, use QIcon::fromTheme;
* octave-qobject.cc (base_object): call config_icon_theme if no gui
is started;
* ressource_mamager.cc (config_icon_theme): new function setting the
* resource-manager.h: new function config_icon_theme
* libgui/src/resource.qrc: update paths of graphics files
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Tue, 22 Feb 2022 20:54:15 +0100 |
parents | 796f54d4ddbf |
children | 94da6cc40ea9 |
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc Mon Feb 21 13:26:57 2022 -0500 +++ b/libgui/src/resource-manager.cc Tue Feb 22 20:54:15 2022 +0100 @@ -185,6 +185,30 @@ } + void resource_manager::config_icon_theme (void) + { + QStringList fallbacks (QIcon::fallbackSearchPaths ()); + +// FIXME: update fallbacks depending on selection (tango, octave or system) +// Can cursor be moce to :/cursor and added as search path +// By this, we can generate the list of themes from the :/icons dir? + + if (m_settings && (! m_settings->value (global_icon_theme).toBool ())) + { + QIcon::setThemeName ("tango"); + fallbacks << ":/icons/octave/128x128"; + } + else + { + QIcon::setThemeName (""); + fallbacks << ":/icons/octave/128x128"; + } + + fallbacks << ":/cursors"; + + QIcon::setFallbackSearchPaths (fallbacks); + } + gui_settings * resource_manager::get_settings (void) const { return m_settings; @@ -581,18 +605,8 @@ sys::env::putenv ("HTTPS_PROXY", proxy_url_str); } - QIcon resource_manager::icon (const QString& icon_name, bool fallback) + QIcon resource_manager::icon (const QString& icon_name, bool) { - // If system icon theme is not desired, take own icon files - if (! m_settings->value (global_icon_theme).toBool ()) - return QIcon (":/actions/icons/" + icon_name + ".png"); - - // Use system icon theme with own files as fallback except when the - // fallback is explicitly disabled (fallback=false) - if (fallback) - return QIcon::fromTheme (icon_name, - QIcon (":/actions/icons/" + icon_name + ".png")); - else return QIcon::fromTheme (icon_name); }