Mercurial > octave
changeset 27629:8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
We'll need access to both the resource_manager and the
shortcut_manager in many objects. The shortcut_manager will be moved
to be a member of the base_qobject class instead of being a singleton,
so this change will make it easier to access both of these as well as
any other core GUI properties in any of the Octave-specific widgets
that make up the GUI.
Once again, may files are affecte but the changes are
straightforward: store a reference to the base_qobject object and
access the resource_manager object from that instead of storing a
reference to the resource_manager directly.
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/graphics/Canvas.cc Mon Nov 04 13:34:44 2019 -0500 @@ -40,8 +40,8 @@ #include "qt-graphics-toolkit.h" #include "annotation-dialog.h" +#include "octave-qobject.h" #include "qt-interpreter-events.h" -#include "resource-manager.h" #include "builtin-defun-decls.h" #include "graphics.h"
--- a/libgui/graphics/ToolBarButton.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/graphics/ToolBarButton.cc Mon Nov 04 13:34:44 2019 -0500 @@ -29,7 +29,7 @@ #include "ToolBarButton.h" #include "QtHandlesUtils.h" -#include "resource-manager.h" +#include "octave-qobject.h" namespace QtHandles {
--- a/libgui/src/dialog.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/dialog.cc Mon Nov 04 13:34:44 2019 -0500 @@ -40,7 +40,7 @@ #include <QVBoxLayout> #include "dialog.h" -#include "resource-manager.h" +#include "octave-qobject.h" namespace octave {
--- a/libgui/src/documentation-dock-widget.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/documentation-dock-widget.cc Mon Nov 04 13:34:44 2019 -0500 @@ -31,14 +31,14 @@ namespace octave { documentation_dock_widget::documentation_dock_widget (QWidget *p, - resource_manager& rmgr) - : octave_dock_widget ("DocumentationDockWidget", p, rmgr) + base_qobject& oct_qobj) + : octave_dock_widget ("DocumentationDockWidget", p, oct_qobj) { setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("Documentation")); setStatusTip (tr ("See the documentation for help.")); - m_docs = new documentation (this, rmgr); + m_docs = new documentation (this, oct_qobj); setWidget (m_docs); connect (p, SIGNAL (show_doc_signal (const QString&)),
--- a/libgui/src/documentation-dock-widget.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/documentation-dock-widget.h Mon Nov 04 13:34:44 2019 -0500 @@ -28,7 +28,7 @@ namespace octave { - class resource_manager; + class base_qobject; class documentation_dock_widget : public octave_dock_widget { @@ -36,7 +36,7 @@ public: - documentation_dock_widget (QWidget *parent, resource_manager& rmgr); + documentation_dock_widget (QWidget *parent, base_qobject& oct_qobj); ~documentation_dock_widget (void); public slots:
--- a/libgui/src/documentation.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/documentation.cc Mon Nov 04 13:34:44 2019 -0500 @@ -44,7 +44,7 @@ #include "documentation.h" #include "gui-preferences-global.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "shortcut-manager.h" #include "defaults.h" @@ -55,9 +55,9 @@ { // The documentation splitter, which is the main widget // of the doc dock widget - documentation::documentation (QWidget *p, resource_manager& rmgr) + documentation::documentation (QWidget *p, base_qobject& oct_qobj) : QSplitter (Qt::Horizontal, p), - m_resource_manager (rmgr), m_doc_widget (p), + m_octave_qobj (oct_qobj), m_doc_widget (p), m_tool_bar (new QToolBar (p)), m_query_string (QString ()), m_prev_pages_menu (new QMenu (p)), @@ -140,13 +140,14 @@ QToolButton *forward_button = new QToolButton (find_footer); forward_button->setText (tr ("Search forward")); forward_button->setToolTip (tr ("Search forward")); - forward_button->setIcon (m_resource_manager.icon ("go-down")); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + forward_button->setIcon (rmgr.icon ("go-down")); connect (forward_button, SIGNAL (pressed (void)), this, SLOT(find (void))); QToolButton *backward_button = new QToolButton (find_footer); backward_button->setText (tr ("Search backward")); backward_button->setToolTip (tr ("Search backward")); - backward_button->setIcon (m_resource_manager.icon ("go-up")); + backward_button->setIcon (rmgr.icon ("go-up")); connect (backward_button, SIGNAL (pressed (void)), this, SLOT(find_backward (void))); QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer); @@ -163,7 +164,7 @@ v_box_browser_find->addWidget (find_footer); browser_find->setLayout (v_box_browser_find); - notice_settings (m_resource_manager.get_settings ()); + notice_settings (rmgr.get_settings ()); m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut); connect (m_findnext_shortcut, SIGNAL (activated (void)), @@ -318,12 +319,13 @@ void documentation::construct_tool_bar (void) { // Home, Previous, Next - m_action_go_home = add_action (m_resource_manager.icon ("go-home"), - tr ("Go home"), SLOT (home (void)), - m_doc_browser, m_tool_bar); - m_action_go_prev = add_action (m_resource_manager.icon ("go-previous"), - tr ("Go back"), SLOT (backward (void)), - m_doc_browser, m_tool_bar); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + m_action_go_home + = add_action (rmgr.icon ("go-home"), tr ("Go home"), SLOT (home (void)), + m_doc_browser, m_tool_bar); + m_action_go_prev + = add_action (rmgr.icon ("go-previous"), tr ("Go back"), + SLOT (backward (void)), m_doc_browser, m_tool_bar); m_action_go_prev->setEnabled (false); // popdown menu with prev pages files @@ -335,9 +337,9 @@ popdown_button_prev_pages->setCheckable (false); popdown_button_prev_pages->setArrowType(Qt::DownArrow); m_tool_bar->addWidget (popdown_button_prev_pages); - m_action_go_next = add_action (m_resource_manager.icon ("go-next"), - tr ("Go forward"), SLOT (forward (void)), - m_doc_browser, m_tool_bar); + m_action_go_next + = add_action (rmgr.icon ("go-next"), tr ("Go forward"), + SLOT (forward (void)), m_doc_browser, m_tool_bar); m_action_go_next->setEnabled (false); // popdown menu with prev pages files @@ -378,21 +380,21 @@ // Find m_tool_bar->addSeparator (); - m_action_find = add_action (m_resource_manager.icon ("edit-find"), - tr ("Find"), SLOT (activate_find (void)), - this, m_tool_bar); + m_action_find + = add_action (rmgr.icon ("edit-find"), tr ("Find"), + SLOT (activate_find (void)), this, m_tool_bar); // Zoom m_tool_bar->addSeparator (); - m_action_zoom_in = add_action (m_resource_manager.icon ("zoom-in"), - tr ("Zoom in"), SLOT (zoom_in (void)), - m_doc_browser, m_tool_bar); - m_action_zoom_out = add_action (m_resource_manager.icon ("zoom-out"), - tr ("Zoom out"), SLOT (zoom_out (void)), - m_doc_browser, m_tool_bar); - m_action_zoom_original = add_action (m_resource_manager.icon ("zoom-original"), - tr ("Zoom original"), SLOT (zoom_original (void)), - m_doc_browser, m_tool_bar); + m_action_zoom_in + = add_action (rmgr.icon ("zoom-in"), tr ("Zoom in"), + SLOT (zoom_in (void)), m_doc_browser, m_tool_bar); + m_action_zoom_out + = add_action (rmgr.icon ("zoom-out"), tr ("Zoom out"), + SLOT (zoom_out (void)), m_doc_browser, m_tool_bar); + m_action_zoom_original + = add_action (rmgr.icon ("zoom-original"), tr ("Zoom original"), + SLOT (zoom_original (void)), m_doc_browser, m_tool_bar); } void documentation::global_search (void)
--- a/libgui/src/documentation.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/documentation.h Mon Nov 04 13:34:44 2019 -0500 @@ -37,7 +37,7 @@ namespace octave { - class resource_manager; + class base_qobject; //! Documentation browser derived from Textbrowser @@ -95,7 +95,7 @@ public: - documentation (QWidget *parent, resource_manager& rmgr); + documentation (QWidget *parent, base_qobject& oct_qobj); ~documentation (void); signals: @@ -143,7 +143,7 @@ //! Select all occurrences of a string in the doc browser void select_all_occurrences (const QString& text); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QHelpEngine *m_help_engine; QString m_internal_search;
--- a/libgui/src/dw-main-window.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/dw-main-window.cc Mon Nov 04 13:34:44 2019 -0500 @@ -33,33 +33,29 @@ #include <QMenu> #include "dw-main-window.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "shortcut-manager.h" namespace octave { - dw_main_window::dw_main_window (resource_manager& rmgr, QWidget *p) - : QMainWindow (p), m_resource_manager (rmgr) + dw_main_window::dw_main_window (base_qobject& oct_qobj, QWidget *p) + : QMainWindow (p), m_octave_qobj (oct_qobj) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + // Adding the actions for closing the dock widgets m_close_action - = add_action (nullptr, - m_resource_manager.icon ("window-close",false), - tr ("&Close"), - SLOT (request_close ()), this); + = add_action (nullptr, rmgr.icon ("window-close", false), + tr ("&Close"), SLOT (request_close ()), this); m_close_all_action - = add_action (nullptr, - m_resource_manager.icon ("window-close",false), - tr ("Close &All"), - SLOT (request_close_all ()), this); + = add_action (nullptr, rmgr.icon ("window-close", false), + tr ("Close &All"), SLOT (request_close_all ()), this); m_close_others_action - = add_action (nullptr, - m_resource_manager.icon ("window-close",false), - tr ("Close &Other"), - SLOT (request_close_other ()), this); + = add_action (nullptr, rmgr.icon ("window-close", false), + tr ("Close &Other"), SLOT (request_close_other ()), this); m_switch_left_action = add_action (nullptr, QIcon (), tr ("Switch to &Left Widget"), @@ -76,7 +72,7 @@ m_actions_list << m_switch_left_action; m_actions_list << m_switch_right_action; - notice_settings (m_resource_manager.get_settings ()); + notice_settings (rmgr.get_settings ()); }
--- a/libgui/src/dw-main-window.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/dw-main-window.h Mon Nov 04 13:34:44 2019 -0500 @@ -29,7 +29,7 @@ namespace octave { - class resource_manager; + class base_qobject; class dw_main_window : public QMainWindow { @@ -37,7 +37,7 @@ public: - dw_main_window (resource_manager& rmgr, QWidget *parent = nullptr); + dw_main_window (base_qobject& oct_qboj, QWidget *parent = nullptr); ~dw_main_window (void) = default; @@ -73,7 +73,7 @@ QAction *add_action (QMenu *menu, const QIcon& icon, const QString& text, const char *member, QWidget *receiver); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QList<QDockWidget *> m_dw_list;
--- a/libgui/src/external-editor-interface.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/external-editor-interface.cc Mon Nov 04 13:34:44 2019 -0500 @@ -29,13 +29,13 @@ #include "external-editor-interface.h" #include "gui-settings.h" -#include "resource-manager.h" +#include "octave-qobject.h" namespace octave { external_editor_interface::external_editor_interface (QWidget *p, - resource_manager& rmgr) - : QWidget (p), m_resource_manager (rmgr) + base_qobject& oct_qobj) + : QWidget (p), m_octave_qobj (oct_qobj) { } // Calling the external editor @@ -98,7 +98,8 @@ // Get and verify the settings of the external editor program QString external_editor_interface::external_editor (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString editor = settings->value ("customFileEditor").toString (); // check the settings (avoid an empty string)
--- a/libgui/src/external-editor-interface.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/external-editor-interface.h Mon Nov 04 13:34:44 2019 -0500 @@ -29,7 +29,7 @@ namespace octave { - class resource_manager; + class base_qobject; class external_editor_interface : public QWidget { @@ -37,7 +37,7 @@ public: - external_editor_interface (QWidget *main_win, resource_manager& rmgr); + external_editor_interface (QWidget *main_win, base_qobject& oct_qobj); ~external_editor_interface (void) = default; @@ -63,7 +63,7 @@ QString external_editor (void); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; }; }
--- a/libgui/src/files-dock-widget.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/files-dock-widget.cc Mon Nov 04 13:34:44 2019 -0500 @@ -43,8 +43,8 @@ #include "files-dock-widget.h" #include "gui-preferences-fb.h" +#include "octave-qobject.h" #include "qt-interpreter-events.h" -#include "resource-manager.h" #include "interpreter.h" #include "load-save.h" @@ -67,8 +67,8 @@ } }; - files_dock_widget::files_dock_widget (QWidget *p, resource_manager& rmgr) - : octave_dock_widget ("FilesDockWidget", p, rmgr) + 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")); @@ -127,49 +127,50 @@ QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); m_current_directory->setSizePolicy (sizePol); - QAction *directory_up_action = new QAction (m_resource_manager.icon ("go-up"), - "", m_navigation_tool_bar); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + QAction *directory_up_action + = new QAction (rmgr.icon ("go-up"), "", m_navigation_tool_bar); directory_up_action->setToolTip (tr ("One directory up")); m_sync_browser_directory_action - = new QAction (m_resource_manager.icon ("go-first"), - tr ("Show Octave directory"), m_navigation_tool_bar); + = new QAction (rmgr.icon ("go-first"), tr ("Show Octave directory"), + m_navigation_tool_bar); m_sync_browser_directory_action->setToolTip (tr ("Go to current Octave directory")); m_sync_browser_directory_action->setEnabled (false); m_sync_octave_directory_action - = new QAction (m_resource_manager.icon ("go-last"), - tr ("Set Octave directory"), m_navigation_tool_bar); + = new QAction (rmgr.icon ("go-last"), tr ("Set Octave directory"), + m_navigation_tool_bar); m_sync_octave_directory_action->setToolTip (tr ("Set Octave directory to current browser directory")); m_sync_octave_directory_action->setEnabled (false); QToolButton *popdown_button = new QToolButton (); popdown_button->setToolTip (tr ("Actions on current directory")); QMenu *popdown_menu = new QMenu (); - popdown_menu->addAction (m_resource_manager.icon ("user-home"), - tr ("Show Home Directory"), - this, SLOT (popdownmenu_home (bool))); + popdown_menu->addAction (rmgr.icon ("user-home"), + tr ("Show Home Directory"), this, + SLOT (popdownmenu_home (bool))); popdown_menu->addAction (m_sync_browser_directory_action); popdown_menu->addAction (m_sync_octave_directory_action); popdown_button->setMenu (popdown_menu); popdown_button->setPopupMode (QToolButton::InstantPopup); - popdown_button->setDefaultAction (new QAction (m_resource_manager.icon ("applications-system"), - "", - m_navigation_tool_bar)); + popdown_button->setDefaultAction (new QAction (rmgr.icon ("applications-system"), + "", m_navigation_tool_bar)); popdown_menu->addSeparator (); - popdown_menu->addAction (m_resource_manager.icon ("folder"), + popdown_menu->addAction (rmgr.icon ("folder"), tr ("Set Browser Directory..."), this, SLOT (popdownmenu_search_dir (bool))); popdown_menu->addSeparator (); - popdown_menu->addAction (m_resource_manager.icon ("edit-find"), + popdown_menu->addAction (rmgr.icon ("edit-find"), tr ("Find Files..."), this, SLOT (popdownmenu_findfiles (bool))); popdown_menu->addSeparator (); - popdown_menu->addAction (m_resource_manager.icon ("document-new"), + popdown_menu->addAction (rmgr.icon ("document-new"), tr ("New File..."), this, SLOT (popdownmenu_newfile (bool))); - popdown_menu->addAction (m_resource_manager.icon ("folder-new"), + popdown_menu->addAction (rmgr.icon ("folder-new"), tr ("New Directory..."), this, SLOT (popdownmenu_newdir (bool))); @@ -184,7 +185,7 @@ connect (m_sync_browser_directory_action, SIGNAL (triggered ()), this, SLOT (do_sync_browser_directory ())); - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); // FIXME: what should happen if settings is 0? // Create the QFileSystemModel starting in the desired directory @@ -303,7 +304,8 @@ void files_dock_widget::save_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) return; @@ -404,7 +406,8 @@ QString abs_fname = fileInfo.absoluteFilePath (); QString suffix = fileInfo.suffix ().toLower (); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString ext = settings->value (fb_txt_file_ext.key, fb_txt_file_ext.def).toString (); QStringList extensions = ext.split (";", QString::SkipEmptyParts); @@ -432,7 +435,8 @@ void files_dock_widget::toggle_header (int col) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString key = m_columns_shown_keys.at (col); bool shown = settings->value (key,false).toBool (); @@ -463,7 +467,8 @@ delete m_sig_mapper; m_sig_mapper = new QSignalMapper (this); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); for (int i = 0; i < m_columns_shown.size (); i++) { @@ -506,8 +511,10 @@ | QItemSelectionModel::Rows); } + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + // construct the context menu depending on item - menu.addAction (m_resource_manager.icon ("document-open"), tr ("Open"), + menu.addAction (rmgr.icon ("document-open"), tr ("Open"), this, SLOT (contextmenu_open (bool))); if (info.isDir ()) @@ -524,7 +531,7 @@ this, SLOT (contextmenu_copy_selection (bool))); if (info.isFile () && info.suffix () == "m") - menu.addAction (m_resource_manager.icon ("media-playback-start"), + menu.addAction (rmgr.icon ("media-playback-start"), tr ("Run"), this, SLOT (contextmenu_run (bool))); if (info.isFile ()) @@ -533,7 +540,7 @@ if (info.isDir ()) { menu.addSeparator (); - menu.addAction (m_resource_manager.icon ("go-first"), + menu.addAction (rmgr.icon ("go-first"), tr ("Set Current Directory"), this, SLOT (contextmenu_setcurrentdir (bool))); @@ -553,23 +560,23 @@ menu.addSeparator (); - menu.addAction (m_resource_manager.icon ("edit-find"), + menu.addAction (rmgr.icon ("edit-find"), tr ("Find Files..."), this, SLOT (contextmenu_findfiles (bool))); } menu.addSeparator (); menu.addAction (tr ("Rename..."), this, SLOT (contextmenu_rename (bool))); - menu.addAction (m_resource_manager.icon ("edit-delete"), + menu.addAction (rmgr.icon ("edit-delete"), tr ("Delete..."), this, SLOT (contextmenu_delete (bool))); if (info.isDir ()) { menu.addSeparator (); - menu.addAction (m_resource_manager.icon ("document-new"), + menu.addAction (rmgr.icon ("document-new"), tr ("New File..."), this, SLOT (contextmenu_newfile (bool))); - menu.addAction (m_resource_manager.icon ("folder-new"), + menu.addAction (rmgr.icon ("folder-new"), tr ("New Directory..."), this, SLOT (contextmenu_newdir (bool))); } @@ -914,9 +921,10 @@ { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly; - if (! m_resource_manager.get_settings ()->value ( - global_use_native_dialogs.key, - global_use_native_dialogs.def).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value (global_use_native_dialogs.key, + global_use_native_dialogs.def).toBool ()) opts |= QFileDialog::DontUseNativeDialog; QString dir = QFileDialog::getExistingDirectory (this,
--- a/libgui/src/files-dock-widget.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/files-dock-widget.h Mon Nov 04 13:34:44 2019 -0500 @@ -45,7 +45,7 @@ namespace octave { - class resource_manager; + class base_qobject; //! Dock widget to display files in the current directory. @@ -55,7 +55,7 @@ public: - files_dock_widget (QWidget *parent, resource_manager& rmgr); + files_dock_widget (QWidget *parent, base_qobject& oct_qobj); ~files_dock_widget (void) = default;
--- a/libgui/src/find-files-dialog.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/find-files-dialog.cc Mon Nov 04 13:34:44 2019 -0500 @@ -44,15 +44,17 @@ #include "find-files-dialog.h" #include "find-files-model.h" -#include "resource-manager.h" +#include "octave-qobject.h" namespace octave { - find_files_dialog::find_files_dialog (QWidget *p, resource_manager& rmgr) - : QDialog (p), m_resource_manager (rmgr) + find_files_dialog::find_files_dialog (QWidget *p, base_qobject& oct_qobj) + : QDialog (p), m_octave_qobj (oct_qobj) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + setWindowTitle (tr ("Find Files")); - setWindowIcon (m_resource_manager.icon ("edit-find")); + setWindowIcon (rmgr.icon ("edit-find")); m_dir_iterator = nullptr; @@ -60,7 +62,7 @@ connect (m_timer, SIGNAL (timeout (void)), this, SLOT (look_for_files (void))); - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); QLabel *file_name_label = new QLabel (tr ("Named:")); m_file_name_edit = new QLineEdit; @@ -210,7 +212,8 @@ void find_files_dialog::save_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) return; @@ -315,8 +318,9 @@ { int opts = 0; // No options by default. // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString dir =
--- a/libgui/src/find-files-dialog.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/find-files-dialog.h Mon Nov 04 13:34:44 2019 -0500 @@ -36,7 +36,7 @@ namespace octave { - class resource_manager; + class base_qobject; class find_files_dialog : public QDialog { @@ -44,7 +44,7 @@ public: - find_files_dialog (QWidget *parent, resource_manager& rmgr); + find_files_dialog (QWidget *parent, base_qobject& oct_qobj); virtual ~find_files_dialog (void); @@ -72,7 +72,7 @@ bool is_match (const QFileInfo& info); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QLineEdit *m_start_dir_edit; QLineEdit *m_file_name_edit;
--- a/libgui/src/history-dock-widget.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/history-dock-widget.cc Mon Nov 04 13:34:44 2019 -0500 @@ -36,7 +36,7 @@ #include "gui-preferences-global.h" #include "gui-preferences-hw.h" #include "history-dock-widget.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "cmd-hist.h" @@ -44,8 +44,8 @@ namespace octave { - history_dock_widget::history_dock_widget (QWidget *p, resource_manager& rmgr) - : octave_dock_widget ("HistoryDockWidget", p, rmgr) + history_dock_widget::history_dock_widget (QWidget *p, base_qobject& oct_qobj) + : octave_dock_widget ("HistoryDockWidget", p, oct_qobj) { setStatusTip (tr ("Browse and search the command history.")); @@ -90,7 +90,8 @@ void history_dock_widget::save_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) return; @@ -139,12 +140,13 @@ if (index.isValid () && index.column () == 0) { - menu.addAction (m_resource_manager.icon ("edit-copy"), - tr ("Copy"), this, SLOT (handle_contextmenu_copy (bool))); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + menu.addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this, + SLOT (handle_contextmenu_copy (bool))); menu.addAction (tr ("Evaluate"), this, SLOT (handle_contextmenu_evaluate (bool))); - menu.addAction (m_resource_manager.icon ("document-new"), - tr ("Create script"), this, + menu.addAction (rmgr.icon ("document-new"), tr ("Create script"), this, SLOT (handle_contextmenu_create_script (bool))); } if (m_filter_shown) @@ -315,7 +317,8 @@ widget ()->setLayout (hist_layout); // Init state of the filter - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); m_filter_shown = settings->value (hw_filter_shown.key, hw_filter_shown.def).toBool ();
--- a/libgui/src/history-dock-widget.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/history-dock-widget.h Mon Nov 04 13:34:44 2019 -0500 @@ -34,7 +34,7 @@ namespace octave { - class resource_manager; + class base_qobject; class history_dock_widget : public octave_dock_widget { @@ -42,7 +42,7 @@ public: - history_dock_widget (QWidget *parent, resource_manager& rmgr); + history_dock_widget (QWidget *parent, base_qobject& oct_qobj); ~history_dock_widget (void) = default;
--- a/libgui/src/m-editor/file-editor-interface.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/file-editor-interface.h Mon Nov 04 13:34:44 2019 -0500 @@ -31,14 +31,16 @@ namespace octave { + class base_qobject; + class file_editor_interface : public octave_dock_widget { Q_OBJECT public: - file_editor_interface (QWidget *p, resource_manager& rmgr) - : octave_dock_widget ("FileEditor", p, rmgr) + file_editor_interface (QWidget *p, base_qobject& oct_qobj) + : octave_dock_widget ("FileEditor", p, oct_qobj) { } virtual ~file_editor_interface (void) = default;
--- a/libgui/src/m-editor/file-editor-tab.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Mon Nov 04 13:34:44 2019 -0500 @@ -64,8 +64,8 @@ #include "file-editor.h" #include "gui-preferences-ed.h" #include "marker.h" +#include "octave-qobject.h" #include "octave-txt-lexer.h" -#include "resource-manager.h" #include "cmd-edit.h" #include "file-ops.h" @@ -95,9 +95,9 @@ // Make parent null for the file editor tab so that warning WindowModal // messages don't affect grandparents. - file_editor_tab::file_editor_tab (resource_manager& rmgr, + file_editor_tab::file_editor_tab (base_qobject& oct_qobj, const QString& directory_arg) - : m_resource_manager (rmgr) + : m_octave_qobj (oct_qobj) { m_lexer_apis = nullptr; m_is_octave_file = true; @@ -108,7 +108,7 @@ m_file_name = ""; m_file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller"); - m_edit_area = new octave_qscintilla (this, m_resource_manager); + m_edit_area = new octave_qscintilla (this, m_octave_qobj); m_line = 0; m_col = 0; @@ -256,7 +256,8 @@ connect (this, SIGNAL (do_save_file_signal (const QString&, bool, bool)), this, SLOT (do_save_file (const QString&, bool, bool))); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings) notice_settings (settings, true); @@ -698,7 +699,8 @@ { QsciLexer *lexer = m_edit_area->lexer (); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (m_lexer_apis) { @@ -1658,7 +1660,8 @@ if (input_str) { bool ok; - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); used_comment_str = QInputDialog::getText (this, tr ("Comment selected text"), @@ -2042,7 +2045,8 @@ "This does not change the default encoding.\n")); QComboBox *enc_combo = new QComboBox (); - m_resource_manager.combo_encoding (enc_combo); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + rmgr.combo_encoding (enc_combo); m_new_encoding = enc_combo->currentText (); connect (enc_combo, SIGNAL (currentTextChanged (const QString&)), this , SLOT (handle_current_enc_changed (const QString&))); @@ -2099,7 +2103,8 @@ #else int os_eol_mode = QsciScintilla::EolUnix; #endif - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QsciScintilla::EolMode eol_mode = static_cast<QsciScintilla::EolMode> (settings->value ("editor/default_eol_mode",os_eol_mode).toInt ()); @@ -2182,7 +2187,8 @@ { update_window_title (false); // window title (no modification) - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); // set the eol mode from the settings or depending on the OS if the entry is // missing in the settings @@ -2484,8 +2490,9 @@ fileDialog->setViewMode (QFileDialog::Detail); // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) fileDialog->setOption(QFileDialog::DontUseNativeDialog); connect (fileDialog, SIGNAL (filterSelected (const QString&)),
--- a/libgui/src/m-editor/file-editor-tab.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/file-editor-tab.h Mon Nov 04 13:34:44 2019 -0500 @@ -40,12 +40,12 @@ #include "marker.h" #include "octave-qscintilla.h" #include "qt-interpreter-events.h" -#include "resource-manager.h" class octave_value_list; namespace octave { + class base_qobject; class file_editor; class file_editor_tab : public QWidget @@ -54,7 +54,7 @@ public: - file_editor_tab (resource_manager& rmgr, const QString& directory = ""); + file_editor_tab (base_qobject& oct_qobj, const QString& directory = ""); ~file_editor_tab (void); @@ -269,7 +269,7 @@ private: - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; struct bp_info {
--- a/libgui/src/m-editor/file-editor.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/file-editor.cc Mon Nov 04 13:34:44 2019 -0500 @@ -44,7 +44,7 @@ #include "gui-preferences-ed.h" #include "gui-preferences-global.h" #include "main-window.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "shortcut-manager.h" #include "oct-env.h" @@ -84,8 +84,8 @@ // File editor - file_editor::file_editor (QWidget *p, resource_manager& rmgr) - : file_editor_interface (p, rmgr) + file_editor::file_editor (QWidget *p, base_qobject& oct_qobj) + : file_editor_interface (p, oct_qobj) { // Set current editing directory before construct because loaded // files will change ced accordingly. @@ -157,7 +157,8 @@ void file_editor::handle_enter_debug_mode (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString sc_run = settings->value ("shortcuts/editor_run:run_file").toString (); QString sc_cont = settings->value ("shortcuts/main_debug:continue").toString (); @@ -219,7 +220,8 @@ // 2. When the editor becomes visible when octave is running void file_editor::empty_script (bool startup, bool visible) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings->value ("useCustomFileEditor",false).toBool ()) return; // do not open an empty script in the external editor @@ -426,7 +428,8 @@ // Here, the application or the editor will be closed -> store the session // Save open files for restoring in next session; this only is possible - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); // save filenames (even if last session will not be restored next time) // together with encoding and the tab index @@ -811,6 +814,8 @@ QObject *fileEditorTab = sender (); if (fileEditorTab) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + for (int i = 0; i < m_tab_widget->count (); i++) { if (m_tab_widget->widget (i) == fileEditorTab) @@ -818,8 +823,7 @@ m_tab_widget->setTabText (i, fname); m_tab_widget->setTabToolTip (i, tip); if (modified) - m_tab_widget->setTabIcon (i, - m_resource_manager.icon ("document-save")); + m_tab_widget->setTabIcon (i, rmgr.icon ("document-save")); else m_tab_widget->setTabIcon (i, QIcon ()); } @@ -1321,7 +1325,8 @@ if (m_closed && visible) { m_closed = false; - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); restore_session (settings); } @@ -1383,7 +1388,8 @@ if (call_custom_editor (openFileName, line)) return; // custom editor called - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); bool show_dbg_file = settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool (); @@ -1660,7 +1666,8 @@ // handler for the close event void file_editor::closeEvent (QCloseEvent *e) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings->value ("editor/hiding_closes_files",false).toBool ()) { if (check_closing ()) @@ -1733,8 +1740,10 @@ m_tab_widget = new file_editor_tab_widget (editor_widget); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + // the mru-list and an empty array of actions - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); m_mru_files = settings->value ("editor/mru_file_list").toStringList (); m_mru_files_encodings = settings->value ("editor/mru_file_encodings") .toStringList (); @@ -1775,79 +1784,61 @@ m_fileMenu->addSeparator (); m_save_action - = add_action (m_fileMenu, - m_resource_manager.icon ("document-save"), - tr ("&Save File"), - SLOT (request_save_file (bool))); + = add_action (m_fileMenu, rmgr.icon ("document-save"), + tr ("&Save File"), SLOT (request_save_file (bool))); m_save_as_action - = add_action (m_fileMenu, - m_resource_manager.icon ("document-save-as"), + = add_action (m_fileMenu, rmgr.icon ("document-save-as"), tr ("Save File &As..."), SLOT (request_save_file_as (bool))); m_fileMenu->addSeparator (); m_close_action - = add_action (m_fileMenu, - m_resource_manager.icon ("window-close",false), - tr ("&Close"), - SLOT (request_close_file (bool))); + = add_action (m_fileMenu, rmgr.icon ("window-close",false), + tr ("&Close"), SLOT (request_close_file (bool))); m_close_all_action - = add_action (m_fileMenu, - m_resource_manager.icon ("window-close",false), - tr ("Close All"), - SLOT (request_close_all_files (bool))); + = add_action (m_fileMenu, rmgr.icon ("window-close",false), + tr ("Close All"), SLOT (request_close_all_files (bool))); m_close_others_action - = add_action (m_fileMenu, - m_resource_manager.icon ("window-close",false), + = add_action (m_fileMenu, rmgr.icon ("window-close",false), tr ("Close Other Files"), SLOT (request_close_other_files (bool))); m_fileMenu->addSeparator (); m_print_action - = add_action (m_fileMenu, - m_resource_manager.icon ("document-print"), - tr ("Print..."), - SLOT (request_print_file (bool))); + = add_action (m_fileMenu, rmgr.icon ("document-print"), + tr ("Print..."), SLOT (request_print_file (bool))); // edit menu (undo, copy, paste and select all later via main window) m_edit_menu = add_menu (m_menu_bar, tr ("&Edit")); m_redo_action - = add_action (m_edit_menu, - m_resource_manager.icon ("edit-redo"), - tr ("&Redo"), - SLOT (request_redo (bool))); + = add_action (m_edit_menu, rmgr.icon ("edit-redo"), + tr ("&Redo"), SLOT (request_redo (bool))); m_redo_action->setEnabled (false); m_edit_menu->addSeparator (); m_cut_action - = add_action (m_edit_menu, - m_resource_manager.icon ("edit-cut"), - tr ("Cu&t"), - SLOT (request_cut (bool))); + = add_action (m_edit_menu, rmgr.icon ("edit-cut"), + tr ("Cu&t"), SLOT (request_cut (bool))); m_cut_action->setEnabled (false); m_find_action - = add_action (m_edit_menu, - m_resource_manager.icon ("edit-find-replace"), - tr ("&Find and Replace..."), - SLOT (request_find (bool))); + = add_action (m_edit_menu, rmgr.icon ("edit-find-replace"), + tr ("&Find and Replace..."), SLOT (request_find (bool))); m_find_next_action - = add_action (m_edit_menu, - tr ("Find &Next..."), + = add_action (m_edit_menu, tr ("Find &Next..."), SLOT (request_find_next (bool))); m_find_previous_action - = add_action (m_edit_menu, - tr ("Find &Previous..."), + = add_action (m_edit_menu, tr ("Find &Previous..."), SLOT (request_find_previous (bool))); m_edit_menu->addSeparator (); @@ -1855,105 +1846,87 @@ m_edit_cmd_menu = m_edit_menu->addMenu (tr ("&Commands")); m_delete_line_action - = add_action (m_edit_cmd_menu, - tr ("Delete Line"), + = add_action (m_edit_cmd_menu, tr ("Delete Line"), SLOT (request_delete_line (bool))); m_copy_line_action - = add_action (m_edit_cmd_menu, - tr ("Copy Line"), + = add_action (m_edit_cmd_menu, tr ("Copy Line"), SLOT (request_copy_line (bool))); m_cut_line_action - = add_action (m_edit_cmd_menu, - tr ("Cut Line"), + = add_action (m_edit_cmd_menu, tr ("Cut Line"), SLOT (request_cut_line (bool))); m_edit_cmd_menu->addSeparator (); m_delete_start_word_action - = add_action (m_edit_cmd_menu, - tr ("Delete to Start of Word"), + = add_action (m_edit_cmd_menu, tr ("Delete to Start of Word"), SLOT (request_delete_start_word (bool))); m_delete_end_word_action - = add_action (m_edit_cmd_menu, - tr ("Delete to End of Word"), + = add_action (m_edit_cmd_menu, tr ("Delete to End of Word"), SLOT (request_delete_end_word (bool))); m_delete_start_line_action - = add_action (m_edit_cmd_menu, - tr ("Delete to Start of Line"), + = add_action (m_edit_cmd_menu, tr ("Delete to Start of Line"), SLOT (request_delete_start_line (bool))); m_delete_end_line_action - = add_action (m_edit_cmd_menu, - tr ("Delete to End of Line"), + = add_action (m_edit_cmd_menu, tr ("Delete to End of Line"), SLOT (request_delete_end_line (bool))); m_edit_cmd_menu->addSeparator (); m_duplicate_selection_action - = add_action (m_edit_cmd_menu, - tr ("Duplicate Selection/Line"), + = add_action (m_edit_cmd_menu, tr ("Duplicate Selection/Line"), SLOT (request_duplicate_selection (bool))); m_transpose_line_action - = add_action (m_edit_cmd_menu, - tr ("Transpose Line"), + = add_action (m_edit_cmd_menu, tr ("Transpose Line"), SLOT (request_transpose_line (bool))); m_edit_cmd_menu->addSeparator (); m_completion_action - = add_action (m_edit_cmd_menu, - tr ("&Show Completion List"), + = add_action (m_edit_cmd_menu, tr ("&Show Completion List"), SLOT (request_completion (bool))); m_edit_fmt_menu = m_edit_menu->addMenu (tr ("&Format")); m_upper_case_action - = add_action (m_edit_fmt_menu, - tr ("&Uppercase Selection"), + = add_action (m_edit_fmt_menu, tr ("&Uppercase Selection"), SLOT (request_upper_case (bool))); m_lower_case_action - = add_action (m_edit_fmt_menu, - tr ("&Lowercase Selection"), + = add_action (m_edit_fmt_menu, tr ("&Lowercase Selection"), SLOT (request_lower_case (bool))); m_edit_fmt_menu->addSeparator (); m_comment_selection_action - = add_action (m_edit_fmt_menu, - tr ("&Comment"), + = add_action (m_edit_fmt_menu, tr ("&Comment"), SLOT (request_comment_selected_text (bool))); m_uncomment_selection_action - = add_action (m_edit_fmt_menu, - tr ("&Uncomment"), + = add_action (m_edit_fmt_menu, tr ("&Uncomment"), SLOT (request_uncomment_selected_text (bool))); m_comment_var_selection_action - = add_action (m_edit_fmt_menu, - tr ("Comment (Choosing String)"), + = add_action (m_edit_fmt_menu, tr ("Comment (Choosing String)"), SLOT (request_comment_var_selected_text (bool))); m_edit_fmt_menu->addSeparator (); m_indent_selection_action - = add_action (m_edit_fmt_menu, - tr ("&Indent Selection Rigidly"), + = add_action (m_edit_fmt_menu, tr ("&Indent Selection Rigidly"), SLOT (request_indent_selected_text (bool))); m_unindent_selection_action - = add_action (m_edit_fmt_menu, - tr ("&Unindent Selection Rigidly"), + = add_action (m_edit_fmt_menu, tr ("&Unindent Selection Rigidly"), SLOT (request_unindent_selected_text (bool))); m_smart_indent_line_or_selection_action - = add_action (m_edit_fmt_menu, - tr ("Indent Code"), + = add_action (m_edit_fmt_menu, tr ("Indent Code"), SLOT (request_smart_indent_line_or_selected_text (void))); m_edit_fmt_menu->addSeparator (); @@ -1964,8 +1937,7 @@ SLOT (request_conv_eol_windows (bool))); m_conv_eol_unix_action - = add_action (m_edit_fmt_menu, - tr ("Convert Line Endings to &Unix (LF)"), + = add_action (m_edit_fmt_menu, tr ("Convert Line Endings to &Unix (LF)"), SLOT (request_conv_eol_unix (bool))); m_conv_eol_mac_action @@ -1976,54 +1948,46 @@ m_edit_nav_menu = m_edit_menu->addMenu (tr ("Navi&gation")); m_goto_line_action - = add_action (m_edit_nav_menu, - tr ("Go &to Line..."), + = add_action (m_edit_nav_menu, tr ("Go &to Line..."), SLOT (request_goto_line (bool))); m_edit_cmd_menu->addSeparator (); m_move_to_matching_brace - = add_action (m_edit_nav_menu, - tr ("Move to Matching Brace"), + = add_action (m_edit_nav_menu, tr ("Move to Matching Brace"), SLOT (request_move_match_brace (bool))); m_sel_to_matching_brace - = add_action (m_edit_nav_menu, - tr ("Select to Matching Brace"), + = add_action (m_edit_nav_menu, tr ("Select to Matching Brace"), SLOT (request_sel_match_brace (bool))); m_edit_nav_menu->addSeparator (); m_next_bookmark_action - = add_action (m_edit_nav_menu, - tr ("&Next Bookmark"), + = add_action (m_edit_nav_menu, tr ("&Next Bookmark"), SLOT (request_next_bookmark (bool))); m_previous_bookmark_action - = add_action (m_edit_nav_menu, - tr ("Pre&vious Bookmark"), + = add_action (m_edit_nav_menu, tr ("Pre&vious Bookmark"), SLOT (request_previous_bookmark (bool))); m_toggle_bookmark_action - = add_action (m_edit_nav_menu, - tr ("Toggle &Bookmark"), + = add_action (m_edit_nav_menu, tr ("Toggle &Bookmark"), SLOT (request_toggle_bookmark (bool))); m_remove_bookmark_action - = add_action (m_edit_nav_menu, - tr ("&Remove All Bookmarks"), + = add_action (m_edit_nav_menu, tr ("&Remove All Bookmarks"), SLOT (request_remove_bookmark (bool))); m_edit_menu->addSeparator (); m_preferences_action - = add_action (m_edit_menu, - m_resource_manager.icon ("preferences-system"), + = add_action (m_edit_menu, rmgr.icon ("preferences-system"), tr ("&Preferences..."), SLOT (request_preferences (bool))); m_styles_preferences_action - = add_action (m_edit_menu, m_resource_manager.icon ("preferences-system"), + = add_action (m_edit_menu, rmgr.icon ("preferences-system"), tr ("&Styles Preferences..."), SLOT (request_styles_preferences (bool))); @@ -2034,71 +1998,59 @@ m_view_editor_menu = view_menu->addMenu (tr ("&Editor")); m_show_linenum_action - = add_action (m_view_editor_menu, - tr ("Show &Line Numbers"), + = add_action (m_view_editor_menu, tr ("Show &Line Numbers"), SLOT (show_line_numbers (bool))); m_show_linenum_action->setCheckable (true); m_show_whitespace_action - = add_action (m_view_editor_menu, - tr ("Show &Whitespace Characters"), + = add_action (m_view_editor_menu, tr ("Show &Whitespace Characters"), SLOT (show_white_space (bool))); m_show_whitespace_action->setCheckable (true); m_show_eol_action - = add_action (m_view_editor_menu, - tr ("Show Line &Endings"), + = add_action (m_view_editor_menu, tr ("Show Line &Endings"), SLOT (show_eol_chars (bool))); m_show_eol_action->setCheckable (true); m_show_indguide_action - = add_action (m_view_editor_menu, - tr ("Show &Indentation Guides"), + = add_action (m_view_editor_menu, tr ("Show &Indentation Guides"), SLOT (show_indent_guides (bool))); m_show_indguide_action->setCheckable (true); m_show_longline_action - = add_action (m_view_editor_menu, - tr ("Show Long Line &Marker"), + = add_action (m_view_editor_menu, tr ("Show Long Line &Marker"), SLOT (show_long_line (bool))); m_show_longline_action->setCheckable (true); m_view_editor_menu->addSeparator (); m_show_toolbar_action - = add_action (m_view_editor_menu, - tr ("Show &Toolbar"), + = add_action (m_view_editor_menu, tr ("Show &Toolbar"), SLOT (show_toolbar (bool))); m_show_toolbar_action->setCheckable (true); m_show_statusbar_action - = add_action (m_view_editor_menu, - tr ("Show &Statusbar"), + = add_action (m_view_editor_menu, tr ("Show &Statusbar"), SLOT (show_statusbar (bool))); m_show_statusbar_action->setCheckable (true); m_show_hscrollbar_action - = add_action (m_view_editor_menu, - tr ("Show &Horizontal Scrollbar"), + = add_action (m_view_editor_menu, tr ("Show &Horizontal Scrollbar"), SLOT (show_hscrollbar (bool))); m_show_hscrollbar_action->setCheckable (true); view_menu->addSeparator (); m_zoom_in_action - = add_action (view_menu, m_resource_manager.icon ("zoom-in"), - tr ("Zoom &In"), + = add_action (view_menu, rmgr.icon ("zoom-in"), tr ("Zoom &In"), SLOT (zoom_in (bool))); m_zoom_out_action - = add_action (view_menu, m_resource_manager.icon ("zoom-out"), - tr ("Zoom &Out"), + = add_action (view_menu, rmgr.icon ("zoom-out"), tr ("Zoom &Out"), SLOT (zoom_out (bool))); m_zoom_normal_action - = add_action (view_menu, - tr ("&Normal Size"), - SLOT (zoom_normal (bool))); + = add_action (view_menu, tr ("&Normal Size"), SLOT (zoom_normal (bool))); view_menu->addSeparator (); @@ -2114,26 +2066,22 @@ m_debug_menu = add_menu (m_menu_bar, tr ("&Debug")); m_toggle_breakpoint_action - = add_action (m_debug_menu, - m_resource_manager.icon ("bp-toggle"), + = add_action (m_debug_menu, rmgr.icon ("bp-toggle"), tr ("Toggle &Breakpoint"), SLOT (request_toggle_breakpoint (bool))); m_next_breakpoint_action - = add_action (m_debug_menu, - m_resource_manager.icon ("bp-next"), + = add_action (m_debug_menu, rmgr.icon ("bp-next"), tr ("&Next Breakpoint"), SLOT (request_next_breakpoint (bool))); m_previous_breakpoint_action - = add_action (m_debug_menu, - m_resource_manager.icon ("bp-prev"), + = add_action (m_debug_menu, rmgr.icon ("bp-prev"), tr ("Pre&vious Breakpoint"), SLOT (request_previous_breakpoint (bool))); m_remove_all_breakpoints_action - = add_action (m_debug_menu, - m_resource_manager.icon ("bp-rm-all"), + = add_action (m_debug_menu, rmgr.icon ("bp-rm-all"), tr ("&Remove All Breakpoints"), SLOT (request_remove_breakpoint (bool))); @@ -2147,7 +2095,7 @@ m_run_action = add_action (_run_menu, - m_resource_manager.icon ("system-run"), + rmgr.icon ("system-run"), tr ("Save File and Run / Continue"), SLOT (request_run_file (bool))); @@ -2270,7 +2218,7 @@ file_editor_tab * file_editor::make_file_editor_tab (const QString& directory) { - file_editor_tab *f = new file_editor_tab (m_resource_manager, directory); + file_editor_tab *f = new file_editor_tab (m_octave_qobj, directory); // signals from the qscintilla edit area connect (f->qsci_edit_area (), SIGNAL (status_update (bool, bool)), @@ -2520,7 +2468,8 @@ } // save actual mru-list in settings - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); settings->setValue ("editor/mru_file_list", m_mru_files); settings->setValue ("editor/mru_file_encodings", m_mru_files_encodings); @@ -2530,7 +2479,8 @@ bool file_editor::call_custom_editor (const QString& file_name, int line) { // Check if the user wants to use a custom file editor. - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings->value ("useCustomFileEditor",false).toBool ()) { @@ -2549,7 +2499,8 @@ void file_editor::toggle_preference (const QString& preference, bool def) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); bool old = settings->value (preference,def).toBool (); settings->setValue (preference,! old); notice_settings (settings);
--- a/libgui/src/m-editor/file-editor.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/file-editor.h Mon Nov 04 13:34:44 2019 -0500 @@ -41,6 +41,8 @@ namespace octave { + class base_qobject; + // subclassed QTabWidget for using custom tabbar class file_editor_tab_widget : public QTabWidget @@ -88,7 +90,7 @@ } }; - file_editor (QWidget *p, resource_manager& rmgr); + file_editor (QWidget *p, base_qobject& oct_qobj); ~file_editor (void);
--- a/libgui/src/m-editor/octave-qscintilla.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.cc Mon Nov 04 13:34:44 2019 -0500 @@ -55,8 +55,8 @@ #include "gui-preferences-ed.h" // FIXME: hardwired marker numbers? #include "marker.h" +#include "octave-qobject.h" #include "octave-qscintilla.h" -#include "resource-manager.h" #include "shortcut-manager.h" #include "builtin-defun-decls.h" @@ -108,8 +108,8 @@ return retval; } - octave_qscintilla::octave_qscintilla (QWidget *p, resource_manager& rmgr) - : QsciScintilla (p), m_resource_manager (rmgr), m_word_at_cursor (), + octave_qscintilla::octave_qscintilla (QWidget *p, base_qobject& oct_qobj) + : QsciScintilla (p), m_octave_qobj (oct_qobj), m_word_at_cursor (), m_selection (), m_selection_replacement (), m_selection_line (-1), m_selection_col (-1), m_indicator_id (1) { @@ -397,7 +397,8 @@ case SCLEX_MATLAB: #endif { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); int comment_string; if (comment) @@ -772,14 +773,15 @@ void octave_qscintilla::contextmenu_run (bool) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); // Create tmp file required for adding command to history QPointer<QTemporaryFile> tmp_hist - = m_resource_manager.create_tmp_file (); // empty tmp file for history + = rmgr.create_tmp_file (); // empty tmp file for history // Create tmp file required for the script echoing and adding cmd to hist QPointer<QTemporaryFile> tmp_script - = m_resource_manager.create_tmp_file ("m"); // tmp script file + = rmgr.create_tmp_file ("m"); // tmp script file bool tmp = (tmp_hist && tmp_hist->open () && tmp_script && tmp_script->open()); @@ -850,7 +852,7 @@ // Create tmp file with the code to be executed by the interpreter QPointer<QTemporaryFile> tmp_file - = m_resource_manager.create_tmp_file ("m", code); + = rmgr.create_tmp_file ("m", code); tmp = (tmp_file && tmp_file->open ()); if (! tmp) @@ -862,7 +864,7 @@ tmp_file->close (); // Disable opening a file at a breakpoint in case keyboard () is used - gui_settings* settings = m_resource_manager.get_settings (); + gui_settings* settings = rmgr.get_settings (); bool show_dbg_file = settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool (); settings->setValue (ed_show_dbg_file.key, false); @@ -903,11 +905,12 @@ QTemporaryFile* tmp_hist, QTemporaryFile* tmp_script) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); settings->setValue (ed_show_dbg_file.key, show_dbg_file); - m_resource_manager.remove_tmp_file (tmp_file); - m_resource_manager.remove_tmp_file (tmp_hist); - m_resource_manager.remove_tmp_file (tmp_script); + rmgr.remove_tmp_file (tmp_file); + rmgr.remove_tmp_file (tmp_hist); + rmgr.remove_tmp_file (tmp_script); }
--- a/libgui/src/m-editor/octave-qscintilla.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.h Mon Nov 04 13:34:44 2019 -0500 @@ -36,7 +36,7 @@ namespace octave { - class resource_manager; + class base_qobject; class octave_qscintilla : public QsciScintilla { @@ -44,7 +44,7 @@ public: - octave_qscintilla (QWidget *p, resource_manager& rmgr); + octave_qscintilla (QWidget *p, base_qobject& oct_qobj); ~octave_qscintilla (void) = default; @@ -126,7 +126,7 @@ void auto_close (int auto_endif, int l, const QString& line, QString& first_word); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QString m_word_at_cursor;
--- a/libgui/src/main-window.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/main-window.cc Mon Nov 04 13:34:44 2019 -0500 @@ -89,13 +89,13 @@ namespace octave { static file_editor_interface * - create_default_editor (QWidget *p, resource_manager& rmgr) + create_default_editor (QWidget *p, base_qobject& oct_qobj) { #if defined (HAVE_QSCINTILLA) - return new file_editor (p, rmgr); + return new file_editor (p, oct_qobj); #else octave_unused_parameter (p); - octave_unused_parameter (rmgr); + octave_unused_parameter (oct_qobj); return 0; #endif @@ -103,13 +103,12 @@ main_window::main_window (base_qobject& oct_qobj) : QMainWindow (), m_octave_qobj (oct_qobj), - m_resource_manager (m_octave_qobj.get_resource_manager ()), m_workspace_model (nullptr), m_status_bar (nullptr), m_command_window (nullptr), m_history_window (nullptr), m_file_browser_window (nullptr), m_doc_browser_window (nullptr), m_editor_window (nullptr), m_workspace_window (nullptr), m_variable_editor_window (nullptr), - m_external_editor (new external_editor_interface (this, m_resource_manager)), + m_external_editor (new external_editor_interface (this, m_octave_qobj)), m_active_editor (m_external_editor), m_settings_dlg (nullptr), m_find_files_dlg (nullptr), m_set_path_dlg (nullptr), m_release_notes_window (nullptr), m_community_news_window (nullptr), @@ -117,29 +116,31 @@ m_prevent_readline_conflicts (true), m_suppress_dbg_location (true), m_closing (false), m_file_encoding (QString ()) { - if (m_resource_manager.is_first_run ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + if (rmgr.is_first_run ()) { // Before wizard. m_octave_qobj.config_translators (); - welcome_wizard welcomeWizard (m_resource_manager); + welcome_wizard welcomeWizard (m_octave_qobj); if (welcomeWizard.exec () == QDialog::Rejected) exit (1); // Install settings file. - m_resource_manager.reload_settings (); + rmgr.reload_settings (); } else { // Get settings file. - m_resource_manager.reload_settings (); + rmgr.reload_settings (); // After settings. m_octave_qobj.config_translators (); } - m_resource_manager.update_network_settings (); + rmgr.update_network_settings (); // We provide specific terminal capabilities, so ensure that // TERM is always set appropriately. @@ -154,16 +155,15 @@ construct_central_widget (); - m_workspace_model = new workspace_model (m_resource_manager); + m_workspace_model = new workspace_model (m_octave_qobj); m_status_bar = new QStatusBar (); - m_command_window = new terminal_dock_widget (this, m_resource_manager); - m_history_window = new history_dock_widget (this, m_resource_manager); - m_file_browser_window = new files_dock_widget (this, m_resource_manager); - m_doc_browser_window - = new documentation_dock_widget (this, m_resource_manager); - m_editor_window = create_default_editor (this, m_resource_manager); - m_variable_editor_window = new variable_editor (this, m_resource_manager); - m_workspace_window = new workspace_view (this, m_resource_manager); + m_command_window = new terminal_dock_widget (this, m_octave_qobj); + m_history_window = new history_dock_widget (this, m_octave_qobj); + m_file_browser_window = new files_dock_widget (this, m_octave_qobj); + m_doc_browser_window = new documentation_dock_widget (this, m_octave_qobj); + m_editor_window = create_default_editor (this, m_octave_qobj); + m_variable_editor_window = new variable_editor (this, m_octave_qobj); + m_workspace_window = new workspace_view (this, m_octave_qobj); // Set active editor depending on editor window. If the latter is // not initialized (qscintilla not present), use the external editor. @@ -180,7 +180,7 @@ m_default_style = qapp->style ()->objectName (); - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); bool connect_to_web = true; QDateTime last_checked; @@ -263,7 +263,8 @@ { bool closenow = true; - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings->value ("prompt_to_exit", false).toBool ()) { @@ -351,7 +352,8 @@ void main_window::request_reload_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings) emit settings_changed (settings); @@ -366,8 +368,9 @@ { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = 0; // No options by default. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString file @@ -390,8 +393,9 @@ { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = 0; // No options by default. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString file = file_arg; @@ -665,7 +669,8 @@ void main_window::load_and_display_community_news (int serial) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); bool connect_to_web = (settings @@ -678,8 +683,8 @@ QThread *worker_thread = new QThread; - news_reader *reader = new news_reader (m_resource_manager, base_url, - page, serial, connect_to_web); + news_reader *reader = new news_reader (m_octave_qobj, base_url, page, + serial, connect_to_web); reader->moveToThread (worker_thread); @@ -786,8 +791,7 @@ return; } - m_settings_dlg - = new settings_dialog (this, m_resource_manager, desired_tab); + m_settings_dlg = new settings_dialog (this, m_octave_qobj, desired_tab); connect (m_settings_dlg, SIGNAL (apply_new_settings (void)), this, SLOT (request_reload_settings (void))); @@ -900,7 +904,8 @@ m_suppress_dbg_location = ! settings->value ("terminal/print_debug_location", false).toBool (); - m_resource_manager.update_network_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + rmgr.update_network_settings (); emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles @@ -975,8 +980,9 @@ { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly; - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString dir @@ -1230,7 +1236,8 @@ // Open file isn't a file_editor_tab or editor function since the file // might be opened in an external editor. Hence, functionality is here. - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); bool is_internal = m_editor_window && ! settings->value ("useCustomFileEditor",false).toBool (); @@ -1247,8 +1254,7 @@ fileDialog->setDirectory (m_current_directory_combo_box->itemText (0)); // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + if (! settings->value ("use_native_file_dialogs", true).toBool ()) fileDialog->setOption(QFileDialog::DontUseNativeDialog); connect (fileDialog, SIGNAL (filesSelected (const QStringList&)), @@ -1273,7 +1279,8 @@ // editor window or the main window. The latter is chosen, if a custom // editor is used or qscintilla is not available QWidget *p = m_editor_window; - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! p || settings->value ("useCustomFileEditor",false).toBool ()) p = this; QString new_name = QInputDialog::getText (p, tr ("New Function"), @@ -1432,7 +1439,8 @@ void main_window::read_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) { @@ -1532,7 +1540,8 @@ void main_window::write_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) { qDebug ("Error: gui_settings pointer from resource manager is NULL."); @@ -1627,7 +1636,8 @@ void main_window::handle_octave_ready (void) { // actions after the startup files are executed - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QDir startup_dir = QDir (); // current octave dir after startup @@ -1680,7 +1690,7 @@ if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer! return; - m_set_path_dlg = new set_path_dialog (this, m_resource_manager); + m_set_path_dlg = new set_path_dialog (this, m_octave_qobj); m_set_path_dlg->setModal (false); m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose); @@ -1717,7 +1727,7 @@ if (! m_find_files_dlg) { - m_find_files_dlg = new find_files_dialog (this, m_resource_manager); + m_find_files_dlg = new find_files_dialog (this, m_octave_qobj); connect (m_find_files_dlg, SIGNAL (finished (int)), this, SLOT (find_files_finished (int))); @@ -1842,7 +1852,8 @@ void main_window::restore_create_file_setting (void) { // restore the new files creation setting - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); settings->setValue ("editor/create_new_file",false); disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)), this, SLOT (restore_create_file_setting (void))); @@ -2292,9 +2303,9 @@ construct_new_menu (file_menu); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); m_open_action - = file_menu->addAction (m_resource_manager.icon ("document-open"), - tr ("Open...")); + = file_menu->addAction (rmgr.icon ("document-open"), tr ("Open...")); m_open_action->setShortcutContext (Qt::ApplicationShortcut); m_open_action->setToolTip (tr ("Open an existing file in editor")); @@ -2333,9 +2344,9 @@ { QMenu *new_menu = p->addMenu (tr ("New")); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); m_new_script_action - = new_menu->addAction (m_resource_manager.icon ("document-new"), - tr ("New Script")); + = new_menu->addAction (rmgr.icon ("document-new"), tr ("New Script")); m_new_script_action->setShortcutContext (Qt::ApplicationShortcut); m_new_function_action = new_menu->addAction (tr ("New Function...")); @@ -2372,20 +2383,21 @@ QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier; + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); m_undo_action - = edit_menu->addAction (m_resource_manager.icon ("edit-undo"), tr ("Undo")); + = edit_menu->addAction (rmgr.icon ("edit-undo"), tr ("Undo")); m_undo_action->setShortcutContext (Qt::ApplicationShortcut); edit_menu->addSeparator (); m_copy_action - = edit_menu->addAction (m_resource_manager.icon ("edit-copy"), - tr ("Copy"), this, SLOT (copyClipboard (void))); + = edit_menu->addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this, + SLOT (copyClipboard (void))); m_copy_action->setShortcutContext (Qt::ApplicationShortcut); m_paste_action - = edit_menu->addAction (m_resource_manager.icon ("edit-paste"), - tr ("Paste"), this, SLOT (pasteClipboard (void))); + = edit_menu->addAction (rmgr.icon ("edit-paste"), tr ("Paste"), this, + SLOT (pasteClipboard (void))); m_paste_action->setShortcutContext (Qt::ApplicationShortcut); m_select_all_action @@ -2399,8 +2411,7 @@ edit_menu->addSeparator (); m_find_files_action - = edit_menu->addAction (m_resource_manager.icon ("edit-find"), - tr ("Find Files...")); + = edit_menu->addAction (rmgr.icon ("edit-find"), tr ("Find Files...")); edit_menu->addSeparator (); @@ -2419,7 +2430,7 @@ = edit_menu->addAction (tr ("Set Path")); m_preferences_action - = edit_menu->addAction (m_resource_manager.icon ("preferences-system"), + = edit_menu->addAction (rmgr.icon ("preferences-system"), tr ("Preferences...")); connect (m_find_files_action, SIGNAL (triggered (void)), @@ -2457,8 +2468,8 @@ const QString& item, const char *member) { - QAction *action = add_action (m_debug_menu, - m_resource_manager.icon (QString (icon)), + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QAction *action = add_action (m_debug_menu, rmgr.icon (QString (icon)), item, member); action->setEnabled (false); @@ -2679,11 +2690,12 @@ // need to delete these upon destroying this main_window. m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: "))); m_main_tool_bar->addWidget (m_current_directory_combo_box); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); QAction *current_dir_up - = m_main_tool_bar->addAction (m_resource_manager.icon ("go-up"), + = m_main_tool_bar->addAction (rmgr.icon ("go-up"), tr ("One directory up")); QAction *current_dir_search - = m_main_tool_bar->addAction (m_resource_manager.icon ("folder"), + = m_main_tool_bar->addAction (rmgr.icon ("folder"), tr ("Browse directories")); connect (m_current_directory_combo_box, SIGNAL (activated (QString)), @@ -2704,7 +2716,8 @@ void main_window::focus_console_after_command (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings->value ("terminal/focus_after_command",false).toBool ()) focus_command_window (); }
--- a/libgui/src/main-window.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/main-window.h Mon Nov 04 13:34:44 2019 -0500 @@ -52,8 +52,8 @@ #include "history-dock-widget.h" #include "interpreter-qobject.h" #include "octave-dock-widget.h" +#include "octave-qobject.h" #include "qt-interpreter-events.h" -#include "resource-manager.h" #include "set-path-dialog.h" #include "terminal-dock-widget.h" #include "variable-editor.h" @@ -289,8 +289,6 @@ base_qobject& m_octave_qobj; - resource_manager& m_resource_manager; - workspace_model *m_workspace_model; QHash<QMenu*, QStringList> m_hash_menu_text;
--- a/libgui/src/news-reader.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/news-reader.cc Mon Nov 04 13:34:44 2019 -0500 @@ -31,7 +31,7 @@ #include <QString> #include "news-reader.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "gui-preferences-nr.h" #include "url-transfer.h" @@ -66,7 +66,8 @@ { if (m_serial >= 0) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings) {
--- a/libgui/src/news-reader.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/news-reader.h Mon Nov 04 13:34:44 2019 -0500 @@ -29,7 +29,7 @@ namespace octave { - class resource_manager; + class base_qobject; class news_reader : public QObject { @@ -37,10 +37,10 @@ public: - news_reader (resource_manager& rmgr, const QString& base_url, + news_reader (base_qobject& oct_qobj, const QString& base_url, const QString& page, int serial = -1, bool connect_to_web = false) - : QObject (), m_resource_manager (rmgr), m_base_url (base_url), + : QObject (), m_octave_qobj (oct_qobj), m_base_url (base_url), m_page (page), m_serial (serial), m_connect_to_web (connect_to_web) { } @@ -56,7 +56,7 @@ private: - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QString m_base_url; QString m_page;
--- a/libgui/src/octave-dock-widget.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/octave-dock-widget.cc Mon Nov 04 13:34:44 2019 -0500 @@ -38,12 +38,12 @@ #include "gui-preferences-mw.h" #include "gui-settings.h" #include "octave-dock-widget.h" -#include "resource-manager.h" +#include "octave-qobject.h" namespace octave { - label_dock_widget::label_dock_widget (QWidget *p, resource_manager& rmgr) - : QDockWidget (p), m_resource_manager (rmgr), + label_dock_widget::label_dock_widget (QWidget *p, base_qobject& oct_qobj) + : QDockWidget (p), m_octave_qobj (oct_qobj), m_default_float_button (nullptr), m_default_close_button (nullptr) { QStyle *st = style (); @@ -177,8 +177,8 @@ } octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p, - resource_manager& rmgr) - : label_dock_widget (p, rmgr), m_recent_float_geom (), + base_qobject& oct_qobj) + : label_dock_widget (p, oct_qobj), m_recent_float_geom (), m_recent_dock_geom (), m_waiting_for_mouse_button_release (false) { setObjectName (obj_name); @@ -245,7 +245,8 @@ setFeatures (QDockWidget::AllDockWidgetFeatures); - handle_settings (m_resource_manager.get_settings ()); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + handle_settings (rmgr.get_settings ()); } // connect signal visibility changed to related slot (called from main-window) @@ -326,7 +327,8 @@ bool vis = isVisible (); // Since floating widget has no parent, we have to read it - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); settings->setValue (mw_state.key, m_parent->saveState ()); // Stay window, otherwise will bounce back to window by default because @@ -517,7 +519,8 @@ { // save state of this dock-widget QString name = objectName (); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) return; @@ -752,19 +755,26 @@ m_predecessor_widget->setFocus (); m_predecessor_widget = nullptr; + // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used // here. This had no effect in Qt4, but does in Qt5. In the following, the // four incorrect keys are updated if still present in the settings files. // The keys are also used in the settings dialog, but // octave_dock_widget::handle_settings is already called at program start. // These tests can be removed in a future version of Octave (version 6). - m_resource_manager.update_settings_key ("Dockwidgets/title_bg_color", - "DockWidgets/title_bg_color"); - m_resource_manager.update_settings_key ("Dockwidgets/title_bg_color_active", - "DockWidgets/title_bg_color_active"); - m_resource_manager.update_settings_key ("Dockwidgets/title_fg_color", - "DockWidgets/title_fg_color"); - m_resource_manager.update_settings_key ("Dockwidgets/title_fg_color_active", - "DockWidgets/title_fg_color_active"); + + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + rmgr.update_settings_key ("Dockwidgets/title_bg_color", + "DockWidgets/title_bg_color"); + + rmgr.update_settings_key ("Dockwidgets/title_bg_color_active", + "DockWidgets/title_bg_color_active"); + + rmgr.update_settings_key ("Dockwidgets/title_fg_color", + "DockWidgets/title_fg_color"); + + rmgr.update_settings_key ("Dockwidgets/title_fg_color_active", + "DockWidgets/title_fg_color_active"); } }
--- a/libgui/src/octave-dock-widget.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/octave-dock-widget.h Mon Nov 04 13:34:44 2019 -0500 @@ -34,7 +34,7 @@ namespace octave { - class resource_manager; + class base_qobject; // The few decoration items common to both main window and variable editor. @@ -44,7 +44,7 @@ public: - label_dock_widget (QWidget *p, resource_manager& rmgr); + label_dock_widget (QWidget *p, base_qobject& oct_qobj); // set_title() uses the custom title bar while setWindowTitle() uses // the default title bar (with style sheets) @@ -65,7 +65,7 @@ protected: - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; int m_icon_size; QWidget *m_title_widget; @@ -85,7 +85,7 @@ public: octave_dock_widget (const QString& obj_name, QWidget *p, - resource_manager& rmgr); + base_qobject& oct_qobj); virtual ~octave_dock_widget (void) = default;
--- a/libgui/src/qt-interpreter-events.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/qt-interpreter-events.cc Mon Nov 04 13:34:44 2019 -0500 @@ -37,7 +37,6 @@ #include "gui-preferences-ed.h" #include "octave-qobject.h" #include "qt-interpreter-events.h" -#include "resource-manager.h" #include "oct-env.h" #include "str-vec.h" @@ -105,7 +104,6 @@ qt_interpreter_events::qt_interpreter_events (base_qobject& oct_qobj) : interpreter_events (), m_octave_qobj (oct_qobj), - m_resource_manager (m_octave_qobj.get_resource_manager ()), m_result (), m_mutex (), m_waitcondition (), m_uiwidget_creator () { qRegisterMetaType<QIntList> ("QIntList"); @@ -275,7 +273,8 @@ bool qt_interpreter_events::prompt_new_edit_file (const std::string& file) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings || settings->value ("editor/create_new_file",false).toBool ()) return true; @@ -389,7 +388,8 @@ { QMutexLocker autolock (&m_mutex); - m_result = QVariant::fromValue (m_resource_manager.icon (name)); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + m_result = QVariant::fromValue (rmgr.icon (name)); wake_all (); } @@ -578,7 +578,8 @@ { QMutexLocker autolock (&m_mutex); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString read_value = settings->value (key).toString (); @@ -617,7 +618,8 @@ adjusted_value = adjusted_value.toUpper (); QStringList codecs; - m_resource_manager.get_codecs (&codecs); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + rmgr.get_codecs (&codecs); QRegExp re ("^CP(\\d+)$");
--- a/libgui/src/qt-interpreter-events.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/qt-interpreter-events.h Mon Nov 04 13:34:44 2019 -0500 @@ -47,7 +47,6 @@ namespace octave { class base_qobject; - class resource_manager; // The functions in this class are not normally called directly, but // are invoked from the Octave interpreter thead by methods in the @@ -258,8 +257,6 @@ base_qobject& m_octave_qobj; - resource_manager& m_resource_manager; - QVariant m_result; QMutex m_mutex;
--- a/libgui/src/set-path-dialog.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/set-path-dialog.cc Mon Nov 04 13:34:44 2019 -0500 @@ -47,7 +47,7 @@ #include <QVBoxLayout> #include "gui-preferences-pd.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "set-path-dialog.h" #include "set-path-model.h" @@ -55,8 +55,8 @@ namespace octave { - set_path_dialog::set_path_dialog (QWidget *parent, resource_manager& rmgr) - : QDialog (parent), m_resource_manager (rmgr) + set_path_dialog::set_path_dialog (QWidget *parent, base_qobject& oct_qobj) + : QDialog (parent), m_octave_qobj (oct_qobj) { setWindowTitle (tr ("Set Path")); @@ -163,7 +163,8 @@ setLayout (main_layout); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); restoreGeometry ( settings->value(pd_geometry.key).toByteArray()); } @@ -299,7 +300,8 @@ void set_path_dialog::save_settings () { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); settings->setValue (pd_geometry.key, saveGeometry ()); }
--- a/libgui/src/set-path-dialog.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/set-path-dialog.h Mon Nov 04 13:34:44 2019 -0500 @@ -38,7 +38,7 @@ namespace octave { - class resource_manager; + class base_qobject; class set_path_dialog : public QDialog { @@ -50,7 +50,7 @@ // in the dialog. That may only be done after the intepreter_event // signal connections are made to the Octave interpreter. - set_path_dialog (QWidget *parent, resource_manager& rmgr); + set_path_dialog (QWidget *parent, base_qobject& oct_qobj); virtual ~set_path_dialog (void); @@ -93,7 +93,7 @@ void add_dir_common (bool subdirs); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QLabel *m_info_label; QPushButton *m_reload_button;
--- a/libgui/src/settings-dialog.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/settings-dialog.cc Mon Nov 04 13:34:44 2019 -0500 @@ -60,7 +60,7 @@ #endif #include "gui-preferences-all.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "settings-dialog.h" #include "shortcut-manager.h" #include "variable-editor.h" @@ -88,13 +88,14 @@ #endif - settings_dialog::settings_dialog (QWidget *p, resource_manager& rmgr, + settings_dialog::settings_dialog (QWidget *p, base_qobject& oct_qobj, const QString& desired_tab) - : QDialog (p), Ui::settings_dialog (), m_resource_manager (rmgr) + : QDialog (p), Ui::settings_dialog (), m_octave_qobj (oct_qobj) { setupUi (this); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) { @@ -108,7 +109,7 @@ } // look for available language files and the actual settings - QString qm_dir_name = m_resource_manager.get_gui_translation_dir (); + QString qm_dir_name = rmgr.get_gui_translation_dir (); QDir qm_dir (qm_dir_name); QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"), QDir::Files | QDir::Readable, QDir::Name); @@ -252,7 +253,7 @@ editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers", true).toBool ()); editor_linenr_size->setValue (settings->value ("editor/line_numbers_size", 0).toInt ()); - m_resource_manager.combo_encoding (editor_combo_encoding); + rmgr.combo_encoding (editor_combo_encoding); default_var = QColor (240, 240, 240); QColor setting_color = settings->value ("editor/highlight_current_line_color", default_var).value<QColor> (); @@ -528,7 +529,8 @@ { if (tab.isEmpty ()) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings) tabWidget->setCurrentIndex (settings->value ("settings/last_tab", 0).toInt ()); } @@ -557,8 +559,8 @@ { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks; - - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings->value (global_use_native_dialogs.key, global_use_native_dialogs.def).toBool ()) opts |= QFileDialog::DontUseNativeDialog; @@ -817,7 +819,8 @@ void settings_dialog::write_changed_settings (bool closing) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); // the icon set QString widget_icon_set = "NONE"; @@ -1044,10 +1047,11 @@ void settings_dialog::read_workspace_colors (gui_settings *settings) { // Construct the grid with all color related settings + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); QList<QColor> default_colors - = m_resource_manager.storage_class_default_colors (); - QStringList class_names = m_resource_manager.storage_class_names (); - QString class_chars = m_resource_manager.storage_class_chars (); + = rmgr.storage_class_default_colors (); + QStringList class_names = rmgr.storage_class_names (); + QString class_chars = rmgr.storage_class_chars (); int nr_of_classes = class_chars.length (); QGridLayout *style_grid = new QGridLayout (); @@ -1107,7 +1111,8 @@ settings->setValue (ws_enable_colors.key, m_ws_enable_colors->isChecked ()); settings->setValue (ws_hide_tool_tips.key, m_ws_hide_tool_tips->isChecked ()); - QString class_chars = m_resource_manager.storage_class_chars (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QString class_chars = rmgr.storage_class_chars (); color_picker *color; for (int i = 0; i < class_chars.length (); i++) @@ -1168,7 +1173,8 @@ { QList<QColor> default_colors = variable_editor::default_colors (); QStringList class_names = variable_editor::color_names (); - QString class_chars = m_resource_manager.varedit_color_chars (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QString class_chars = rmgr.varedit_color_chars (); int nr_of_classes = class_chars.length (); QGridLayout *style_grid = new QGridLayout (); @@ -1202,7 +1208,8 @@ void settings_dialog::write_varedit_colors (gui_settings *settings) { - QString class_chars = m_resource_manager.varedit_color_chars (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QString class_chars = rmgr.varedit_color_chars (); color_picker *color; for (int i = 0; i < class_chars.length (); i++)
--- a/libgui/src/settings-dialog.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/settings-dialog.h Mon Nov 04 13:34:44 2019 -0500 @@ -31,20 +31,21 @@ #include "color-picker.h" #include "gui-preferences-ed.h" #include "gui-settings.h" -#include "resource-manager.h" #include "ui-settings-dialog.h" class QsciLexer; namespace octave { + class base_qobject; + // Ui::settings_dialog is a generated class. class settings_dialog : public QDialog, private Ui::settings_dialog { Q_OBJECT public: - explicit settings_dialog (QWidget *parent, resource_manager& rmgr, + explicit settings_dialog (QWidget *parent, base_qobject& octave_qobj, const QString& desired_tab = QString ()); ~settings_dialog (void) = default; @@ -86,7 +87,7 @@ void read_varedit_colors (gui_settings *settings); void write_varedit_colors (gui_settings *settings); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; color_picker *m_widget_title_bg_color; color_picker *m_widget_title_bg_color_active;
--- a/libgui/src/shortcut-manager.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/shortcut-manager.cc Mon Nov 04 13:34:44 2019 -0500 @@ -39,7 +39,7 @@ #include <QVBoxLayout> #include <QtCore> -#include "resource-manager.h" +#include "octave-qobject.h" #include "shortcut-manager.h" #include "error.h"
--- a/libgui/src/terminal-dock-widget.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/terminal-dock-widget.cc Mon Nov 04 13:34:44 2019 -0500 @@ -29,7 +29,7 @@ #include "gui-preferences-cs.h" #include "gui-preferences-global.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "terminal-dock-widget.h" #include "quit.h" @@ -40,8 +40,8 @@ namespace octave { terminal_dock_widget::terminal_dock_widget (QWidget *p, - resource_manager& rmgr) - : octave_dock_widget ("TerminalDockWidget", p, rmgr), + base_qobject& oct_qobj) + : octave_dock_widget ("TerminalDockWidget", p, oct_qobj), m_terminal (QTerminal::create (p)) { m_terminal->setObjectName ("OctaveTerminal"); @@ -62,7 +62,8 @@ // Chose a reasonable size at startup in order to avoid truncated // startup messages - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QFont font = QFont (); font.setStyleHint (QFont::TypeWriter);
--- a/libgui/src/terminal-dock-widget.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/terminal-dock-widget.h Mon Nov 04 13:34:44 2019 -0500 @@ -32,7 +32,7 @@ namespace octave { - class resource_manager; + class base_qobject; class terminal_dock_widget : public octave_dock_widget { @@ -40,7 +40,7 @@ public: - terminal_dock_widget (QWidget *parent, resource_manager& rmgr); + terminal_dock_widget (QWidget *parent, base_qobject& oct_qobj); ~terminal_dock_widget (void);
--- a/libgui/src/variable-editor.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/variable-editor.cc Mon Nov 04 13:34:44 2019 -0500 @@ -51,7 +51,7 @@ #include "gui-preferences-cs.h" #include "gui-preferences-global.h" #include "gui-preferences-ve.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "shortcut-manager.h" #include "variable-editor-model.h" #include "variable-editor.h" @@ -89,8 +89,8 @@ // Variable dock widget variable_dock_widget::variable_dock_widget (QWidget *p, - resource_manager& rmgr) - : label_dock_widget (p, rmgr) + base_qobject& oct_qobj) + : label_dock_widget (p, oct_qobj) // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) , m_waiting_for_mouse_move (false) @@ -120,8 +120,9 @@ m_prev_geom = QRect (0, 0, 0, 0); QHBoxLayout *h_layout = m_title_widget->findChild<QHBoxLayout *> (); - m_fullscreen_action = new QAction - (m_resource_manager.icon ("view-fullscreen", false), "", this); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + m_fullscreen_action + = new QAction (rmgr.icon ("view-fullscreen", false), "", this); m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP)); QToolButton *fullscreen_button = new QToolButton (m_title_widget); fullscreen_button->setDefaultAction (m_fullscreen_action); @@ -156,7 +157,8 @@ if (m_full_screen) { setGeometry (m_prev_geom); - m_fullscreen_action->setIcon (m_resource_manager.icon ("view-fullscreen", false)); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false)); m_full_screen = false; } m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP)); @@ -214,10 +216,12 @@ variable_dock_widget::change_fullscreen (void) { #if defined (HAVE_QGUIAPPLICATION) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + if (! m_full_screen) { m_prev_floating = isFloating (); - m_fullscreen_action->setIcon (m_resource_manager.icon ("view-restore", false)); + m_fullscreen_action->setIcon (rmgr.icon ("view-restore", false)); if (m_prev_floating) m_fullscreen_action->setToolTip (tr ("Restore geometry")); else @@ -237,7 +241,7 @@ } else { - m_fullscreen_action->setIcon (m_resource_manager.icon ("view-fullscreen", false)); + m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false)); setGeometry (m_prev_geom); if (m_prev_floating) m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP)); @@ -370,9 +374,9 @@ // Variable editor stack variable_editor_stack::variable_editor_stack (QWidget *p, - resource_manager& rmgr) - : QStackedWidget (p), m_resource_manager (rmgr), - m_edit_view (new variable_editor_view (this, m_resource_manager)) + base_qobject& oct_qobj) + : QStackedWidget (p), m_octave_qobj (oct_qobj), + m_edit_view (new variable_editor_view (this, m_octave_qobj)) { setFocusPolicy (Qt::StrongFocus); @@ -455,8 +459,9 @@ // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = 0; // No options by default. - if (! m_resource_manager.get_settings ()->value ("use_native_file_dialogs", - true).toBool ()) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); + if (! settings->value ("use_native_file_dialogs", true).toBool ()) opts = QFileDialog::DontUseNativeDialog; QString name = objectName (); @@ -480,8 +485,8 @@ // Custom editable variable table view variable_editor_view::variable_editor_view (QWidget *p, - resource_manager& rmgr) - : QTableView (p), m_resource_manager (rmgr), m_var_model (nullptr) + base_qobject& oct_qobj) + : QTableView (p), m_octave_qobj (oct_qobj), m_var_model (nullptr) { setWordWrap (false); setContextMenuPolicy (Qt::CustomContextMenu); @@ -587,29 +592,31 @@ variable_editor_view::add_edit_actions (QMenu *menu, const QString& qualifier_string) { - menu->addAction (m_resource_manager.icon ("edit-cut"), + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + menu->addAction (rmgr.icon ("edit-cut"), tr ("Cut") + qualifier_string, this, SLOT (cutClipboard ())); - menu->addAction (m_resource_manager.icon ("edit-copy"), + menu->addAction (rmgr.icon ("edit-copy"), tr ("Copy") + qualifier_string, this, SLOT (copyClipboard ())); - menu->addAction (m_resource_manager.icon ("edit-paste"), + menu->addAction (rmgr.icon ("edit-paste"), tr ("Paste"), this, SLOT (pasteClipboard ())); menu->addSeparator (); - menu->addAction (m_resource_manager.icon ("edit-delete"), + menu->addAction (rmgr.icon ("edit-delete"), tr ("Clear") + qualifier_string, this, SLOT (clearContent ())); - menu->addAction (m_resource_manager.icon ("edit-delete"), + menu->addAction (rmgr.icon ("edit-delete"), tr ("Delete") + qualifier_string, this, SLOT (delete_selected ())); - menu->addAction (m_resource_manager.icon ("document-new"), + menu->addAction (rmgr.icon ("document-new"), tr ("Variable from Selection"), this, SLOT (createVariable ())); } @@ -1037,9 +1044,9 @@ // Variable editor. - variable_editor::variable_editor (QWidget *p, resource_manager& rmgr) - : octave_dock_widget ("VariableEditor", p, rmgr), - m_main (new dw_main_window (rmgr)), + variable_editor::variable_editor (QWidget *p, base_qobject& oct_qobj) + : octave_dock_widget ("VariableEditor", p, oct_qobj), + m_main (new dw_main_window (oct_qobj)), m_tool_bar (new QToolBar (m_main)), m_default_width (30), m_default_height (100), @@ -1077,7 +1084,9 @@ // Colors. - for (int i = 0; i < m_resource_manager.varedit_color_chars ().length (); i++) + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + + for (int i = 0; i < rmgr.varedit_color_chars ().length (); i++) m_table_colors.append (QColor (Qt::white)); // Use an MDI area that is shrunk to nothing as the central widget. @@ -1156,9 +1165,11 @@ void variable_editor::edit_variable (const QString& name, const octave_value& val) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + if (m_stylesheet.isEmpty ()) { - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); notice_settings (settings); } @@ -1186,7 +1197,7 @@ } variable_dock_widget *page - = new variable_dock_widget (this, m_resource_manager); + = new variable_dock_widget (this, m_octave_qobj); page->setObjectName (name); m_main->addDockWidget (Qt::LeftDockWidgetArea, page); @@ -1206,7 +1217,7 @@ #endif variable_editor_stack *stack - = new variable_editor_stack (page, m_resource_manager); + = new variable_editor_stack (page, m_octave_qobj); stack->setObjectName (name); page->setWidget (stack); @@ -1379,9 +1390,11 @@ m_alternate_rows = settings->value ("variable_editor/alternate_rows", false).toBool (); - QList<QColor> default_colors = m_resource_manager.varedit_default_colors (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); - QString class_chars = m_resource_manager.varedit_color_chars (); + QList<QColor> default_colors = rmgr.varedit_default_colors (); + + QString class_chars = rmgr.varedit_color_chars (); m_use_terminal_font = settings->value ("variable_editor/use_terminal_font", true).toBool (); @@ -1629,9 +1642,11 @@ m_tool_bar->setWindowTitle (tr ("Variable Editor Toolbar")); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QAction *action; - action = add_tool_bar_button (m_resource_manager.icon ("document-save"), - tr ("Save"), this, SLOT (save ())); + action = add_tool_bar_button (rmgr.icon ("document-save"), tr ("Save"), + this, SLOT (save ())); addAction (action); action->setShortcutContext (Qt::WidgetWithChildrenShortcut); action->setShortcuts (QKeySequence::Save); @@ -1639,16 +1654,16 @@ m_tool_bar->addSeparator (); - action = add_tool_bar_button (m_resource_manager.icon ("edit-cut"), - tr ("Cut"), this, SLOT (cutClipboard ())); + action = add_tool_bar_button (rmgr.icon ("edit-cut"), tr ("Cut"), + this, SLOT (cutClipboard ())); action->setStatusTip(tr("Cut data to clipboard")); - action = add_tool_bar_button (m_resource_manager.icon ("edit-copy"), - tr ("Copy"), this, SLOT (copyClipboard ())); + action = add_tool_bar_button (rmgr.icon ("edit-copy"), tr ("Copy"), + this, SLOT (copyClipboard ())); action->setStatusTip(tr("Copy data to clipboard")); - action = add_tool_bar_button (m_resource_manager.icon ("edit-paste"), - tr ("Paste"), this, SLOT (pasteClipboard ())); + action = add_tool_bar_button (rmgr.icon ("edit-paste"), tr ("Paste"), + this, SLOT (pasteClipboard ())); action->setStatusTip(tr("Paste clipboard into variable data")); m_tool_bar->addSeparator (); @@ -1657,15 +1672,14 @@ // QAction *print_action; /icons/fileprint.png // m_tool_bar->addSeparator (); - action = new QAction (m_resource_manager.icon ("plot-xy-curve"), - tr ("Plot"), m_tool_bar); + action = new QAction (rmgr.icon ("plot-xy-curve"), tr ("Plot"), m_tool_bar); action->setToolTip (tr ("Plot Selected Data")); QToolButton *plot_tool_button = new HoverToolButton (m_tool_bar); plot_tool_button->setDefaultAction (action); plot_tool_button->setText (tr ("Plot")); plot_tool_button->setToolTip (tr ("Plot selected data")); - plot_tool_button->setIcon (m_resource_manager.icon ("plot-xy-curve")); + plot_tool_button->setIcon (rmgr.icon ("plot-xy-curve")); plot_tool_button->setPopupMode (QToolButton::InstantPopup); @@ -1684,8 +1698,8 @@ m_tool_bar->addSeparator (); - action = add_tool_bar_button (m_resource_manager.icon ("go-up"), - tr ("Up"), this, SLOT (levelUp ())); + action = add_tool_bar_button (rmgr.icon ("go-up"), tr ("Up"), this, + SLOT (levelUp ())); action->setStatusTip(tr("Go one level up in variable hierarchy")); // The QToolButton mouse-clicks change active window, so connect all
--- a/libgui/src/variable-editor.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/variable-editor.h Mon Nov 04 13:34:44 2019 -0500 @@ -42,7 +42,7 @@ namespace octave { - class resource_manager; + class base_qobject; class variable_editor_model; class variable_editor_view; @@ -55,7 +55,7 @@ public: - variable_dock_widget (QWidget *p, resource_manager& rmgr); + variable_dock_widget (QWidget *p, base_qobject& oct_qobj); signals: @@ -130,7 +130,7 @@ public: - variable_editor_stack (QWidget *p, resource_manager& rmgr); + variable_editor_stack (QWidget *p, base_qobject& oct_qobj); variable_editor_view *edit_view (void) {return m_edit_view;}; @@ -154,7 +154,7 @@ QTextEdit *make_disp_view (QWidget *parent); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; variable_editor_view *m_edit_view; @@ -168,7 +168,7 @@ public: - variable_editor_view (QWidget *p, resource_manager& rmgr); + variable_editor_view (QWidget *p, base_qobject& oct_qobj); void setModel (QAbstractItemModel *model); @@ -215,7 +215,7 @@ void add_edit_actions (QMenu *menu, const QString& qualifier_string); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; variable_editor_model *m_var_model; }; @@ -285,7 +285,7 @@ public: - variable_editor (QWidget *parent, resource_manager& rmgr); + variable_editor (QWidget *parent, base_qobject& oct_qobj); ~variable_editor (void) = default;
--- a/libgui/src/welcome-wizard.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/welcome-wizard.cc Mon Nov 04 13:34:44 2019 -0500 @@ -37,7 +37,7 @@ #endif #include "gui-preferences-nr.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "welcome-wizard.h" namespace octave @@ -51,8 +51,8 @@ return logo; }; - welcome_wizard::welcome_wizard (resource_manager& rmgr, QWidget *p) - : QDialog (p), m_resource_manager (rmgr), m_page_ctor_list (), + welcome_wizard::welcome_wizard (base_qobject& oct_qobj, QWidget *p) + : QDialog (p), m_octave_qobj (oct_qobj), m_page_ctor_list (), m_page_list_iterator (), m_current_page (initial_page::create (this)), m_allow_web_connect_state (false), m_max_height (0), m_max_width (0) @@ -140,9 +140,10 @@ { // Create default settings file. - m_resource_manager.reload_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + rmgr.reload_settings (); - gui_settings *settings = m_resource_manager.get_settings (); + gui_settings *settings = rmgr.get_settings (); if (settings) {
--- a/libgui/src/welcome-wizard.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/welcome-wizard.h Mon Nov 04 13:34:44 2019 -0500 @@ -30,7 +30,7 @@ namespace octave { - class resource_manager; + class base_qobject; class welcome_wizard : public QDialog { @@ -40,7 +40,7 @@ typedef QWidget *(*page_creator_fptr) (welcome_wizard *wizard); - welcome_wizard (resource_manager& rmgr, QWidget *parent = nullptr); + welcome_wizard (base_qobject& oct_qobj, QWidget *parent = nullptr); ~welcome_wizard (void) = default; @@ -48,7 +48,7 @@ private: - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; QList<page_creator_fptr> m_page_ctor_list; QList<page_creator_fptr>::iterator m_page_list_iterator;
--- a/libgui/src/workspace-model.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/workspace-model.cc Mon Nov 04 13:34:44 2019 -0500 @@ -31,7 +31,7 @@ #include "gui-preferences-ws.h" #include "gui-settings.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "workspace-model.h" #include "syminfo.h" @@ -39,8 +39,8 @@ namespace octave { - workspace_model::workspace_model (resource_manager& rmgr, QObject *p) - : QAbstractTableModel (p), m_resource_manager (rmgr) + workspace_model::workspace_model (base_qobject& oct_qobj, QObject *p) + : QAbstractTableModel (p), m_octave_qobj (oct_qobj) { m_columnNames.append (tr ("Name")); m_columnNames.append (tr ("Class")); @@ -52,7 +52,8 @@ // classes in the workspace view. The structure is // m_storage_class_colors(1,2,...,colors): background colors // m_storage_class_colors(colors+1,...,2*colors): foreground colors - int colors = m_resource_manager.storage_class_chars ().length (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + int colors = rmgr.storage_class_chars ().length (); for (int i = 0; i < 2*colors; i++) m_storage_class_colors.append (QColor (Qt::white)); @@ -136,7 +137,8 @@ if ((role == Qt::BackgroundColorRole || role == Qt::ForegroundRole) && m_enable_colors) { - QString class_chars = m_resource_manager.storage_class_chars (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + QString class_chars = rmgr.storage_class_chars (); int actual_class = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ()); if (actual_class >= 0) @@ -182,15 +184,17 @@ { QString sclass; - QString class_chars = m_resource_manager.storage_class_chars (); + resource_manager& rmgr + = m_octave_qobj.get_resource_manager (); + + QString class_chars = rmgr.storage_class_chars (); int actual_class = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ()); if (actual_class >= 0) { - QStringList class_names - = m_resource_manager.storage_class_names (); + QStringList class_names = rmgr.storage_class_names (); sclass = class_names.at (actual_class); } @@ -235,9 +239,10 @@ void workspace_model::notice_settings (const gui_settings *settings) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); QList<QColor> default_colors = - m_resource_manager.storage_class_default_colors (); - QString class_chars = m_resource_manager.storage_class_chars (); + rmgr.storage_class_default_colors (); + QString class_chars = rmgr.storage_class_chars (); m_enable_colors = settings->value (ws_enable_colors.key, ws_enable_colors.def).toBool ();
--- a/libgui/src/workspace-model.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/workspace-model.h Mon Nov 04 13:34:44 2019 -0500 @@ -41,7 +41,7 @@ namespace octave { - class resource_manager; + class base_qobject; class workspace_model : public QAbstractTableModel @@ -50,7 +50,7 @@ public: - workspace_model (resource_manager& rmgr, QObject *parent = nullptr); + workspace_model (base_qobject& oct_qobj, QObject *parent = nullptr); ~workspace_model (void) = default; @@ -97,7 +97,7 @@ void clear_data (void); void update_table (void); - resource_manager& m_resource_manager; + base_qobject& m_octave_qobj; bool m_top_level; symbol_info_list m_syminfo_list;
--- a/libgui/src/workspace-view.cc Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/workspace-view.cc Mon Nov 04 13:34:44 2019 -0500 @@ -40,7 +40,7 @@ #include <QVBoxLayout> #include "gui-preferences-ws.h" -#include "resource-manager.h" +#include "octave-qobject.h" #include "workspace-view.h" #include "interpreter-private.h" @@ -49,8 +49,8 @@ namespace octave { - workspace_view::workspace_view (QWidget *p, resource_manager& rmgr) - : octave_dock_widget ("WorkspaceView", p, rmgr), + workspace_view::workspace_view (QWidget *p, base_qobject& oct_qobj) + : octave_dock_widget ("WorkspaceView", p, oct_qobj), m_view (new QTableView (this)), m_filter_checkbox (new QCheckBox ()), m_filter (new QComboBox (this)), @@ -96,7 +96,8 @@ ws_layout->addWidget (m_view); ws_layout->setSpacing (0); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (settings) { @@ -177,7 +178,8 @@ m_view->setModel (&m_filter_model); // set the sorting after a model was set, it would be ignored otherwise - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); m_view->sortByColumn (settings->value ("workspaceview/sort_by_column",0).toInt (), static_cast<Qt::SortOrder> (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ())); @@ -201,14 +203,15 @@ { tool_tip = QString (tr ("View the variables in the active workspace.<br>")); tool_tip += QString (tr ("Colors for variable attributes:")); - int colors = m_resource_manager.storage_class_chars ().length (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + int colors = rmgr.storage_class_chars ().length (); for (i = 0; i < colors; i++) { tool_tip += QString (R"(<div style="background-color:%1;color:%2">%3</div>)") .arg (m_model->storage_class_color (i).name ()) .arg (m_model->storage_class_color (i + colors).name ()) - .arg (m_resource_manager.storage_class_names ().at (i)); + .arg (rmgr.storage_class_names ().at (i)); } } @@ -230,7 +233,8 @@ void workspace_view::save_settings (void) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); if (! settings) return; @@ -295,7 +299,8 @@ QMenu menu (this); QSignalMapper sig_mapper (this); - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); for (int i = 0; i < m_columns_shown.size (); i++) { @@ -315,7 +320,8 @@ void workspace_view::toggle_header (int col) { - gui_settings *settings = m_resource_manager.get_settings (); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + gui_settings *settings = rmgr.get_settings (); QString key = m_columns_shown_keys.at (col); bool shown = settings->value (key,true).toBool ();
--- a/libgui/src/workspace-view.h Mon Nov 04 11:18:28 2019 -0500 +++ b/libgui/src/workspace-view.h Mon Nov 04 13:34:44 2019 -0500 @@ -39,7 +39,7 @@ namespace octave { - class resource_manager; + class base_qobject; class workspace_view : public octave_dock_widget { @@ -47,7 +47,7 @@ public: - workspace_view (QWidget *parent, resource_manager& rmgr); + workspace_view (QWidget *parent, base_qobject& oct_qobj); ~workspace_view (void) = default;