# HG changeset patch # User Torsten Lilge # Date 1650730245 -7200 # Node ID 04601f6c47f4123448834f87c392ca341f9946fe # Parent f14ad09af093ee31ef20caa5d819c933457a7627 fix broken icon path after new icon structure in GUI * community-news.cc: use window icon configured in the preferences * documentation-dock-widget.cc (documentation_dock_widget) * files-dock-widget.cc (files_dock_widget) * history-dock-widget.cc (history_dock_widget) * terminal-dock-widget.cc (terminal_dock_widget) * variable-editor.cc (variable_editor) * workspace-view.cc (workspace_view) do not set window icon here as it is set in the main window * gui-preferences-dw.h: organize dw_icon_set_names in a hash * file-editor.cc (notice_settings): fix path to tab close icon on mac * find-dialog.cc (find_dialog): do not set window icon here, it is already set by the editor * main-window.cc (notice_settings): set dok widget icons using the new hash structure of available icon sets (construct): use global const settings instead of literal string for main window icon * octave-qobject.cc (release_notes_widget): pass base qobject to the release note constructor * release-notes.cc (release_notes): get qbase object as argument, get desired window icon from settings * release-notes.h: constructor with base object as argument * variable-editor.cc (toplevel_change): use icon path from const preferences instead of literal strings * welcome-wizard.cc (make_octave_logo): use icon path from const preferences instead of literal strings diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/community-news.cc --- a/libgui/src/community-news.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/community-news.cc Sat Apr 23 18:10:45 2022 +0200 @@ -33,6 +33,7 @@ #include "community-news.h" #include "gui-utils.h" +#include "gui-preferences-dw.h" #include "gui-preferences-nr.h" #include "news-reader.h" #include "octave-qobject.h" @@ -78,9 +79,14 @@ resource_manager& rmgr = oct_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); - // FIXME: should be configurable... See also the icon for the - // release notes window. - QString icon = ":/actions/icons/logo.png"; + QString icon; + QString icon_set = settings->value (dw_icon_set).toString (); + if (icon_set != "NONE") + // No extra icon for Community news, take the one of the release notes + icon = dw_icon_set_names[icon_set] + "ReleaseWidget.png"; + else + icon = dw_icon_set_names[icon_set]; + setWindowIcon (QIcon (icon)); // FIXME: This is a news reader preference, so shouldn't it be used diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/documentation-dock-widget.cc --- a/libgui/src/documentation-dock-widget.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/documentation-dock-widget.cc Sat Apr 23 18:10:45 2022 +0200 @@ -38,7 +38,6 @@ : octave_dock_widget ("DocumentationDockWidget", p, oct_qobj), m_docs (new documentation (this, oct_qobj)) { - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Documentation")); setStatusTip (tr ("See the documentation for help.")); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/files-dock-widget.cc Sat Apr 23 18:10:45 2022 +0200 @@ -182,7 +182,6 @@ files_dock_widget::files_dock_widget (QWidget *p, base_qobject& oct_qobj) : octave_dock_widget ("FilesDockWidget", p, oct_qobj) { - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("File Browser")); setToolTip (tr ("Browse your files")); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/gui-preferences-dw.h --- a/libgui/src/gui-preferences-dw.h Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/gui-preferences-dw.h Sat Apr 23 18:10:45 2022 +0200 @@ -51,14 +51,13 @@ const gui_pref dw_icon_set ("DockWidgets/widget_icon_set", QVariant ("NONE")); -const struct { QString name; QString path; } dw_icon_set_names[] +const QHash dw_icon_set_names = { // array of possible icon sets (name, path (complete for NONE)) // the first entry here is the default! - {"NONE", ":/actions/icons/logo.png"}, - {"GRAPHIC", ":/actions/icons/graphic_logo_"}, - {"LETTER", ":/actions/icons/letter_logo_"}, - {"", ""} // end marker has empty name + {"NONE", ":/icons/octave/128x128/logo.png"}, + {"GRAPHIC", ":/icons/octave/128x128/graphic_logo_"}, + {"LETTER", ":/icons/octave/128x128/letter_logo_"} }; // The following keys have to be used with .arg (objectName ()) diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/history-dock-widget.cc --- a/libgui/src/history-dock-widget.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/history-dock-widget.cc Sat Apr 23 18:10:45 2022 +0200 @@ -310,7 +310,6 @@ m_filter_checkbox = new QCheckBox (); - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Command History")); setWidget (new QWidget ()); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/m-editor/file-editor.cc Sat Apr 23 18:10:45 2022 +0200 @@ -1316,10 +1316,13 @@ // in several Qt versions (https://bugreports.qt.io/browse/QTBUG-61092) if (! rotated) { + QString icon = global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png"; + QString close_button_css_mac ( "QTabBar::close-button" - " { width: 6px; image: url(:/actions/icons/widget-close.png);" - " subcontrol-position: button; }\n" + " { image: url(" + icon + ");" + " padding: 4px;" + " subcontrol-position: bottom; }\n" "QTabBar::close-button:hover" " { background-color: #cccccc; }"); @@ -2367,7 +2370,6 @@ this, &file_editor::active_tab_changed); resize (500, 400); - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Editor")); check_actions (); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/m-editor/find-dialog.cc --- a/libgui/src/m-editor/find-dialog.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/m-editor/find-dialog.cc Sat Apr 23 18:10:45 2022 +0200 @@ -94,7 +94,6 @@ m_in_sel (false), m_sel_beg (-1), m_sel_end (-1) { setWindowTitle (tr ("Editor: Find and Replace")); - setWindowIcon (QIcon (":/actions/icons/find.png")); m_search_label = new QLabel (tr ("Find &what:")); m_search_line_edit = new QComboBox (this); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/main-window.cc Sat Apr 23 18:10:45 2022 +0200 @@ -920,23 +920,7 @@ } // the widget's icons (when floating) - QString icon_set - = settings->value (dw_icon_set).toString (); - - int count = 0; - int icon_set_found = 0; // default - - while (! dw_icon_set_names[count].name.isEmpty ()) - { - // while not end of data - if (dw_icon_set_names[count].name == icon_set) - { - // data of desired icon set found - icon_set_found = count; - break; - } - count++; - } + QString icon_set = settings->value (dw_icon_set).toString (); QString icon; for (auto *widget : dock_widget_list ()) @@ -945,8 +929,8 @@ if (! name.isEmpty ()) { // if child has a name - icon = dw_icon_set_names[icon_set_found].path; // prefix | octave-logo - if (dw_icon_set_names[icon_set_found].name != "NONE") + icon = dw_icon_set_names[icon_set]; + if (icon_set != "NONE") icon += name + ".png"; // add widget name and ext. widget->setWindowIcon (QIcon (icon)); } @@ -2021,7 +2005,7 @@ void main_window::construct (void) { - setWindowIcon (QIcon (":/actions/icons/logo.png")); + setWindowIcon (QIcon (dw_icon_set_names["NONE"])); interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/octave-qobject.cc --- a/libgui/src/octave-qobject.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/octave-qobject.cc Sat Apr 23 18:10:45 2022 +0200 @@ -732,7 +732,7 @@ QPointer base_qobject::release_notes_widget (void) { if (! m_release_notes) - m_release_notes = QPointer (new release_notes ()); + m_release_notes = QPointer (new release_notes (*this)); return m_release_notes; } diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/release-notes.cc --- a/libgui/src/release-notes.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/release-notes.cc Sat Apr 23 18:10:45 2022 +0200 @@ -38,6 +38,7 @@ #include "release-notes.h" #include "gui-utils.h" +#include "gui-preferences-dw.h" #include "gui-preferences-nr.h" #include "news-reader.h" #include "octave-qobject.h" @@ -46,19 +47,20 @@ namespace octave { - release_notes::release_notes (void) - : QWidget (nullptr), m_browser (nullptr), - m_release_notes_icon (":/actions/icons/logo.png") + release_notes::release_notes (base_qobject& oct_qobj) + : QWidget (nullptr), m_browser (nullptr) { -#if 0 - // The following code was in main-window.cc. How should that be - // handled here? - if (dw_icon_set_names[icon_set_found].name != "NONE") - m_release_notes_icon = dw_icon_set_names[icon_set_found].path + + resource_manager& rmgr = oct_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + + // The icon + QString icon_set = settings->value (dw_icon_set).toString (); + if (icon_set != "NONE") + m_release_notes_icon = dw_icon_set_names[icon_set] + "ReleaseWidget.png"; else - m_release_notes_icon = ":/actions/icons/logo.png"; -#endif + m_release_notes_icon = dw_icon_set_names[icon_set]; std::string news_file = config::oct_etc_dir () + "/NEWS"; diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/release-notes.h --- a/libgui/src/release-notes.h Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/release-notes.h Sat Apr 23 18:10:45 2022 +0200 @@ -41,7 +41,7 @@ public: - release_notes (void); + release_notes (base_qobject& qct_qobj); ~release_notes (void) = default; diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/terminal-dock-widget.cc --- a/libgui/src/terminal-dock-widget.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/terminal-dock-widget.cc Sat Apr 23 18:10:45 2022 +0200 @@ -83,7 +83,6 @@ m_terminal->setObjectName ("OctaveTerminal"); m_terminal->setFocusPolicy (Qt::StrongFocus); - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Command Window")); setWidget (m_terminal); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/variable-editor.cc --- a/libgui/src/variable-editor.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/variable-editor.cc Sat Apr 23 18:10:45 2022 +0200 @@ -51,6 +51,7 @@ #include "builtin-defun-decls.h" #include "dw-main-window.h" #include "gui-preferences-cs.h" +#include "gui-preferences-dw.h" #include "gui-preferences-global.h" #include "gui-preferences-sc.h" #include "gui-preferences-ve.h" @@ -171,7 +172,8 @@ { if (toplevel) { - m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock.png")); + m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + + "widget-dock.png")); m_dock_action->setToolTip (tr ("Dock widget")); setWindowFlags (Qt::Window); @@ -188,7 +190,8 @@ } else { - m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock.png")); + m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + + "widget-undock.png")); m_dock_action->setToolTip (tr ("Undock widget")); setFocus (); @@ -1113,7 +1116,6 @@ { set_title (tr ("Variable Editor")); setStatusTip (tr ("Edit variables.")); - setWindowIcon (QIcon (":/actions/icons/logo.png")); setAttribute (Qt::WA_AlwaysShowToolTips); m_main->setParent (this); diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/welcome-wizard.cc --- a/libgui/src/welcome-wizard.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/welcome-wizard.cc Sat Apr 23 18:10:45 2022 +0200 @@ -37,6 +37,7 @@ #include #endif +#include "gui-preferences-dw.h" #include "gui-preferences-nr.h" #include "octave-qobject.h" #include "welcome-wizard.h" @@ -47,7 +48,7 @@ make_octave_logo (QWidget *p = nullptr, int height = 100) { QLabel *logo = new QLabel (p); - QPixmap logo_pixmap (":/actions/icons/logo.png"); + QPixmap logo_pixmap (dw_icon_set_names["NONE"]); logo->setPixmap (logo_pixmap.scaledToHeight (height)); return logo; }; diff -r f14ad09af093 -r 04601f6c47f4 libgui/src/workspace-view.cc --- a/libgui/src/workspace-view.cc Sat Mar 26 23:21:59 2022 -0300 +++ b/libgui/src/workspace-view.cc Sat Apr 23 18:10:45 2022 +0200 @@ -55,7 +55,6 @@ m_filter (new QComboBox (this)), m_filter_widget (new QWidget (this)) { - setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Workspace")); setStatusTip (tr ("View the variables in the active workspace."));