Mercurial > octave
changeset 31702:aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
* gui-preferences.h, gui-preferences.cc (gui_pref): Define as class with
private data members. Disallow modifying data members by only
providing accessor functions instead of making data members constant.
Change all uses.
(all_gui_preferences): New singleton class for global gui_pref data.
* gui-preferences-cs.h, gui-preferences-dc.h, gui-preferences-dw.h,
gui-preferences-ed.h, gui-preferences-fb.h, gui-preferences-ff.h,
gui-preferences-global.h, gui-preferences-gp.h, gui-preferences-hw.h,
gui-preferences-mw.h, gui-preferences-nr.h, gui-preferences-pd.h,
gui-preferences-sd.h, gui-preferences-ve.h, gui-preferences-ws.h:
Provide declarations but not definitions of gui_pref objects.
* gui-preferences-cs.cc, gui-preferences-dc.cc, gui-preferences-dw.cc,
gui-preferences-ed.cc, gui-preferences-fb.cc, gui-preferences-ff.cc,
gui-preferences-global.cc, gui-preferences-gp.cc,
gui-preferences-hw.cc, gui-preferences-mw.cc, gui-preferences-nr.cc,
gui-preferences-pd.cc, gui-preferences-sd.cc, gui-preferences-ve.cc,
gui-preferences-ws.cc:
New files to provide definitions of gui_pref objects.
line wrap: on
line diff
--- a/libgui/graphics/annotation-dialog.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/graphics/annotation-dialog.cc Tue Jan 03 08:03:20 2023 -0500 @@ -55,7 +55,7 @@ octave::gui_settings settings; // restore last geometry - if (settings.contains (gp_annotation_geometry.key)) + if (settings.contains (gp_annotation_geometry.settings_key ())) restoreGeometry (settings.value (gp_annotation_geometry).toByteArray ()); // connect signals @@ -99,7 +99,7 @@ octave::gui_settings settings; // save position - settings.setValue (gp_annotation_geometry.key, saveGeometry ()); + settings.setValue (gp_annotation_geometry.settings_key (), saveGeometry ()); if (button_role == QDialogButtonBox::ApplyRole || button_role == QDialogButtonBox::AcceptRole)
--- a/libgui/qterminal/libqterminal/QTerminal.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/qterminal/libqterminal/QTerminal.cc Tue Jan 03 08:03:20 2023 -0500 @@ -214,7 +214,7 @@ term_font.setStyleHint (QFont::TypeWriter); QString default_font = settings.value (global_mono_font).toString (); term_font.setFamily - (settings.value (cs_font.key, default_font).toString ()); + (settings.value (cs_font.settings_key (), default_font).toString ()); term_font.setPointSize (settings.value (cs_font_size).toInt ()); setTerminalFont (term_font); @@ -226,7 +226,7 @@ = settings.value (cs_cursor).toString (); bool cursor_blinking; - if (settings.contains (global_cursor_blinking.key)) + if (settings.contains (global_cursor_blinking.settings_key ())) cursor_blinking = settings.value (global_cursor_blinking).toBool (); else cursor_blinking = settings.value (cs_cursor_blinking).toBool ();
--- a/libgui/src/command-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/command-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -160,7 +160,7 @@ term_font.setStyleHint (QFont::TypeWriter); QString default_font = settings.value (global_mono_font).toString (); term_font.setFamily - (settings.value (cs_font.key, default_font).toString ()); + (settings.value (cs_font.settings_key (), default_font).toString ()); term_font.setPointSize (settings.value (cs_font_size).toInt ());
--- a/libgui/src/documentation-bookmarks.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/documentation-bookmarks.cc Tue Jan 03 08:03:20 2023 -0500 @@ -388,13 +388,13 @@ // Store settings gui_settings settings; - settings.setValue (dc_bookmark_filter_active.key, m_filter_checkbox->isChecked ()); - settings.setValue (dc_bookmark_filter_shown.key, m_filter_shown); + settings.setValue (dc_bookmark_filter_active.settings_key (), m_filter_checkbox->isChecked ()); + settings.setValue (dc_bookmark_filter_shown.settings_key (), m_filter_shown); QStringList mru; for (int i = 0; i < m_filter->count (); i++) mru.append (m_filter->itemText (i)); - settings.setValue (dc_bookmark_filter_mru.key, mru); + settings.setValue (dc_bookmark_filter_mru.settings_key (), mru); settings.sync (); }
--- a/libgui/src/documentation.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/documentation.cc Tue Jan 03 08:03:20 2023 -0500 @@ -1065,7 +1065,7 @@ { gui_settings settings; - settings.setValue (dc_browser_zoom_level.key, m_zoom_level); + settings.setValue (dc_browser_zoom_level.settings_key (), m_zoom_level); settings.sync (); }
--- a/libgui/src/external-editor-interface.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/external-editor-interface.cc Tue Jan 03 08:03:20 2023 -0500 @@ -102,8 +102,8 @@ { gui_settings settings; - QString editor = settings.value (global_custom_editor.key, - global_custom_editor.def).toString (); + QString editor = settings.value (global_custom_editor.settings_key (), + global_custom_editor.def ()).toString (); // check the settings (avoid an empty string) if (editor.trimmed ().isEmpty ())
--- a/libgui/src/files-dock-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/files-dock-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -194,18 +194,18 @@ m_columns_shown.append (tr ("Alternating row colors")); m_columns_shown_keys = QStringList (); - m_columns_shown_keys.append (fb_show_size.key); - m_columns_shown_keys.append (fb_show_type.key); - m_columns_shown_keys.append (fb_show_date.key); - m_columns_shown_keys.append (fb_show_hidden.key); - m_columns_shown_keys.append (fb_show_altcol.key); + m_columns_shown_keys.append (fb_show_size.settings_key ()); + m_columns_shown_keys.append (fb_show_type.settings_key ()); + m_columns_shown_keys.append (fb_show_date.settings_key ()); + m_columns_shown_keys.append (fb_show_hidden.settings_key ()); + m_columns_shown_keys.append (fb_show_altcol.settings_key ()); m_columns_shown_defs = QList <QVariant> (); - m_columns_shown_defs.append (fb_show_size.def); - m_columns_shown_defs.append (fb_show_type.def); - m_columns_shown_defs.append (fb_show_date.def); - m_columns_shown_defs.append (fb_show_hidden.def); - m_columns_shown_defs.append (fb_show_altcol.def); + m_columns_shown_defs.append (fb_show_size.def ()); + m_columns_shown_defs.append (fb_show_type.def ()); + m_columns_shown_defs.append (fb_show_date.def ()); + m_columns_shown_defs.append (fb_show_hidden.def ()); + m_columns_shown_defs.append (fb_show_altcol.def ()); QWidget *container = new QWidget (this); @@ -293,14 +293,14 @@ { // restore last dir from previous session QStringList last_dirs - = settings.value (fb_mru_list.key).toStringList (); + = settings.value (fb_mru_list.settings_key ()).toStringList (); if (last_dirs.length () > 0) startup_dir = QDir (last_dirs.at (0)); // last dir in previous session } else if (! settings.value (fb_startup_dir).toString ().isEmpty ()) { // do not restore but there is a startup dir configured - startup_dir = QDir (settings.value (fb_startup_dir.key).toString ()); + startup_dir = QDir (settings.value (fb_startup_dir.settings_key ()).toString ()); } if (! startup_dir.exists ()) @@ -352,9 +352,9 @@ // FIXME: use value<Qt::SortOrder> instead of static cast after // dropping support of Qt 5.4 - if (settings.contains (fb_column_state.key)) + if (settings.contains (fb_column_state.settings_key ())) m_file_tree_view->header ()->restoreState - (settings.value (fb_column_state.key).toByteArray ()); + (settings.value (fb_column_state.settings_key ()).toByteArray ()); // Set header properties for sorting m_file_tree_view->header ()->setSectionsClickable (true); @@ -362,7 +362,7 @@ m_file_tree_view->header ()->setSortIndicatorShown (true); QStringList mru_dirs = - settings.value (fb_mru_list.key).toStringList (); + settings.value (fb_mru_list.settings_key ()).toStringList (); m_current_directory->addItems (mru_dirs); m_current_directory->setEditText @@ -432,9 +432,9 @@ int sort_column = m_file_tree_view->header ()->sortIndicatorSection (); Qt::SortOrder sort_order = m_file_tree_view->header ()->sortIndicatorOrder (); - settings.setValue (fb_sort_column.key, sort_column); - settings.setValue (fb_sort_order.key, sort_order); - settings.setValue (fb_column_state.key, + settings.setValue (fb_sort_column.settings_key (), sort_column); + settings.setValue (fb_sort_order.settings_key (), sort_order); + settings.setValue (fb_column_state.settings_key (), m_file_tree_view->header ()->saveState ()); QStringList dirs; @@ -442,7 +442,7 @@ { dirs.append (m_current_directory->itemText (i)); } - settings.setValue (fb_mru_list.key, dirs); + settings.setValue (fb_mru_list.settings_key (), dirs); settings.sync ();
--- a/libgui/src/find-files-dialog.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/find-files-dialog.cc Tue Jan 03 08:03:20 2023 -0500 @@ -77,7 +77,7 @@ QLabel *start_dir_label = new QLabel (tr ("Start in:")); m_start_dir_edit = new QLineEdit; - m_start_dir_edit->setText (settings.value (ff_start_dir.key, + m_start_dir_edit->setText (settings.value (ff_start_dir.settings_key (), QDir::currentPath ()).toString ()); m_start_dir_edit->setToolTip (tr ("Enter the start directory")); start_dir_label->setBuddy (m_start_dir_edit); @@ -122,7 +122,7 @@ m_file_list->setAlternatingRowColors (true); m_file_list->setToolTip (tr ("Search results")); m_file_list->setSortingEnabled (true); - m_file_list->horizontalHeader ()->restoreState (settings.value (ff_column_state.key).toByteArray ()); + m_file_list->horizontalHeader ()->restoreState (settings.value (ff_column_state.settings_key ()).toByteArray ()); m_file_list->horizontalHeader ()->setSortIndicatorShown (true); m_file_list->horizontalHeader ()->setSectionsClickable (true); m_file_list->horizontalHeader ()->setStretchLastSection (true); @@ -212,21 +212,21 @@ int sort_column = m_file_list->horizontalHeader ()->sortIndicatorSection (); Qt::SortOrder sort_order = m_file_list->horizontalHeader ()->sortIndicatorOrder (); - settings.setValue (ff_sort_files_by_column.key, sort_column); - settings.setValue (ff_sort_files_by_order.key, sort_order); - settings.setValue (ff_column_state.key, m_file_list->horizontalHeader ()->saveState ()); + settings.setValue (ff_sort_files_by_column.settings_key (), sort_column); + settings.setValue (ff_sort_files_by_order.settings_key (), sort_order); + settings.setValue (ff_column_state.settings_key (), m_file_list->horizontalHeader ()->saveState ()); - settings.setValue (ff_file_name.key, m_file_name_edit->text ()); + settings.setValue (ff_file_name.settings_key (), m_file_name_edit->text ()); - settings.setValue (ff_start_dir.key, m_start_dir_edit->text ()); + settings.setValue (ff_start_dir.settings_key (), m_start_dir_edit->text ()); - settings.setValue (ff_recurse_dirs.key, m_recurse_dirs_check->text ()); - settings.setValue (ff_include_dirs.key, m_include_dirs_check->text ()); - settings.setValue (ff_name_case.key, m_name_case_check->text ()); + settings.setValue (ff_recurse_dirs.settings_key (), m_recurse_dirs_check->text ()); + settings.setValue (ff_include_dirs.settings_key (), m_include_dirs_check->text ()); + settings.setValue (ff_name_case.settings_key (), m_name_case_check->text ()); - settings.setValue (ff_contains_text.key, m_contains_text_edit->text ()); - settings.setValue (ff_check_text.key, m_contains_text_check->isChecked ()); - settings.setValue (ff_content_case.key, m_content_case_check->isChecked ()); + settings.setValue (ff_contains_text.settings_key (), m_contains_text_edit->text ()); + settings.setValue (ff_check_text.settings_key (), m_contains_text_check->isChecked ()); + settings.setValue (ff_content_case.settings_key (), m_content_case_check->isChecked ()); settings.sync (); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-cs.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <QPalette> + +#include "gui-preferences-cs.h" +#include "gui-settings.h" + +// Console preferences + +gui_pref +cs_font ("terminal/fontName", QVariant ()); + +gui_pref +cs_font_size ("terminal/fontSize", QVariant (10)); + +gui_pref +cs_cursor ("terminal/cursorType", QVariant ("ibeam")); + +gui_pref +cs_cursor_blinking ("terminal/cursorBlinking", QVariant (true)); + +gui_pref +cs_cursor_use_fgcol ("terminal/cursorUseForegroundColor", QVariant (true)); + +gui_pref +cs_hist_buffer ("terminal/history_buffer", QVariant (1000)); + +gui_pref +cs_color_mode ("terminal/color_mode", QVariant (0)); + +gui_pref cs_colors[2*cs_colors_count] = +{ + {"terminal/color_f" + settings_color_modes_ext[0], QVariant (QPalette::WindowText)}, + {"terminal/color_b" + settings_color_modes_ext[0], QVariant (QPalette::Base)}, + {"terminal/color_s" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, + {"terminal/color_c" + settings_color_modes_ext[0], QVariant (QPalette::QPalette::WindowText)}, + {"terminal/color_f" + settings_color_modes_ext[1], QVariant ()}, // Default colors for 2nd mode empty, + {"terminal/color_b" + settings_color_modes_ext[1], QVariant ()}, // since they are determined at runtime + {"terminal/color_s" + settings_color_modes_ext[1], QVariant ()}, // by inverting the lightness of the + {"terminal/color_c" + settings_color_modes_ext[1], QVariant ()} // default colors in light mode +}; + +gui_pref +cs_focus_cmd ("terminal/focus_after_command", QVariant (false)); + +gui_pref +cs_dbg_location ("terminal/print_debug_location", QVariant (false));
--- a/libgui/src/gui-preferences-cs.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-cs.h Tue Jan 03 08:03:20 2023 -0500 @@ -27,15 +27,12 @@ #define octave_gui_preferences_cs_h 1 #include "gui-preferences.h" -#include "gui-settings.h" // Console preferences -const gui_pref -cs_font ("terminal/fontName", QVariant ()); +extern gui_pref cs_font; -const gui_pref -cs_font_size ("terminal/fontSize", QVariant (10)); +extern gui_pref cs_font_size; const std::vector<std::string> cs_cursor_types = { @@ -44,33 +41,20 @@ "underline" }; -const gui_pref -cs_cursor ("terminal/cursorType", QVariant ("ibeam")); +extern gui_pref cs_cursor; -const gui_pref -cs_cursor_blinking ("terminal/cursorBlinking", QVariant (true)); +extern gui_pref cs_cursor_blinking; -const gui_pref -cs_cursor_use_fgcol ("terminal/cursorUseForegroundColor", QVariant (true)); +extern gui_pref cs_cursor_use_fgcol; -const gui_pref -cs_hist_buffer ("terminal/history_buffer", QVariant (1000)); +extern gui_pref cs_hist_buffer; -const gui_pref -cs_color_mode ("terminal/color_mode", QVariant (0)); +extern gui_pref cs_color_mode; const unsigned int cs_colors_count = 4; -const gui_pref cs_colors[2*cs_colors_count] = -{ - {"terminal/color_f" + settings_color_modes_ext[0], QVariant (QPalette::WindowText)}, - {"terminal/color_b" + settings_color_modes_ext[0], QVariant (QPalette::Base)}, - {"terminal/color_s" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, - {"terminal/color_c" + settings_color_modes_ext[0], QVariant (QPalette::QPalette::WindowText)}, - {"terminal/color_f" + settings_color_modes_ext[1], QVariant ()}, // Default colors for 2nd mode empty, - {"terminal/color_b" + settings_color_modes_ext[1], QVariant ()}, // since they are determined at runtime - {"terminal/color_s" + settings_color_modes_ext[1], QVariant ()}, // by inverting the lightness of the - {"terminal/color_c" + settings_color_modes_ext[1], QVariant ()} // default colors in light mode -}; + +extern gui_pref cs_colors[]; + const QStringList cs_color_names = { QT_TRANSLATE_NOOP ("octave::settings_dialog", "foreground"), @@ -79,10 +63,8 @@ QT_TRANSLATE_NOOP ("octave::settings_dialog", "cursor") }; -const gui_pref -cs_focus_cmd ("terminal/focus_after_command", QVariant (false)); +extern gui_pref cs_focus_cmd; -const gui_pref -cs_dbg_location ("terminal/print_debug_location", QVariant (false)); +extern gui_pref cs_dbg_location; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-dc.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-dc.h" + +// documentation properties + +gui_pref +dc_bookmark_filter_active ("documentation_widget/filter_active", QVariant (false)); + +gui_pref +dc_bookmark_filter_shown ("documentation_widget/filter_shown", QVariant (true)); + +gui_pref +dc_bookmark_filter_mru ("documentation_widget/bookmark_filter_mru", QVariant ()); + +// Zoom level +gui_pref +dc_browser_zoom_level ("documentation_widget/browser_zoom_level", QVariant (0));
--- a/libgui/src/gui-preferences-dc.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-dc.h Tue Jan 03 08:03:20 2023 -0500 @@ -32,14 +32,12 @@ const QString dc_bookmark_file ("octave-doc-bookmarks.xbel"); -const gui_pref -dc_bookmark_filter_active ("documentation_widget/filter_active", QVariant (false)); + +extern gui_pref dc_bookmark_filter_active; -const gui_pref -dc_bookmark_filter_shown ("documentation_widget/filter_shown", QVariant (true)); +extern gui_pref dc_bookmark_filter_shown; -const gui_pref -dc_bookmark_filter_mru ("documentation_widget/bookmark_filter_mru", QVariant ()); +extern gui_pref dc_bookmark_filter_mru; // Constants for the xbel file format const QLatin1String dc_xbel_doctype ("<!DOCTYPE xbel>"); @@ -55,7 +53,6 @@ const QLatin1String dc_xbel_name_format ("xbel"); // Zoom level -const gui_pref -dc_browser_zoom_level ("documentation_widget/browser_zoom_level", QVariant (0)); +extern gui_pref dc_browser_zoom_level; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-dw.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <QColor> +#include <QRect> + +#include "gui-preferences-dw.h" + +gui_pref +dw_focus_follows_mouse ("DockWidgets/focus_follows_mouse", QVariant (false)); + +gui_pref +dw_title_custom_style ("DockWidgets/widget_title_custom_style", + QVariant (true)); + +gui_pref dw_title_3d ("DockWidgets/widget_title_3d", QVariant (20)); + +gui_pref dw_title_fg_color ("DockWidgets/title_fg_color", + QVariant (QColor (0, 0, 0))); + +gui_pref dw_title_fg_color_active ("DockWidgets/title_fg_color_active", + QVariant (QColor (255, 255, 255))); + +gui_pref dw_title_bg_color ("DockWidgets/title_bg_color", + QVariant (QColor (192, 192, 192))); + +gui_pref dw_title_bg_color_active ("DockWidgets/title_bg_color_active", + QVariant (QColor (128, 128, 128))); + +gui_pref dw_icon_set ("DockWidgets/widget_icon_set", QVariant ("NONE")); + +// The following keys have to be used with .arg (objectName ()) +gui_pref dw_float_geometry ("DockWidgets/%1_floating_geometry", + QVariant (QRect (50, 50, 480, 640))); + +gui_pref dw_dock_geometry ("DockWidgets/%1", + QVariant (QRect (10, 10, 240, 320))); + +gui_pref dw_is_visible ("DockWidgets/%1Visible", QVariant (true)); + +gui_pref dw_is_floating ("DockWidgets/%1Floating", QVariant (false)); + +gui_pref dw_is_minimized ("DockWidgets/%1_minimized", QVariant (false));
--- a/libgui/src/gui-preferences-dw.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-dw.h Tue Jan 03 08:03:20 2023 -0500 @@ -28,28 +28,21 @@ #include "gui-preferences.h" -const gui_pref -dw_focus_follows_mouse ("DockWidgets/focus_follows_mouse", QVariant (false)); +extern gui_pref dw_focus_follows_mouse; + +extern gui_pref dw_title_custom_style; -const gui_pref -dw_title_custom_style ("DockWidgets/widget_title_custom_style", - QVariant (true)); +extern gui_pref dw_title_3d; -const gui_pref dw_title_3d ("DockWidgets/widget_title_3d", QVariant (20)); +extern gui_pref dw_title_fg_color; -const gui_pref dw_title_fg_color ("DockWidgets/title_fg_color", - QVariant (QColor (0, 0, 0))); +extern gui_pref dw_title_fg_color_active; -const gui_pref dw_title_fg_color_active ("DockWidgets/title_fg_color_active", - QVariant (QColor (255, 255, 255))); +extern gui_pref dw_title_bg_color; -const gui_pref dw_title_bg_color ("DockWidgets/title_bg_color", - QVariant (QColor (192, 192, 192))); +extern gui_pref dw_title_bg_color_active; -const gui_pref dw_title_bg_color_active ("DockWidgets/title_bg_color_active", - QVariant (QColor (128, 128, 128))); - -const gui_pref dw_icon_set ("DockWidgets/widget_icon_set", QVariant ("NONE")); +extern gui_pref dw_icon_set; const QHash <QString, QString> dw_icon_set_names = { @@ -61,16 +54,14 @@ }; // The following keys have to be used with .arg (objectName ()) -const gui_pref dw_float_geometry ("DockWidgets/%1_floating_geometry", - QVariant (QRect (50, 50, 480, 640))); +extern gui_pref dw_float_geometry; -const gui_pref dw_dock_geometry ("DockWidgets/%1", - QVariant (QRect (10, 10, 240, 320))); +extern gui_pref dw_dock_geometry; -const gui_pref dw_is_visible ("DockWidgets/%1Visible", QVariant (true)); +extern gui_pref dw_is_visible; -const gui_pref dw_is_floating ("DockWidgets/%1Floating", QVariant (false)); +extern gui_pref dw_is_floating; -const gui_pref dw_is_minimized ("DockWidgets/%1_minimized", QVariant (false)); +extern gui_pref dw_is_minimized; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-ed.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,255 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#if defined (HAVE_QSCINTILLA) +#include <Qsci/qsciscintilla.h> +#endif + +#include "gui-preferences-ed.h" +#include "gui-settings.h" +#include "localcharset-wrapper.h" + +// Editor preferences + +// Lexer + +gui_pref +ed_color_mode ("editor/color_mode", QVariant (0)); + +// Code completion + +gui_pref +ed_code_completion_octave_builtins ("editor/codeCompletion_octave_builtins", + QVariant (true)); + +gui_pref +ed_code_completion_octave_functions ("editor/codeCompletion_octave_functions", + QVariant (true)); + +gui_pref +ed_code_completion_keywords ("editor/codeCompletion_keywords", QVariant (true)); + +gui_pref +ed_code_completion_document ("editor/codeCompletion_document", QVariant (true)); + +gui_pref +ed_code_completion_replace ("editor/codeCompletion_replace", QVariant (false)); + +gui_pref +ed_code_completion_case ("editor/codeCompletion_case", QVariant (true)); + +gui_pref +ed_code_completion ("editor/codeCompletion", QVariant (true)); + +gui_pref +ed_code_completion_threshold ("editor/codeCompletion_threshold", QVariant (3)); + +// Code formatting + +gui_pref +ed_code_folding ("editor/code_folding", QVariant (true)); + +gui_pref +ed_auto_indent ("editor/auto_indent", QVariant (true)); + +gui_pref +ed_tab_indents_line ("editor/tab_indents_line", QVariant (false)); + +gui_pref +ed_backspace_unindents_line ("editor/backspace_unindents_line", + QVariant (false)); + +gui_pref +ed_show_indent_guides ("editor/show_indent_guides", QVariant (false)); + +gui_pref +ed_indent_uses_tabs ("editor/indent_uses_tabs", QVariant (false)); + +gui_pref +ed_indent_width ("editor/indent_width", QVariant (2)); + +gui_pref +ed_tab_width ("editor/tab_width", QVariant (2)); + +gui_pref +ed_auto_endif ("editor/auto_endif", QVariant (1)); + +// Long line handling + +gui_pref +ed_long_line_column ("editor/long_line_column", QVariant (80)); + +gui_pref +ed_long_line_marker ("editor/long_line_marker", QVariant (true)); + +gui_pref +ed_long_line_marker_line ("editor/long_line_marker_line", QVariant (true)); + +gui_pref +ed_long_line_marker_background ("editor/long_line_marker_background", + QVariant (false)); + +gui_pref +ed_wrap_lines ("editor/wrap_lines", QVariant (false)); + +gui_pref +ed_break_lines ("editor/break_lines", QVariant (false)); + +gui_pref +ed_break_lines_comments ("editor/break_lines_comments", QVariant (false)); + +// Other + +gui_pref +ed_highlight_all_occurrences ("editor/highlight_all_occurrences", + QVariant (true)); + +gui_pref +ed_show_Line_numbers ("editor/showLineNumbers", QVariant (true)); + +gui_pref +ed_line_numbers_size ("editor/line_numbers_size", QVariant ( 0)); + +gui_pref +ed_show_edit_status_bar ("editor/show_edit_status_bar", QVariant (true)); + +gui_pref +ed_highlight_current_line ("editor/highlightCurrentLine", QVariant (true)); + +gui_pref +ed_highlight_current_line_color ("editor/highlightCurrentLineColor", + QVariant (settings_color_no_change)); + +gui_pref +ed_show_white_space ("editor/show_white_space", QVariant (false)); + +gui_pref +ed_show_white_space_indent ("editor/show_white_space_indent", QVariant (false)); + +gui_pref +ed_show_line_numbers ("editor/showLineNumbers", QVariant (true)); + +gui_pref +ed_show_eol_chars ("editor/show_eol_chars", QVariant (false)); + +gui_pref +ed_show_toolbar ("editor/show_toolbar", QVariant (true)); + +gui_pref +ed_show_hscroll_bar ("editor/show_hscroll_bar", QVariant (true)); + +// Octave comment strings + +gui_pref +ed_comment_str_old ("editor/octave_comment_string", QVariant (0)); + +gui_pref +ed_comment_str ("editor/oct_comment_str", QVariant (0)); + +gui_pref +ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8)); + +// Session data + +gui_pref +ed_restore_session ("editor/restoreSession", QVariant (true)); + +gui_pref +ed_session_names ("editor/savedSessionTabs", QVariant (QStringList ())); + +gui_pref +ed_session_enc ("editor/saved_session_encodings", QVariant (QStringList ())); + +gui_pref +ed_session_ind ("editor/saved_session_tab_index", QVariant (QStringList ())); + +gui_pref +ed_session_lines ("editor/saved_session_lines", QVariant (QStringList ())); + +gui_pref +ed_session_bookmarks ("editor/saved_session_bookmarks", QVariant (QStringList ())); + +// Tabs + +gui_pref +ed_tab_position ("editor/tab_position", QVariant (QTabWidget::North)); + +gui_pref +ed_tabs_rotated ("editor/tabs_rotated", QVariant (false)); + +gui_pref +ed_tabs_max_width ("editor/tabs_max_width", QVariant (0)); + +// File handling + +gui_pref +ed_force_newline ("editor/force_newline", QVariant (true)); + +gui_pref +ed_rm_trailing_spaces ("editor/rm_trailing_spaces", QVariant (true)); + +gui_pref +ed_default_eol_mode ("editor/default_eol_mode", QVariant (os_eol_mode)); + +gui_pref +ed_show_dbg_file ("editor/show_dbg_file", QVariant (true)); + +gui_pref +ed_default_enc ("editor/default_encoding", QVariant ("UTF-8")); + +gui_pref +ed_create_new_file ("editor/create_new_file", QVariant (false)); + +gui_pref +ed_hiding_closes_files ("editor/hiding_closes_files", QVariant (false)); + +gui_pref +ed_always_reload_changed_files ("editor/always_reload_changed_files", + QVariant (false)); + +gui_pref +ed_mru_file_list ("editor/mru_file_list", QVariant ()); + +gui_pref +ed_mru_file_encodings ("editor/mru_file_encodings", QVariant ()); + +// The find dialog + +// Dialog position, the default will be calculated from the editor's geometry +gui_pref +ed_fdlg_pos ("editor/fdgl_pos", QVariant (QPoint (0, 0))); + +gui_pref +ed_fdlg_opts ("editor/fdgl_opts", QVariant (FIND_DLG_WRAP)); + +gui_pref +ed_fdlg_search ("editor/fdgl_search", QVariant ()); + +gui_pref +ed_fdlg_replace ("editor/fdgl_replace", QVariant ());
--- a/libgui/src/gui-preferences-ed.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-ed.h Tue Jan 03 08:03:20 2023 -0500 @@ -31,150 +31,103 @@ #endif #include "gui-settings.h" -#include "localcharset-wrapper.h" // Editor preferences // Lexer -const gui_pref -ed_color_mode ("editor/color_mode", QVariant (0)); +extern gui_pref ed_color_mode; const int ed_max_lexer_styles = 64; const int ed_max_style_number = 128; // Code completion -const gui_pref -ed_code_completion_octave_builtins ("editor/codeCompletion_octave_builtins", - QVariant (true)); +extern gui_pref ed_code_completion_octave_builtins; + +extern gui_pref ed_code_completion_octave_functions; -const gui_pref -ed_code_completion_octave_functions ("editor/codeCompletion_octave_functions", - QVariant (true)); +extern gui_pref ed_code_completion_keywords; -const gui_pref -ed_code_completion_keywords ("editor/codeCompletion_keywords", QVariant (true)); +extern gui_pref ed_code_completion_document; -const gui_pref -ed_code_completion_document ("editor/codeCompletion_document", QVariant (true)); +extern gui_pref ed_code_completion_replace; -const gui_pref -ed_code_completion_replace ("editor/codeCompletion_replace", QVariant (false)); +extern gui_pref ed_code_completion_case; -const gui_pref -ed_code_completion_case ("editor/codeCompletion_case", QVariant (true)); +extern gui_pref ed_code_completion; -const gui_pref -ed_code_completion ("editor/codeCompletion", QVariant (true)); - -const gui_pref -ed_code_completion_threshold ("editor/codeCompletion_threshold", QVariant (3)); +extern gui_pref ed_code_completion_threshold; // Code formatting -const gui_pref -ed_code_folding ("editor/code_folding", QVariant (true)); +extern gui_pref ed_code_folding; -const gui_pref -ed_auto_indent ("editor/auto_indent", QVariant (true)); +extern gui_pref ed_auto_indent; -const gui_pref -ed_tab_indents_line ("editor/tab_indents_line", QVariant (false)); +extern gui_pref ed_tab_indents_line; -const gui_pref -ed_backspace_unindents_line ("editor/backspace_unindents_line", - QVariant (false)); +extern gui_pref ed_backspace_unindents_line; -const gui_pref -ed_show_indent_guides ("editor/show_indent_guides", QVariant (false)); +extern gui_pref ed_show_indent_guides; -const gui_pref -ed_indent_uses_tabs ("editor/indent_uses_tabs", QVariant (false)); +extern gui_pref ed_indent_uses_tabs; -const gui_pref -ed_indent_width ("editor/indent_width", QVariant (2)); +extern gui_pref ed_indent_width; -const gui_pref -ed_tab_width ("editor/tab_width", QVariant (2)); +extern gui_pref ed_tab_width; -const gui_pref -ed_auto_endif ("editor/auto_endif", QVariant (1)); +extern gui_pref ed_auto_endif; // Long line handling -const gui_pref -ed_long_line_column ("editor/long_line_column", QVariant (80)); +extern gui_pref ed_long_line_column; -const gui_pref -ed_long_line_marker ("editor/long_line_marker", QVariant (true)); +extern gui_pref ed_long_line_marker; -const gui_pref -ed_long_line_marker_line ("editor/long_line_marker_line", QVariant (true)); +extern gui_pref ed_long_line_marker_line; -const gui_pref -ed_long_line_marker_background ("editor/long_line_marker_background", - QVariant (false)); +extern gui_pref ed_long_line_marker_background; + +extern gui_pref ed_wrap_lines; -const gui_pref -ed_wrap_lines ("editor/wrap_lines", QVariant (false)); +extern gui_pref ed_break_lines; -const gui_pref -ed_break_lines ("editor/break_lines", QVariant (false)); - -const gui_pref -ed_break_lines_comments ("editor/break_lines_comments", QVariant (false)); +extern gui_pref ed_break_lines_comments; // Other -const gui_pref -ed_highlight_all_occurrences ("editor/highlight_all_occurrences", - QVariant (true)); +extern gui_pref ed_highlight_all_occurrences; -const gui_pref -ed_show_Line_numbers ("editor/showLineNumbers", QVariant (true)); +extern gui_pref ed_show_Line_numbers; + +extern gui_pref ed_line_numbers_size; -const gui_pref -ed_line_numbers_size ("editor/line_numbers_size", QVariant ( 0)); +extern gui_pref ed_show_edit_status_bar; -const gui_pref -ed_show_edit_status_bar ("editor/show_edit_status_bar", QVariant (true)); +extern gui_pref ed_highlight_current_line; -const gui_pref -ed_highlight_current_line ("editor/highlightCurrentLine", QVariant (true)); +extern gui_pref ed_highlight_current_line_color; -const gui_pref -ed_highlight_current_line_color ("editor/highlightCurrentLineColor", - QVariant (settings_color_no_change)); +extern gui_pref ed_show_white_space; -const gui_pref -ed_show_white_space ("editor/show_white_space", QVariant (false)); +extern gui_pref ed_show_white_space_indent; -const gui_pref -ed_show_white_space_indent ("editor/show_white_space_indent", QVariant (false)); +extern gui_pref ed_show_line_numbers; -const gui_pref -ed_show_line_numbers ("editor/showLineNumbers", QVariant (true)); - -const gui_pref -ed_show_eol_chars ("editor/show_eol_chars", QVariant (false)); +extern gui_pref ed_show_eol_chars; -const gui_pref -ed_show_toolbar ("editor/show_toolbar", QVariant (true)); +extern gui_pref ed_show_toolbar; -const gui_pref -ed_show_hscroll_bar ("editor/show_hscroll_bar", QVariant (true)); +extern gui_pref ed_show_hscroll_bar; // Octave comment strings -const gui_pref -ed_comment_str_old ("editor/octave_comment_string", QVariant (0)); +extern gui_pref ed_comment_str_old; -const gui_pref -ed_comment_str ("editor/oct_comment_str", QVariant (0)); +extern gui_pref ed_comment_str; -const gui_pref -ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8)); +extern gui_pref ed_uncomment_str; const QString ed_last_comment_str ("editor/oct_last_comment_str"); @@ -192,23 +145,17 @@ // Session data -const gui_pref -ed_restore_session ("editor/restoreSession", QVariant (true)); +extern gui_pref ed_restore_session; -const gui_pref -ed_session_names ("editor/savedSessionTabs", QVariant (QStringList ())); +extern gui_pref ed_session_names; -const gui_pref -ed_session_enc ("editor/saved_session_encodings", QVariant (QStringList ())); +extern gui_pref ed_session_enc; -const gui_pref -ed_session_ind ("editor/saved_session_tab_index", QVariant (QStringList ())); +extern gui_pref ed_session_ind; -const gui_pref -ed_session_lines ("editor/saved_session_lines", QVariant (QStringList ())); +extern gui_pref ed_session_lines; -const gui_pref -ed_session_bookmarks ("editor/saved_session_bookmarks", QVariant (QStringList ())); +extern gui_pref ed_session_bookmarks; // Tabs const QStringList @@ -219,22 +166,17 @@ QT_TRANSLATE_NOOP ("octave::settings_dialog", "Right") }; -const gui_pref -ed_tab_position ("editor/tab_position", QVariant (QTabWidget::North)); +extern gui_pref ed_tab_position; -const gui_pref -ed_tabs_rotated ("editor/tabs_rotated", QVariant (false)); +extern gui_pref ed_tabs_rotated; -const gui_pref -ed_tabs_max_width ("editor/tabs_max_width", QVariant (0)); +extern gui_pref ed_tabs_max_width; // File handling -const gui_pref -ed_force_newline ("editor/force_newline", QVariant (true)); +extern gui_pref ed_force_newline; -const gui_pref -ed_rm_trailing_spaces ("editor/rm_trailing_spaces", QVariant (true)); +extern gui_pref ed_rm_trailing_spaces; #if defined (HAVE_QSCINTILLA) #if defined (Q_OS_WIN32) @@ -246,30 +188,21 @@ const int os_eol_mode = 2; #endif -const gui_pref -ed_default_eol_mode ("editor/default_eol_mode", QVariant (os_eol_mode)); +extern gui_pref ed_default_eol_mode; -const gui_pref -ed_show_dbg_file ("editor/show_dbg_file", QVariant (true)); +extern gui_pref ed_show_dbg_file; -const gui_pref -ed_default_enc ("editor/default_encoding", QVariant ("UTF-8")); +extern gui_pref ed_default_enc; -const gui_pref -ed_create_new_file ("editor/create_new_file", QVariant (false)); +extern gui_pref ed_create_new_file; -const gui_pref -ed_hiding_closes_files ("editor/hiding_closes_files", QVariant (false)); +extern gui_pref ed_hiding_closes_files; + +extern gui_pref ed_always_reload_changed_files; -const gui_pref -ed_always_reload_changed_files ("editor/always_reload_changed_files", - QVariant (false)); +extern gui_pref ed_mru_file_list; -const gui_pref -ed_mru_file_list ("editor/mru_file_list", QVariant ()); - -const gui_pref -ed_mru_file_encodings ("editor/mru_file_encodings", QVariant ()); +extern gui_pref ed_mru_file_encodings; // The find dialog @@ -286,15 +219,12 @@ }; // Dialog position, the default will be calculated from the editor's geometry -const gui_pref -ed_fdlg_pos ("editor/fdgl_pos", QVariant (QPoint (0, 0))); +extern gui_pref ed_fdlg_pos; + +extern gui_pref ed_fdlg_opts; -const gui_pref -ed_fdlg_opts ("editor/fdgl_opts", QVariant (FIND_DLG_WRAP)); +extern gui_pref ed_fdlg_search; -const gui_pref -ed_fdlg_search ("editor/fdgl_search", QVariant ()); -const gui_pref -ed_fdlg_replace ("editor/fdgl_replace", QVariant ()); +extern gui_pref ed_fdlg_replace; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-fb.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-fb.h" + +// Files dock widget + +gui_pref +fb_column_state ("filesdockwidget/column_state", QVariant ()); + +gui_pref +fb_mru_list ("filesdockwidget/mru_dir_list", QVariant (QStringList ())); + +gui_pref +fb_show_size ("filesdockwidget/showFileSize", QVariant (false)); + +gui_pref +fb_show_type ("filesdockwidget/showFileType", QVariant (false)); + +gui_pref +fb_show_date ("filesdockwidget/showLastModified", QVariant (false)); + +gui_pref +fb_show_hidden ("filesdockwidget/showHiddenFiles", QVariant (false)); + +gui_pref +fb_show_altcol ("filesdockwidget/useAlternatingRowColors", QVariant (true)); + +gui_pref +fb_sort_column ("filesdockwidget/sort_files_by_column", QVariant (0)); + +gui_pref +fb_sort_order ("filesdockwidget/sort_files_by_order", + QVariant (Qt::AscendingOrder)); + +gui_pref +fb_sync_octdir ("filesdockwidget/sync_octave_directory", QVariant (true)); + +gui_pref +fb_restore_last_dir ("filesdockwidget/restore_last_dir", QVariant (false)); + +gui_pref +fb_startup_dir ("filesdockwidget/startup_dir", QVariant (QString ())); + +gui_pref +fb_txt_file_ext ("filesdockwidget/txt_file_extensions", + QVariant ("m;c;cc;cpp;h;txt")); +
--- a/libgui/src/gui-preferences-fb.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-fb.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,45 +30,30 @@ // Files dock widget -const gui_pref -fb_column_state ("filesdockwidget/column_state", QVariant ()); +extern gui_pref fb_column_state; -const gui_pref -fb_mru_list ("filesdockwidget/mru_dir_list", QVariant (QStringList ())); +extern gui_pref fb_mru_list; -const gui_pref -fb_show_size ("filesdockwidget/showFileSize", QVariant (false)); +extern gui_pref fb_show_size; -const gui_pref -fb_show_type ("filesdockwidget/showFileType", QVariant (false)); +extern gui_pref fb_show_type; -const gui_pref -fb_show_date ("filesdockwidget/showLastModified", QVariant (false)); +extern gui_pref fb_show_date; -const gui_pref -fb_show_hidden ("filesdockwidget/showHiddenFiles", QVariant (false)); +extern gui_pref fb_show_hidden; -const gui_pref -fb_show_altcol ("filesdockwidget/useAlternatingRowColors", QVariant (true)); +extern gui_pref fb_show_altcol; -const gui_pref -fb_sort_column ("filesdockwidget/sort_files_by_column", QVariant (0)); +extern gui_pref fb_sort_column; -const gui_pref -fb_sort_order ("filesdockwidget/sort_files_by_order", - QVariant (Qt::AscendingOrder)); +extern gui_pref fb_sort_order; -const gui_pref -fb_sync_octdir ("filesdockwidget/sync_octave_directory", QVariant (true)); +extern gui_pref fb_sync_octdir; -const gui_pref -fb_restore_last_dir ("filesdockwidget/restore_last_dir", QVariant (false)); +extern gui_pref fb_restore_last_dir; -const gui_pref -fb_startup_dir ("filesdockwidget/startup_dir", QVariant (QString ())); +extern gui_pref fb_startup_dir; -const gui_pref -fb_txt_file_ext ("filesdockwidget/txt_file_extensions", - QVariant ("m;c;cc;cpp;h;txt")); +extern gui_pref fb_txt_file_ext; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-ff.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,66 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-ff.h" + +// Find files dialog preferences + +gui_pref +ff_file_name ("findfiles/file_name", QVariant ("*")); + +gui_pref +ff_start_dir ("findfiles/start_dir", QVariant ("")); + +gui_pref +ff_recurse_dirs ("findfiles/recurse_dirs", QVariant (false)); + +gui_pref +ff_include_dirs ("findfiles/include_dirs", QVariant (false)); + +gui_pref +ff_name_case ("findfiles/name_case", QVariant (false)); + +gui_pref +ff_check_text ("findfiles/check_text", QVariant (false)); + +gui_pref +ff_contains_text ("findfiles/contains_text", QVariant ("")); + +gui_pref +ff_content_case ("findfiles/content_case", QVariant (false)); + +gui_pref +ff_column_state ("findfiles/column_state", QVariant ()); + +gui_pref +ff_sort_files_by_column ("findfiles/sort_files_by_column", QVariant (0)); + +gui_pref +ff_sort_files_by_order ("findfiles/sort_files_by_order", + QVariant (Qt::AscendingOrder));
--- a/libgui/src/gui-preferences-ff.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-ff.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,39 +30,27 @@ // Find files dialog preferences -const gui_pref -ff_file_name ("findfiles/file_name", QVariant ("*")); +extern gui_pref ff_file_name; -const gui_pref -ff_start_dir ("findfiles/start_dir", QVariant ("")); +extern gui_pref ff_start_dir; -const gui_pref -ff_recurse_dirs ("findfiles/recurse_dirs", QVariant (false)); +extern gui_pref ff_recurse_dirs; -const gui_pref -ff_include_dirs ("findfiles/include_dirs", QVariant (false)); +extern gui_pref ff_include_dirs; -const gui_pref -ff_name_case ("findfiles/name_case", QVariant (false)); +extern gui_pref ff_name_case; -const gui_pref -ff_check_text ("findfiles/check_text", QVariant (false)); +extern gui_pref ff_check_text; -const gui_pref -ff_contains_text ("findfiles/contains_text", QVariant ("")); +extern gui_pref ff_contains_text; -const gui_pref -ff_content_case ("findfiles/content_case", QVariant (false)); +extern gui_pref ff_content_case; -const gui_pref -ff_column_state ("findfiles/column_state", QVariant ()); +extern gui_pref ff_column_state; -const gui_pref -ff_sort_files_by_column ("findfiles/sort_files_by_column", QVariant (0)); +extern gui_pref ff_sort_files_by_column; -const gui_pref -ff_sort_files_by_order ("findfiles/sort_files_by_order", - QVariant (Qt::AscendingOrder)); +extern gui_pref ff_sort_files_by_order; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-global.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,119 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-global.h" + +// Global preferences + +gui_pref +global_skip_welcome_wizard ("global_skip_welcome_wizard", false); + +gui_pref +global_mono_font ("monospace_font", global_font_family); + +// Style + +gui_pref +global_style ("style", QVariant ("default")); + +// Icon size (in preferences: values -1, 0, 1) + +gui_pref +global_icon_size ("toolbar_icon_size", QVariant (0)); + +gui_pref +global_icon_theme ("use_system_icon_theme", QVariant (true)); + +gui_pref +global_icon_theme_index ("icon_theme", QVariant (ICON_THEME_SYSTEM)); + +gui_pref +global_icon_fallbacks ("icon_fallbacks", QVariant (QStringList ())); + +gui_pref +global_status_bar ("show_status_bar", QVariant (true)); + +#if defined (Q_OS_MAC) +// prevent native file dialogs on MAC by setting the default "false" and +// setting the flag for ignoring the pref to "true" (3rd argument) +gui_pref +global_use_native_dialogs ("use_native_file_dialogs", QVariant (false), true); +#elif defined (Q_OS_WIN32) +gui_pref +global_use_native_dialogs ("use_native_file_dialogs", QVariant (false)); +#else +gui_pref +global_use_native_dialogs ("use_native_file_dialogs", QVariant (true)); +#endif + +gui_pref +global_cursor_blinking ("cursor_blinking", QVariant (true)); + +gui_pref +global_language ("language", QVariant ("SYSTEM")); + +gui_pref +global_ov_startup_dir ("octave_startup_dir", QVariant (QString ())); + +gui_pref +global_restore_ov_dir ("restore_octave_dir", QVariant (false)); + +gui_pref +global_use_custom_editor ("useCustomFileEditor", QVariant (false)); + +#if defined (Q_OS_WIN32) +gui_pref +global_custom_editor ("customFileEditor", QVariant ("notepad++ -n%l %f")); +#else +gui_pref +global_custom_editor ("customFileEditor", QVariant ("emacs +%l %f")); +#endif + +gui_pref +global_prompt_to_exit ("prompt_to_exit", QVariant (false)); + +// Proxy + +gui_pref +global_proxy_host ("proxyHostName", QVariant (QString ())); + +gui_pref +global_use_proxy ("useProxyServer", QVariant (false)); + +gui_pref +global_proxy_type ("proxyType", QVariant (QString ())); + +gui_pref +global_proxy_port ("proxyPort", QVariant (80)); + +gui_pref +global_proxy_user ("proxyUserName", QVariant (QString ())); + +gui_pref +global_proxy_pass ("proxyPassword", QVariant (QString ()));
--- a/libgui/src/gui-preferences-global.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-global.h Tue Jan 03 08:03:20 2023 -0500 @@ -26,6 +26,8 @@ #if ! defined (octave_gui_preferences_global_h) #define octave_gui_preferences_global_h 1 +#include <QStyle> + #include "gui-preferences.h" // Constants @@ -34,8 +36,7 @@ // Global preferences -const gui_pref -global_skip_welcome_wizard ("global_skip_welcome_wizard", false); +extern gui_pref global_skip_welcome_wizard; // Get the default monospaced font #if defined (Q_OS_WIN) @@ -46,13 +47,11 @@ const QString global_font_family = "Monospace"; #endif -const gui_pref -global_mono_font ("monospace_font", global_font_family); +extern gui_pref global_mono_font; // Style -const gui_pref -global_style ("style", QVariant ("default")); +extern gui_pref global_style; const QString global_toolbar_style ("QToolBar {" @@ -81,11 +80,9 @@ QStyle::PM_LargeIconSize }; -const gui_pref -global_icon_size ("toolbar_icon_size", QVariant (0)); +extern gui_pref global_icon_size; -const gui_pref -global_icon_theme ("use_system_icon_theme", QVariant (true)); +extern gui_pref global_icon_theme; enum { @@ -103,8 +100,8 @@ ":/icons/cursors/" }; -const gui_pref -global_icon_theme_index ("icon_theme", QVariant (ICON_THEME_SYSTEM)); +extern gui_pref global_icon_theme_index; + const QStringList global_all_icon_themes = { "", @@ -120,12 +117,9 @@ "Tango" }; -const gui_pref -global_icon_fallbacks ("icon_fallbacks", QVariant (QStringList ())); +extern gui_pref global_icon_fallbacks; -const gui_pref -global_status_bar ("show_status_bar", QVariant (true)); - +extern gui_pref global_status_bar; enum { @@ -139,55 +133,44 @@ #if defined (Q_OS_MAC) // prevent native file dialogs on MAC by setting the default "false" and // setting the flag for ignoring the pref to "true" (3rd argument) -const gui_pref -global_use_native_dialogs ("use_native_file_dialogs", QVariant (false), true); +extern gui_pref global_use_native_dialogs; #elif defined (Q_OS_WIN32) -const gui_pref -global_use_native_dialogs ("use_native_file_dialogs", QVariant (false)); +extern gui_pref global_use_native_dialogs; #else -const gui_pref -global_use_native_dialogs ("use_native_file_dialogs", QVariant (true)); +extern gui_pref global_use_native_dialogs; #endif -const gui_pref -global_cursor_blinking ("cursor_blinking", QVariant (true)); +extern gui_pref global_cursor_blinking; -const gui_pref -global_language ("language", QVariant ("SYSTEM")); +extern gui_pref global_language; -const gui_pref -global_ov_startup_dir ("octave_startup_dir", QVariant (QString ())); -const gui_pref -global_restore_ov_dir ("restore_octave_dir", QVariant (false)); +extern gui_pref global_ov_startup_dir; -const gui_pref -global_use_custom_editor ("useCustomFileEditor", QVariant (false)); +extern gui_pref global_restore_ov_dir; + +extern gui_pref global_use_custom_editor; #if defined (Q_OS_WIN32) -const gui_pref -global_custom_editor ("customFileEditor", QVariant ("notepad++ -n%l %f")); +extern gui_pref global_custom_editor; #else -const gui_pref -global_custom_editor ("customFileEditor", QVariant ("emacs +%l %f")); +extern gui_pref global_custom_editor; #endif -const gui_pref -global_prompt_to_exit ("prompt_to_exit", QVariant (false)); +extern gui_pref global_prompt_to_exit; // Proxy -const gui_pref -global_proxy_host ("proxyHostName", QVariant (QString ())); -const gui_pref -global_use_proxy ("useProxyServer", QVariant (false)); -const gui_pref -global_proxy_type ("proxyType", QVariant (QString ())); -const gui_pref -global_proxy_port ("proxyPort", QVariant (80)); -const gui_pref -global_proxy_user ("proxyUserName", QVariant (QString ())); -const gui_pref -global_proxy_pass ("proxyPassword", QVariant (QString ())); +extern gui_pref global_proxy_host; + +extern gui_pref global_use_proxy; + +extern gui_pref global_proxy_type; + +extern gui_pref global_proxy_port; + +extern gui_pref global_proxy_user; + +extern gui_pref global_proxy_pass; const QStringList global_proxy_all_types = {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-gp.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-gp.h" + +// Graphics utilities + +gui_pref +gp_annotation_geometry ("annotation/geometry", QVariant ());
--- a/libgui/src/gui-preferences-gp.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-gp.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,7 +30,6 @@ // Graphics utilities -const gui_pref -gp_annotation_geometry ("annotation/geometry", QVariant ()); +extern gui_pref gp_annotation_geometry; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-hw.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-hw.h" + +// News Reader properties + +gui_pref +hw_filter_active ("history_dock_widget/filter_active", QVariant (false)); + +gui_pref +hw_filter_shown ("history_dock_widget/filter_shown", QVariant (true)); + +gui_pref +hw_mru_list ("history_dock_widget/mru_list", QVariant ());
--- a/libgui/src/gui-preferences-hw.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-hw.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,13 +30,10 @@ // News Reader properties -const gui_pref -hw_filter_active ("history_dock_widget/filter_active", QVariant (false)); +extern gui_pref hw_filter_active; -const gui_pref -hw_filter_shown ("history_dock_widget/filter_shown", QVariant (true)); +extern gui_pref hw_filter_shown; -const gui_pref -hw_mru_list ("history_dock_widget/mru_list", QVariant ()); +extern gui_pref hw_mru_list; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-mw.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-mw.h" + +// Main window preferences + +// Geometry wihtout default since default layout is built programmatically +gui_pref +mw_geometry ("MainWindow/geometry", QVariant (QByteArray ())); + +// State wihtout default since default layout is built programmatically +gui_pref +mw_state ("MainWindow/windowState", QVariant (QByteArray ())); + +gui_pref +mw_dir_list ("MainWindow/current_directory_list", QVariant (QStringList ()));
--- a/libgui/src/gui-preferences-mw.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-mw.h Tue Jan 03 08:03:20 2023 -0500 @@ -31,14 +31,11 @@ // Main window preferences // Geometry wihtout default since default layout is built programmatically -const gui_pref -mw_geometry ("MainWindow/geometry", QVariant (QByteArray ())); +extern gui_pref mw_geometry; // State wihtout default since default layout is built programmatically -const gui_pref -mw_state ("MainWindow/windowState", QVariant (QByteArray ())); +extern gui_pref mw_state; -const gui_pref -mw_dir_list ("MainWindow/current_directory_list", QVariant (QStringList ())); +extern gui_pref mw_dir_list; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-nr.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-nr.h" +#include <QDateTime> + +// News Reader properties + +gui_pref +nr_last_time ("news/last_time_checked", QVariant (QDateTime ())); + +gui_pref +nr_last_news ("news/last_news_item", QVariant (0)); + +gui_pref +nr_allow_connection ("news/allow_web_connection", QVariant (false));
--- a/libgui/src/gui-preferences-nr.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-nr.h Tue Jan 03 08:03:20 2023 -0500 @@ -27,17 +27,13 @@ #define octave_gui_preferences_nr_h 1 #include "gui-preferences.h" -#include <QDateTime> // News Reader properties -const gui_pref -nr_last_time ("news/last_time_checked", QVariant (QDateTime ())); +extern gui_pref nr_last_time; -const gui_pref -nr_last_news ("news/last_news_item", QVariant (0)); +extern gui_pref nr_last_news; -const gui_pref -nr_allow_connection ("news/allow_web_connection", QVariant (false)); +extern gui_pref nr_allow_connection; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-pd.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-pd.h" + +// Path Dialog properties + +gui_pref +pd_geometry ("path_dlg_geometry", QVariant (QByteArray ()));
--- a/libgui/src/gui-preferences-pd.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-pd.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,7 +30,6 @@ // Path Dialog properties -const gui_pref -pd_geometry ("path_dlg_geometry", QVariant (QByteArray ())); +extern gui_pref pd_geometry; #endif
--- a/libgui/src/gui-preferences-sc.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-sc.h Tue Jan 03 08:03:20 2023 -0500 @@ -26,9 +26,6 @@ #if ! defined (octave_gui_preferences_sc_h) #define octave_gui_preferences_sc_h 1 -#include <QSet> -#include <QString> - #include "gui-preferences.h" // Define shortcuts
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-sd.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-sd.h" + +// Settings dialog + +gui_pref +sd_geometry ("settings/geometry", QVariant ()); + +gui_pref +sd_last_tab ("settings/last_tab", QVariant (0)); + +gui_pref +sd_last_editor_styles_tab ("settings/last_editor_styles_tab", QVariant (0));
--- a/libgui/src/gui-preferences-sd.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-sd.h Tue Jan 03 08:03:20 2023 -0500 @@ -30,34 +30,36 @@ // Settings dialog -const gui_pref -sd_geometry ("settings/geometry", QVariant ()); +extern gui_pref sd_geometry; -const gui_pref -sd_last_tab ("settings/last_tab", QVariant (0)); +extern gui_pref sd_last_tab; -const gui_pref -sd_last_editor_styles_tab ("settings/last_editor_styles_tab", QVariant (0)); +extern gui_pref sd_last_editor_styles_tab; // Textstrings for second color schemes const QString settings_color_modes = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "Second color mode (light/dark)"); + const QString settings_color_modes_tooltip = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "Switches to another set of colors.\n" "Useful for defining a dark/light mode.\n" "Discards non-applied current changes!"); + const QString settings_reload_colors = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "&Reload default colors"); + const QString settings_reload_colors_tooltip = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "Reloads the default colors,\n" "depending on currently selected mode."); + const QString settings_reload_styles = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "&Reload default styles"); + const QString settings_reload_styles_tooltip = QT_TRANSLATE_NOOP ( "octave::settings_dialog", "Reloads the default values of the styles,\n"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-ve.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-ve.h" + +#include <QApplication> + +// Variable Editor preferences + +gui_pref +ve_use_terminal_font ("variable_editor/use_terminal_font", QVariant (true)); + +gui_pref +ve_font_name ("variable_editor/font_name", QVariant ()); + +gui_pref +ve_font_size ("variable_editor/font_size", QVariant (10)); + +gui_pref +ve_column_width ("variable_editor/column_width", QVariant (100)); + +gui_pref +ve_row_height ("variable_editor/row_height", QVariant (10)); + +gui_pref +ve_alternate_rows ("variable_editor/alternate_rows", QVariant (false)); + +gui_pref +ve_color_mode ("variable_editor/color_mode", QVariant (0)); + +gui_pref ve_colors[2*ve_colors_count] = +{ + {"variable_editor/color_f" + settings_color_modes_ext[0], QVariant (QPalette::WindowText)}, + {"variable_editor/color_b" + settings_color_modes_ext[0], QVariant (QPalette::Base)}, + {"variable_editor/color_s" + settings_color_modes_ext[0], QVariant (QPalette::HighlightedText)}, + {"variable_editor/color_h" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, + {"variable_editor/color_a" + settings_color_modes_ext[0], QVariant (QPalette::AlternateBase)}, + {"variable_editor/color_f" + settings_color_modes_ext[1], QVariant ()}, + {"variable_editor/color_b" + settings_color_modes_ext[1], QVariant ()}, + {"variable_editor/color_s" + settings_color_modes_ext[1], QVariant ()}, + {"variable_editor/color_h" + settings_color_modes_ext[1], QVariant ()}, + {"variable_editor/color_a" + settings_color_modes_ext[1], QVariant ()} +};
--- a/libgui/src/gui-preferences-ve.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-ve.h Tue Jan 03 08:03:20 2023 -0500 @@ -27,48 +27,29 @@ #define octave_gui_preferences_ve_h 1 #include "gui-preferences.h" - -#include <QApplication> +#include "gui-settings.h" // Variable Editor preferences -const gui_pref -ve_use_terminal_font ("variable_editor/use_terminal_font", QVariant (true)); +extern gui_pref ve_use_terminal_font; -const gui_pref -ve_font_name ("variable_editor/font_name", QVariant ()); +extern gui_pref ve_font_name; -const gui_pref -ve_font_size ("variable_editor/font_size", QVariant (10)); +extern gui_pref ve_font_size; -const gui_pref -ve_column_width ("variable_editor/column_width", QVariant (100)); +extern gui_pref ve_column_width; -const gui_pref -ve_row_height ("variable_editor/row_height", QVariant (10)); +extern gui_pref ve_row_height; -const gui_pref -ve_alternate_rows ("variable_editor/alternate_rows", QVariant (false)); +extern gui_pref ve_alternate_rows; -const gui_pref -ve_color_mode ("variable_editor/color_mode", QVariant (0)); +extern gui_pref ve_color_mode; const QString ve_color_chars ("fbsha"); const int ve_colors_count = 5; -const gui_pref ve_colors[2*ve_colors_count] = -{ - {"variable_editor/color_f" + settings_color_modes_ext[0], QVariant (QPalette::WindowText)}, - {"variable_editor/color_b" + settings_color_modes_ext[0], QVariant (QPalette::Base)}, - {"variable_editor/color_s" + settings_color_modes_ext[0], QVariant (QPalette::HighlightedText)}, - {"variable_editor/color_h" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, - {"variable_editor/color_a" + settings_color_modes_ext[0], QVariant (QPalette::AlternateBase)}, - {"variable_editor/color_f" + settings_color_modes_ext[1], QVariant ()}, - {"variable_editor/color_b" + settings_color_modes_ext[1], QVariant ()}, - {"variable_editor/color_s" + settings_color_modes_ext[1], QVariant ()}, - {"variable_editor/color_h" + settings_color_modes_ext[1], QVariant ()}, - {"variable_editor/color_a" + settings_color_modes_ext[1], QVariant ()} -}; + +extern gui_pref ve_colors[]; const QStringList ve_color_names = { QT_TRANSLATE_NOOP ("octave::settings_dialog", "Foreground"),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-ws.cc Tue Jan 03 08:03:20 2023 -0500 @@ -0,0 +1,73 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "gui-preferences-ws.h" +#include "gui-settings.h" + +// Workspace view + +gui_pref +ws_enable_colors ("workspaceview/enable_colors", QVariant (false)); + +gui_pref +ws_hide_tool_tips ("workspaceview/hide_tools_tips", QVariant (false)); + +gui_pref +ws_filter_active ("workspaceview/filter_active", QVariant (false)); + +gui_pref +ws_filter_shown ("workspaceview/filter_shown", QVariant (true)); + +gui_pref +ws_column_state ("workspaceview/column_state", QVariant ()); + +gui_pref +ws_sort_column ("workspaceview/sort_by_column", QVariant (0)); + +gui_pref +ws_sort_order ("workspaceview/sort_order", QVariant (Qt::AscendingOrder)); + +gui_pref +ws_mru_list ("workspaceview/mru_list", QVariant ()); + +gui_pref +ws_max_filter_history ("workspaceview/max_filter_history", QVariant (10)); + +gui_pref +ws_color_mode ("workspaceview/color_mode", QVariant (0)); + +gui_pref ws_colors[2*ws_colors_count] = +{ + {"workspaceview/color_a" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, + {"workspaceview/color_g" + settings_color_modes_ext[0], QVariant (QPalette::Midlight)}, + {"workspaceview/color_p" + settings_color_modes_ext[0], QVariant (QPalette::Dark)}, + {"workspaceview/color_a" + settings_color_modes_ext[1], QVariant ()}, + {"workspaceview/color_g" + settings_color_modes_ext[1], QVariant ()}, + {"workspaceview/color_p" + settings_color_modes_ext[1], QVariant ()} +};
--- a/libgui/src/gui-preferences-ws.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences-ws.h Tue Jan 03 08:03:20 2023 -0500 @@ -27,33 +27,24 @@ #define octave_gui_preferences_ws_h 1 #include "gui-preferences.h" -#include "gui-settings.h" // Workspace view -const gui_pref -ws_enable_colors ("workspaceview/enable_colors", QVariant (false)); +extern gui_pref ws_enable_colors; -const gui_pref -ws_hide_tool_tips ("workspaceview/hide_tools_tips", QVariant (false)); +extern gui_pref ws_hide_tool_tips; -const gui_pref -ws_filter_active ("workspaceview/filter_active", QVariant (false)); +extern gui_pref ws_filter_active; -const gui_pref -ws_filter_shown ("workspaceview/filter_shown", QVariant (true)); +extern gui_pref ws_filter_shown; -const gui_pref -ws_column_state ("workspaceview/column_state", QVariant ()); +extern gui_pref ws_column_state; -const gui_pref -ws_sort_column ("workspaceview/sort_by_column", QVariant (0)); +extern gui_pref ws_sort_column; -const gui_pref -ws_sort_order ("workspaceview/sort_order", QVariant (Qt::AscendingOrder)); +extern gui_pref ws_sort_order; -const gui_pref -ws_mru_list ("workspaceview/mru_list", QVariant ()); +extern gui_pref ws_mru_list; const QStringList ws_columns_shown = { QT_TRANSLATE_NOOP ("octave::workspace_view", "Class"), @@ -69,22 +60,13 @@ "workspaceview/show_attribute" }; -const gui_pref -ws_max_filter_history ("workspaceview/max_filter_history", QVariant (10)); +extern gui_pref ws_max_filter_history; -const gui_pref -ws_color_mode ("workspaceview/color_mode", QVariant (0)); +extern gui_pref ws_color_mode; const int ws_colors_count = 3; -const gui_pref ws_colors[2*ws_colors_count] = -{ - {"workspaceview/color_a" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)}, - {"workspaceview/color_g" + settings_color_modes_ext[0], QVariant (QPalette::Midlight)}, - {"workspaceview/color_p" + settings_color_modes_ext[0], QVariant (QPalette::Dark)}, - {"workspaceview/color_a" + settings_color_modes_ext[1], QVariant ()}, - {"workspaceview/color_g" + settings_color_modes_ext[1], QVariant ()}, - {"workspaceview/color_p" + settings_color_modes_ext[1], QVariant ()} -}; + +extern gui_pref ws_colors[]; const QString ws_class_chars ("agp");
--- a/libgui/src/gui-preferences.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences.cc Tue Jan 03 08:03:20 2023 -0500 @@ -30,6 +30,60 @@ #include "gui-preferences-sc.h" #include "gui-preferences.h" +gui_pref::gui_pref (const QString& settings_key, const QVariant& def, + bool ignore) + : m_settings_key (settings_key), m_def (def), m_ignore (ignore) +{ + all_gui_preferences::insert (settings_key, *this); +} + +all_gui_preferences *all_gui_preferences::s_instance = nullptr; + +void all_gui_preferences::insert (const QString& settings_key, + const gui_pref& pref) +{ + ensure_instance (); + + s_instance->do_insert (settings_key, pref); +} + +const gui_pref all_gui_preferences::value (const QString& settings_key) +{ + ensure_instance (); + + return s_instance->do_value (settings_key); +} + +QStringList all_gui_preferences::keys (void) +{ + ensure_instance (); + + return s_instance->do_keys (); +} + +void all_gui_preferences::do_insert (const QString& settings_key, + const gui_pref& pref) +{ + m_hash.insert (settings_key, pref); +} + +const gui_pref +all_gui_preferences::do_value (const QString& settings_key) const +{ + return m_hash.value (settings_key); +} + +QStringList all_gui_preferences::do_keys (void) const +{ + return m_hash.keys (); +} + +void all_gui_preferences::ensure_instance (void) +{ + if (! s_instance) + s_instance = new all_gui_preferences (); +} + sc_pref::sc_pref (const QString& description, const QString& settings_key, Qt::Key def) : m_description (description), m_settings_key (settings_key), m_def (def),
--- a/libgui/src/gui-preferences.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-preferences.h Tue Jan 03 08:03:20 2023 -0500 @@ -32,26 +32,90 @@ #include <QTextCodec> #include <QVariant> +// FIXME: Would it be possible/make sense to merge gui_pref and sc_pref +// into a single class or to at least have them derived from a common +// base class so we could have one global hash table that contains all +// of them? + // Structure for the definition of pairs: key and default value -struct gui_pref +class gui_pref { - gui_pref (const QString& key_arg, const QVariant& def_arg, - const bool ignore_arg = false) - : key (key_arg), def (def_arg), ignore (ignore_arg) - { } +public: + + // Default constructed gui_pref objects are invalid, but we need this + // to create QHash objects that contain gui_pref objects. No invalid + // gui_pref objects should acutally be used. + + gui_pref (void) = default; + + gui_pref (const QString& settings_key, const QVariant& def, + bool ignore = false); + + gui_pref (const gui_pref&) = default; + + gui_pref& operator = (const gui_pref&) = default; + + ~gui_pref (void) = default; + + QString settings_key (void) const { return m_settings_key; } + QVariant def (void) const { return m_def; } + bool ignore (void) const { return m_ignore; } + +private: + + // The settings key name. + QString m_settings_key; + + // The default value. + QVariant m_def; + + // TRUE means always take the default. + bool m_ignore; +}; + +// FIXME: Is there a better/more modern way to manage this data than to +// have this style of singleton class? + +// Allow lookup of gui_pref objects when we don't know the name at +// compile time. + +class all_gui_preferences +{ +public: + + all_gui_preferences (void) = default; // No copying! - gui_pref (const gui_pref&) = delete; + all_gui_preferences (const all_gui_preferences&) = delete; + + all_gui_preferences& + operator = (const all_gui_preferences&) = delete; - gui_pref& operator = (const gui_pref&) = delete; + ~all_gui_preferences (void) = default; + + static void insert (const QString& settings_key, const gui_pref& pref); + + static const gui_pref value (const QString& settings_key); + + static QStringList keys (void); - ~gui_pref (void) = default; +private: + + // Map from shortcut identifier (settings key) to gui_pref object. + QHash <QString, gui_pref> m_hash; + + void do_insert (const QString& settings_key, const gui_pref& pref); - const QString key; // the key name - const QVariant def; // the default value - const bool ignore; // when true, ignore, i.e. always take default + const gui_pref do_value (const QString& settings_key) const; + + QStringList do_keys (void) const; + + static void ensure_instance (void); + + // Map from shortcut identifier (settings key) to sc_pref object. + static all_gui_preferences *s_instance; }; // The version for shortcuts, where the default value is stored as a @@ -113,6 +177,9 @@ // FIXME: Is there a better/more modern way to manage this data than to // have this style of singleton class? +// Allow lookup of sc_pref objects when we don't know the name at +// compile time. + class all_shortcut_preferences { public:
--- a/libgui/src/gui-settings.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-settings.cc Tue Jan 03 08:03:20 2023 -0500 @@ -42,6 +42,7 @@ #include <QShortcut> #include <QString> #include <QStringList> +#include <QTextCodec> #include "gui-preferences-cs.h" #include "gui-preferences-ed.h" @@ -49,6 +50,7 @@ #include "gui-preferences-global.h" #include "gui-settings.h" +#include "localcharset-wrapper.h" #include "oct-env.h" #include "defaults.h" @@ -101,9 +103,9 @@ QColor gui_settings::color_value (const gui_pref& pref, int mode) const { - QColor default_color = get_color_value (pref.def, mode); + QColor default_color = get_color_value (pref.def (), mode); - return value (pref.key + settings_color_modes_ext[mode], + return value (pref.settings_key () + settings_color_modes_ext[mode], QVariant (default_color)).value<QColor> (); } @@ -114,7 +116,8 @@ if (m > 1) m = 1; - setValue (pref.key + settings_color_modes_ext[m], QVariant (color)); + setValue (pref.settings_key () + settings_color_modes_ext[m], + QVariant (color)); } QString gui_settings::sc_value (const sc_pref& scpref) const @@ -166,7 +169,7 @@ { int theme_index; - if (contains (global_icon_theme_index.key)) + if (contains (global_icon_theme_index.settings_key ())) theme_index = value (global_icon_theme_index).toInt (); else { @@ -178,8 +181,8 @@ else theme_index = ICON_THEME_OCTAVE; - setValue (global_icon_theme_index.key, theme_index); - remove (global_icon_theme.key); + setValue (global_icon_theme_index.settings_key (), theme_index); + remove (global_icon_theme.settings_key ()); } QIcon::setThemeName (global_all_icon_themes.at (theme_index)); @@ -204,7 +207,7 @@ icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS); - setValue (global_icon_fallbacks.key, icon_fallbacks); + setValue (global_icon_fallbacks.settings_key (), icon_fallbacks); } QIcon gui_settings::icon (const QString& icon_name, bool octave_only, @@ -219,7 +222,7 @@ return QIcon (QIcon::fromTheme (icon_alt_name)); QStringList icon_fallbacks - = value (global_icon_fallbacks.key).toStringList (); + = value (global_icon_fallbacks.settings_key ()).toStringList (); for (int i = 0; i < icon_fallbacks.length (); i++ ) { @@ -334,7 +337,7 @@ // be initialize and valid? // get the locale from the settings if already available - language = value (global_language.key, global_language.def).toString (); + language = value (global_language).toString (); // load the translations depending on the settings if (language == "SYSTEM") @@ -493,11 +496,11 @@ QString pass; QUrl proxy_url = QUrl (); - if (value (global_use_proxy.key, global_use_proxy.def).toBool ()) + if (value (global_use_proxy).toBool ()) { // Use a proxy, collect all required information QString proxy_type_string - = value (global_proxy_type.key, global_proxy_type.def).toString (); + = value (global_proxy_type).toString (); // The proxy type for the Qt proxy settings if (proxy_type_string == "Socks5Proxy") @@ -509,14 +512,14 @@ if (proxy_type_string == "HttpProxy" || proxy_type_string == "Socks5Proxy") { - host = value (global_proxy_host.key, - global_proxy_host.def).toString (); - port = value (global_proxy_port.key, - global_proxy_port.def).toInt (); - user = value (global_proxy_user.key, - global_proxy_user.def).toString (); - pass = value (global_proxy_pass.key, - global_proxy_pass.def).toString (); + host = value (global_proxy_host.settings_key (), + global_proxy_host.def ()).toString (); + port = value (global_proxy_port.settings_key (), + global_proxy_port.def ()).toInt (); + user = value (global_proxy_user.settings_key (), + global_proxy_user.def ()).toString (); + pass = value (global_proxy_pass.settings_key (), + global_proxy_pass.def ()).toString (); if (proxy_type_string == "HttpProxy") scheme = "http"; else if (proxy_type_string == "Socks5Proxy") @@ -621,9 +624,9 @@ // logic be removed completely? bool default_exists = false; bool show_system = false; - if (ed_default_enc.def.toString ().startsWith ("SYSTEM")) + if (ed_default_enc.def ().toString ().startsWith ("SYSTEM")) show_system = true; - else if (QTextCodec::codecForName (ed_default_enc.def.toString ().toLatin1 ())) + else if (QTextCodec::codecForName (ed_default_enc.def ().toString ().toLatin1 ())) default_exists = true; QString default_enc = @@ -637,7 +640,7 @@ if (enc.isEmpty ()) // still empty? { if (default_exists) - enc = ed_default_enc.def.toString (); + enc = ed_default_enc.def ().toString (); else enc = default_enc; } @@ -652,7 +655,7 @@ if (show_system || ! default_exists) combo->insertItem (0, default_enc); else - combo->insertItem (0, ed_default_enc.def.toString ()); + combo->insertItem (0, ed_default_enc.def ().toString ()); // select the default or the current one int idx = combo->findText (enc, Qt::MatchExactly); @@ -691,18 +694,18 @@ // Custom editor if (! custom_editor.isEmpty ()) - setValue (global_custom_editor.key, custom_editor); + setValue (global_custom_editor.settings_key (), custom_editor); // Default monospace font for the terminal if (def_font.count () > 1) { - setValue (cs_font.key, def_font[0]); - setValue (cs_font_size.key, def_font[1].toInt ()); + setValue (cs_font.settings_key (), def_font[0]); + setValue (cs_font_size.settings_key (), def_font[1].toInt ()); } // Write the default monospace font into the settings for later use by // console and editor as fallbacks of their font preferences. - setValue (global_mono_font.key, get_default_font_family ()); + setValue (global_mono_font.settings_key (), get_default_font_family ()); } void gui_settings::check (void)
--- a/libgui/src/gui-settings.h Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/gui-settings.h Tue Jan 03 08:03:20 2023 -0500 @@ -81,10 +81,10 @@ QVariant value (const gui_pref& pref) const { - if (pref.ignore) - return pref.def; // ignore the current pref and always use default + if (pref.ignore ()) + return pref.def (); // ignore the current pref and always use default - return value (pref.key, pref.def); + return value (pref.settings_key (), pref.def ()); } /*!
--- a/libgui/src/history-dock-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/history-dock-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -89,13 +89,13 @@ { gui_settings settings; - settings.setValue (hw_filter_active.key, m_filter_checkbox->isChecked ()); - settings.setValue (hw_filter_shown.key, m_filter_shown); + settings.setValue (hw_filter_active.settings_key (), m_filter_checkbox->isChecked ()); + settings.setValue (hw_filter_shown.settings_key (), m_filter_shown); QStringList mru; for (int i = 0; i < m_filter->count (); i++) mru.append (m_filter->itemText (i)); - settings.setValue (hw_mru_list.key, mru); + settings.setValue (hw_mru_list.settings_key (), mru); settings.sync (); @@ -362,7 +362,7 @@ font.setStyleHint (QFont::TypeWriter); QString default_font = settings.value (global_mono_font).toString (); - font.setFamily (settings.value (cs_font.key, default_font).toString ()); + font.setFamily (settings.value (cs_font.settings_key (), default_font).toString ()); font.setPointSize (settings.value (cs_font_size).toInt ()); m_history_list_view->setFont (font);
--- a/libgui/src/m-editor/file-editor-tab.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue Jan 03 08:03:20 2023 -0500 @@ -269,7 +269,7 @@ gui_settings settings; // encoding, not updated with the settings - m_encoding = settings.value (ed_default_enc.key, "UTF-8").toString (); + m_encoding = settings.value (ed_default_enc.settings_key (), "UTF-8").toString (); m_enc_indicator->setText (m_encoding); // no changes in encoding yet m_new_encoding = m_encoding; @@ -2840,7 +2840,7 @@ // handling is required bool cursor_blinking; - if (settings.contains (global_cursor_blinking.key)) + if (settings.contains (global_cursor_blinking.settings_key ())) cursor_blinking = settings.value (global_cursor_blinking).toBool (); else cursor_blinking = settings.value (cs_cursor_blinking).toBool ();
--- a/libgui/src/m-editor/file-editor.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/m-editor/file-editor.cc Tue Jan 03 08:03:20 2023 -0500 @@ -265,8 +265,8 @@ gui_settings settings; - if (settings.value (global_use_custom_editor.key, - global_use_custom_editor.def).toBool ()) + if (settings.value (global_use_custom_editor.settings_key (), + global_use_custom_editor.def ()).toBool ()) return; // do not open an empty script in the external editor bool real_visible; @@ -472,11 +472,11 @@ } } - settings.setValue (ed_session_names.key, fetFileNames); - settings.setValue (ed_session_enc.key, fet_encodings); - settings.setValue (ed_session_ind.key, fet_index); - settings.setValue (ed_session_lines.key, fet_lines); - settings.setValue (ed_session_bookmarks.key, fet_bookmarks); + settings.setValue (ed_session_names.settings_key (), fetFileNames); + settings.setValue (ed_session_enc.settings_key (), fet_encodings); + settings.setValue (ed_session_ind.settings_key (), fet_index); + settings.setValue (ed_session_lines.settings_key (), fet_lines); + settings.setValue (ed_session_bookmarks.settings_key (), fet_bookmarks); settings.sync (); } @@ -2684,8 +2684,8 @@ gui_settings settings; - settings.setValue (ed_mru_file_list.key, m_mru_files); - settings.setValue (ed_mru_file_encodings.key, m_mru_files_encodings); + settings.setValue (ed_mru_file_list.settings_key (), m_mru_files); + settings.setValue (ed_mru_file_encodings.settings_key (), m_mru_files_encodings); settings.sync (); } @@ -2696,8 +2696,8 @@ gui_settings settings; - if (settings.value (global_use_custom_editor.key, - global_use_custom_editor.def).toBool ()) + if (settings.value (global_use_custom_editor.settings_key (), + global_use_custom_editor.def ()).toBool ()) { // use the external editor interface for handling the call emit request_open_file_external (file_name, line); @@ -2717,7 +2717,7 @@ gui_settings settings; bool old = settings.value (preference).toBool (); - settings.setValue (preference.key, ! old); + settings.setValue (preference.settings_key (), ! old); notice_settings (); }
--- a/libgui/src/m-editor/find-dialog.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/m-editor/find-dialog.cc Tue Jan 03 08:03:20 2023 -0500 @@ -228,7 +228,7 @@ m_last_position = QPoint (dlg_pos.x (), y); - settings.setValue (ed_fdlg_pos.key, m_last_position); + settings.setValue (ed_fdlg_pos.settings_key (), m_last_position); // Is current search/replace text in the mru list? mru_update (m_search_line_edit); @@ -238,12 +238,12 @@ QStringList mru; for (int i = 0; i < m_search_line_edit->count (); i++) mru.append (m_search_line_edit->itemText (i)); - settings.setValue (ed_fdlg_search.key, mru); + settings.setValue (ed_fdlg_search.settings_key (), mru); mru.clear (); for (int i = 0; i < m_replace_line_edit->count (); i++) mru.append (m_replace_line_edit->itemText (i)); - settings.setValue (ed_fdlg_replace.key, mru); + settings.setValue (ed_fdlg_replace.settings_key (), mru); // Store dialog's options int opts = 0 @@ -255,7 +255,7 @@ + m_whole_words_check_box->isChecked () * FIND_DLG_WORDS + m_backward_check_box->isChecked () * FIND_DLG_BACK + m_search_selection_check_box->isChecked () * FIND_DLG_SEL; - settings.setValue (ed_fdlg_opts.key, opts); + settings.setValue (ed_fdlg_opts.settings_key (), opts); settings.sync (); } @@ -265,18 +265,18 @@ gui_settings settings; // Get mru lists for search and replace text - QStringList mru = settings.value (ed_fdlg_search.key).toStringList (); + QStringList mru = settings.value (ed_fdlg_search.settings_key ()).toStringList (); while (mru.length () > m_mru_length) mru.removeLast (); m_search_line_edit->addItems (mru); - mru = settings.value (ed_fdlg_replace.key).toStringList (); + mru = settings.value (ed_fdlg_replace.settings_key ()).toStringList (); while (mru.length () > m_mru_length) mru.removeLast (); m_replace_line_edit->addItems (mru); // Get the dialog's options - int opts = settings.value (ed_fdlg_opts.key, ed_fdlg_opts.def).toInt (); + int opts = settings.value (ed_fdlg_opts).toInt (); m_extension->setVisible (FIND_DLG_MORE & opts); m_case_check_box->setChecked (FIND_DLG_CASE & opts); @@ -293,7 +293,7 @@ QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ()); // Last position from settings - m_last_position = settings.value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint (); + m_last_position = settings.value (ed_fdlg_pos.settings_key (), QPoint (xp, yp)).toPoint (); QRect last_geometry (m_last_position, QSize (sizeHint ().width (), sizeHint ().height ()));
--- a/libgui/src/m-editor/octave-qscintilla.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.cc Tue Jan 03 08:03:20 2023 -0500 @@ -448,13 +448,13 @@ if (comment) { // The commenting string is requested - if (settings.contains (ed_comment_str.key)) + if (settings.contains (ed_comment_str.settings_key ())) // new version (radio buttons) comment_string = settings.value (ed_comment_str).toInt (); else // old version (combo box) - comment_string = settings.value (ed_comment_str_old.key, - ed_comment_str.def).toInt (); + comment_string = settings.value (ed_comment_str_old.settings_key (), + ed_comment_str.def ()).toInt (); return (QStringList (ed_comment_strings.at (comment_string))); } @@ -914,7 +914,7 @@ gui_settings settings; bool show_dbg_file = settings.value (ed_show_dbg_file).toBool (); - settings.setValue (ed_show_dbg_file.key, false); + settings.setValue (ed_show_dbg_file.settings_key (), false); // Let the interpreter execute the tmp file emit interpreter_event @@ -1041,7 +1041,7 @@ gui_settings settings; - settings.setValue (ed_show_dbg_file.key, show_dbg_file); + settings.setValue (ed_show_dbg_file.settings_key (), show_dbg_file); if (tmp_file && tmp_file->exists ()) tmp_file->remove ();
--- a/libgui/src/main-window.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/main-window.cc Tue Jan 03 08:03:20 2023 -0500 @@ -120,7 +120,7 @@ if (welcomeWizard.exec () == QDialog::Rejected) exit (1); - settings.setValue (global_skip_welcome_wizard.key, QVariant (true)); + settings.setValue (global_skip_welcome_wizard.settings_key (), QVariant (true)); // Install settings file. settings.reload (); @@ -499,8 +499,8 @@ gui_settings settings; - if (settings.value (global_prompt_to_exit.key, - global_prompt_to_exit.def).toBool ()) + if (settings.value (global_prompt_to_exit.settings_key (), + global_prompt_to_exit.def ()).toBool ()) { int ans = QMessageBox::question (this, tr ("Octave"), tr ("Are you sure you want to exit Octave?"), @@ -898,7 +898,7 @@ // the desired one is not found QString preferred_style = settings.value (global_style).toString (); - if (preferred_style == global_style.def.toString ()) + if (preferred_style == global_style.def ().toString ()) preferred_style = m_default_style; QApplication* qapp = m_octave_qobj.qapplication(); @@ -986,7 +986,7 @@ // getting the cursor blink preferences from all OS environments bool cursor_blinking; - if (settings.contains (global_cursor_blinking.key)) + if (settings.contains (global_cursor_blinking.settings_key ())) cursor_blinking = settings.value (global_cursor_blinking).toBool (); else cursor_blinking = settings.value (cs_cursor_blinking).toBool (); @@ -1326,8 +1326,8 @@ gui_settings settings; bool is_internal = m_editor_window - && ! settings.value (global_use_custom_editor.key, - global_use_custom_editor.def).toBool (); + && ! settings.value (global_use_custom_editor.settings_key (), + global_use_custom_editor.def ()).toBool (); // Create a NonModal message. QWidget *p = this; @@ -1370,8 +1370,8 @@ gui_settings settings; - if (! p || settings.value (global_use_custom_editor.key, - global_use_custom_editor.def).toBool ()) + if (! p || settings.value (global_use_custom_editor.settings_key (), + global_use_custom_editor.def ()).toBool ()) p = this; QString new_name = QInputDialog::getText (p, tr ("New Function"), tr ("New function name:\n"), QLineEdit::Normal, "", &ok); @@ -1385,7 +1385,7 @@ if (! settings.value (ed_create_new_file).toBool ()) { // no, so enable this settings and wait for end of new file loading - settings.setValue (ed_create_new_file.key, true); + settings.setValue (ed_create_new_file.settings_key (), true); connect (m_editor_window, SIGNAL (file_loaded_signal (void)), this, SLOT (restore_create_file_setting (void))); } @@ -1613,9 +1613,9 @@ bool visible = true; floating = settings.value - (dw_is_floating.key.arg (name), dw_is_floating.def).toBool (); + (dw_is_floating.settings_key ().arg (name), dw_is_floating.def ()).toBool (); visible = settings.value - (dw_is_visible.key.arg (name), dw_is_visible.def).toBool (); + (dw_is_visible.settings_key ().arg (name), dw_is_visible.def ()).toBool (); // If floating, make window from widget. if (floating) @@ -1624,8 +1624,8 @@ if (visible) { - if (settings.value (dw_is_minimized.key.arg (name), - dw_is_minimized.def).toBool ()) + if (settings.value (dw_is_minimized.settings_key ().arg (name), + dw_is_minimized.def ()).toBool ()) widget->showMinimized (); else widget->setVisible (true); @@ -1651,15 +1651,15 @@ { gui_settings settings; - settings.setValue (mw_geometry.key, saveGeometry ()); - settings.setValue (mw_state.key, saveState ()); + settings.setValue (mw_geometry.settings_key (), saveGeometry ()); + settings.setValue (mw_state.settings_key (), saveState ()); // write the list of recently used directories QStringList curr_dirs; for (int i=0; i<m_current_directory_combo_box->count (); i++) { curr_dirs.append (m_current_directory_combo_box->itemText (i)); } - settings.setValue (mw_dir_list.key, curr_dirs); + settings.setValue (mw_dir_list.settings_key (), curr_dirs); settings.sync (); } @@ -1903,7 +1903,7 @@ gui_settings settings; - settings.setValue (ed_create_new_file.key, false); + settings.setValue (ed_create_new_file.settings_key (), false); disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)), this, SLOT (restore_create_file_setting (void))); } @@ -2882,8 +2882,8 @@ { gui_settings settings; - settings.setValue (mw_geometry.key, saveGeometry ()); - settings.setValue (mw_state.key, saveState ()); + settings.setValue (mw_geometry.settings_key (), saveGeometry ()); + settings.setValue (mw_state.settings_key (), saveState ()); } focus_command_window ();
--- a/libgui/src/module.mk Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/module.mk Tue Jan 03 08:03:20 2023 -0500 @@ -410,7 +410,22 @@ %reldir%/external-editor-interface.cc \ %reldir%/files-dock-widget.cc \ %reldir%/graphics-init.cc \ + %reldir%/gui-preferences-cs.cc \ + %reldir%/gui-preferences-dc.cc \ + %reldir%/gui-preferences-dw.cc \ + %reldir%/gui-preferences-ed.cc \ + %reldir%/gui-preferences-fb.cc \ + %reldir%/gui-preferences-ff.cc \ + %reldir%/gui-preferences-global.cc \ + %reldir%/gui-preferences-gp.cc \ + %reldir%/gui-preferences-hw.cc \ + %reldir%/gui-preferences-mw.cc \ + %reldir%/gui-preferences-nr.cc \ + %reldir%/gui-preferences-pd.cc \ %reldir%/gui-preferences-sc.cc \ + %reldir%/gui-preferences-sd.cc \ + %reldir%/gui-preferences-ve.cc \ + %reldir%/gui-preferences-ws.cc \ %reldir%/gui-preferences.cc \ %reldir%/gui-settings.cc \ %reldir%/history-dock-widget.cc \
--- a/libgui/src/news-reader.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/news-reader.cc Tue Jan 03 08:03:20 2023 -0500 @@ -70,7 +70,7 @@ { gui_settings settings; - settings.setValue (nr_last_time.key, + settings.setValue (nr_last_time.settings_key (), QDateTime::currentDateTime ()); settings.sync (); @@ -91,7 +91,7 @@ if (curr_page_serial > m_serial) { - settings.setValue (nr_last_news.key, curr_page_serial); + settings.setValue (nr_last_news.settings_key (), curr_page_serial); settings.sync (); } else
--- a/libgui/src/octave-dock-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/octave-dock-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -349,7 +349,7 @@ if (m_main_window) { - settings.setValue (mw_state.key, m_main_window->saveState ()); + settings.setValue (mw_state.settings_key (), m_main_window->saveState ()); // Stay window, otherwise will bounce back to window by default // because there is no layout information for this widget in the @@ -358,7 +358,7 @@ m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this); m_adopted = false; // recover old window states, hide and re-show new added widget - m_main_window->restoreState (settings.value (mw_state.key).toByteArray ()); + m_main_window->restoreState (settings.value (mw_state.settings_key ()).toByteArray ()); setFloating (false); // restore size using setGeometry instead of restoreGeometry // following this post: @@ -479,7 +479,7 @@ m_custom_style = settings.value (dw_title_custom_style).toBool (); - m_title_3d = settings.value (dw_title_3d.key, dw_title_3d.def).toInt (); + m_title_3d = settings.value (dw_title_3d).toInt (); m_fg_color = settings.value (dw_title_fg_color).value<QColor> (); @@ -532,7 +532,7 @@ } m_recent_float_geom - = settings.value (dw_float_geometry.key.arg (objectName ()), + = settings.value (dw_float_geometry.settings_key ().arg (objectName ()), default_floating_size).toRect (); adjust_to_screen (m_recent_float_geom, default_floating_size); @@ -541,12 +541,12 @@ // saveGeomety to new QRect setting (see comment for restoring size // of docked widgets) QVariant dock_geom - = settings.value (dw_dock_geometry.key.arg (objectName ()), + = settings.value (dw_dock_geometry.settings_key ().arg (objectName ()), default_dock_size); if (dock_geom.canConvert (QMetaType::QRect)) m_recent_dock_geom = dock_geom.toRect (); else - m_recent_dock_geom = dw_dock_geometry.def.toRect (); + m_recent_dock_geom = dw_dock_geometry.def ().toRect (); notice_settings (); // call individual handler @@ -592,13 +592,13 @@ // conditional needed? if (! m_recent_float_geom.isNull ()) - settings.setValue (dw_float_geometry.key.arg (name), m_recent_float_geom); + settings.setValue (dw_float_geometry.settings_key ().arg (name), m_recent_float_geom); if (! m_recent_dock_geom.isEmpty ()) - settings.setValue (dw_dock_geometry.key.arg (name), m_recent_dock_geom); - settings.setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility - settings.setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating - settings.setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized + settings.setValue (dw_dock_geometry.settings_key ().arg (name), m_recent_dock_geom); + settings.setValue (dw_is_visible.settings_key ().arg (name), isVisible ()); // store visibility + settings.setValue (dw_is_floating.settings_key ().arg (name), isFloating ()); // store floating + settings.setValue (dw_is_minimized.settings_key ().arg (name), isMinimized ()); // store minimized settings.sync (); }
--- a/libgui/src/qt-interpreter-events.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/qt-interpreter-events.cc Tue Jan 03 08:03:20 2023 -0500 @@ -719,7 +719,7 @@ // Not all encodings are available. Encodings are uppercase and do // not use CPxxx but IBMxxx or WINDOWS-xxx. - if (key == ed_default_enc.key) + if (key == ed_default_enc.settings_key ()) { adjusted_value = adjusted_value.toUpper ();
--- a/libgui/src/set-path-dialog.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/set-path-dialog.cc Tue Jan 03 08:03:20 2023 -0500 @@ -170,7 +170,7 @@ gui_settings settings; - restoreGeometry (settings.value(pd_geometry.key).toByteArray()); + restoreGeometry (settings.value(pd_geometry.settings_key ()).toByteArray()); } void set_path_dialog::update_model (void) @@ -300,7 +300,7 @@ { gui_settings settings; - settings.setValue (pd_geometry.key, saveGeometry ()); + settings.setValue (pd_geometry.settings_key (), saveGeometry ()); } void set_path_dialog::closeEvent (QCloseEvent *e)
--- a/libgui/src/settings-dialog.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/settings-dialog.cc Tue Jan 03 08:03:20 2023 -0500 @@ -92,9 +92,9 @@ // System at beginning comboBox_language->insertItem (0, tr ("System setting")); comboBox_language->insertSeparator (1); // separator after System - QString language = settings.value (global_language.key, - global_language.def).toString (); - if (language == global_language.def.toString ()) + QString language = settings.value (global_language.settings_key (), + global_language.def ()).toString (); + if (language == global_language.def ().toString ()) language = tr ("System setting"); int selected = comboBox_language->findText (language); if (selected >= 0) @@ -106,11 +106,11 @@ QStringList styles = QStyleFactory::keys(); styles.append (global_extra_styles); combo_styles->addItems (styles); - combo_styles->insertItem (0, global_style.def.toString ()); + combo_styles->insertItem (0, global_style.def ().toString ()); combo_styles->insertSeparator (1); QString current_style = settings.value (global_style).toString (); - if (current_style == global_style.def.toString ()) - current_style = global_style.def.toString (); + if (current_style == global_style.def ().toString ()) + current_style = global_style.def ().toString (); selected = combo_styles->findText (current_style); if (selected >= 0) combo_styles->setCurrentIndex (selected); @@ -127,7 +127,7 @@ icon_size_small->setChecked (icon_size < 0); icon_size_large->setChecked (icon_size > 0); combo_box_icon_theme->addItems (global_all_icon_theme_names); - int theme = settings.value (global_icon_theme_index.key).toInt (); + int theme = settings.value (global_icon_theme_index.settings_key ()).toInt (); combo_box_icon_theme->setCurrentIndex (theme); // which icon has to be selected @@ -175,8 +175,8 @@ connect (cb_widget_custom_style, &QCheckBox::toggled, m_widget_title_fg_color_active, &color_picker::setEnabled); - sb_3d_title->setValue (settings.value (dw_title_3d.key, - dw_title_3d.def).toInt ()); + sb_3d_title->setValue (settings.value (dw_title_3d.settings_key (), + dw_title_3d.def ()).toInt ()); cb_widget_custom_style->setChecked (settings.value (dw_title_custom_style).toBool ()); // Native file dialogs. @@ -188,17 +188,17 @@ // Cursor blinking: consider old terminal related setting if not yet set // FIXME: This pref. can be deprecated / removed if Qt adds support for // getting the cursor blink preferences from all OS environments - if (settings.contains (global_cursor_blinking.key)) + if (settings.contains (global_cursor_blinking.settings_key ())) { // Preference exists, read its value cb_cursor_blinking->setChecked (settings.value - (global_cursor_blinking.key, global_cursor_blinking.def).toBool ()); + (global_cursor_blinking.settings_key (), global_cursor_blinking.def ()).toBool ()); } else { // Pref. does not exist, so take old terminal related pref. cb_cursor_blinking->setChecked (settings.value - (cs_cursor_blinking.key, cs_cursor_blinking.def).toBool ()); + (cs_cursor_blinking.settings_key (), cs_cursor_blinking.def ()).toBool ()); } // focus follows mouse @@ -207,17 +207,17 @@ // prompt on exit cb_prompt_to_exit->setChecked ( - settings.value (global_prompt_to_exit.key, global_prompt_to_exit.def).toBool ()); + settings.value (global_prompt_to_exit).toBool ()); // Main status bar cb_status_bar->setChecked ( - settings.value (global_status_bar.key, global_status_bar.def).toBool ()); + settings.value (global_status_bar).toBool ()); // Octave startup cb_restore_octave_dir->setChecked ( - settings.value (global_restore_ov_dir.key, global_restore_ov_dir.def).toBool ()); - le_octave_dir->setText (settings.value (global_ov_startup_dir.key, - global_ov_startup_dir.def).toString ()); + settings.value (global_restore_ov_dir).toBool ()); + le_octave_dir->setText (settings.value (global_ov_startup_dir.settings_key (), + global_ov_startup_dir.def ()).toString ()); connect (pb_octave_dir, &QPushButton::pressed, this, &settings_dialog::get_octave_dir); @@ -226,9 +226,9 @@ // editor // useCustomFileEditor->setChecked ( - settings.value (global_use_custom_editor.key, global_use_custom_editor.def).toBool ()); + settings.value (global_use_custom_editor).toBool ()); customFileEditor->setText ( - settings.value (global_custom_editor.key, global_custom_editor.def).toString ()); + settings.value (global_custom_editor).toString ()); editor_showLineNumbers->setChecked (settings.value (ed_show_line_numbers).toBool ()); editor_linenr_size->setValue (settings.value (ed_line_numbers_size).toInt ()); @@ -280,10 +280,10 @@ int selected_comment_string, selected_uncomment_string; - if (settings.contains (ed_comment_str.key)) // new version (radio buttons) + if (settings.contains (ed_comment_str.settings_key ())) // new version (radio buttons) selected_comment_string = settings.value (ed_comment_str).toInt (); else // old version (combo box) - selected_comment_string = settings.value (ed_comment_str_old.key, ed_comment_str.def).toInt (); + selected_comment_string = settings.value (ed_comment_str_old.settings_key (), ed_comment_str.def ()).toInt (); selected_uncomment_string = settings.value (ed_uncomment_str).toInt (); @@ -325,7 +325,7 @@ // terminal QString default_font = settings.value (global_mono_font).toString (); - terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.key, default_font).toString ())); + terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.settings_key (), default_font).toString ())); terminal_fontSize->setValue (settings.value (cs_font_size).toInt ()); terminal_history_buffer->setValue (settings.value (cs_hist_buffer).toInt ()); terminal_cursorUseForegroundColor->setChecked (settings.value (cs_cursor_use_fgcol).toBool ()); @@ -359,7 +359,7 @@ sync_octave_directory->setChecked (settings.value (fb_sync_octdir).toBool ()); cb_restore_file_browser_dir->setChecked (settings.value (fb_restore_last_dir).toBool ()); - le_file_browser_dir->setText (settings.value (fb_startup_dir.key).toString ()); + le_file_browser_dir->setText (settings.value (fb_startup_dir.settings_key ()).toString ()); connect (pb_file_browser_dir, &QPushButton::pressed, this, &settings_dialog::get_file_browser_dir); @@ -369,10 +369,10 @@ checkbox_allow_web_connect->setChecked (settings.value (nr_allow_connection).toBool ()); // Proxy - bool use_proxy = settings.value (global_use_proxy.key, global_use_proxy.def).toBool (); + bool use_proxy = settings.value (global_use_proxy).toBool (); use_proxy_server->setChecked (use_proxy); // Fill combo box and activate current one - QString proxy_type_string = settings.value (global_proxy_type.key, global_proxy_type.def).toString (); + QString proxy_type_string = settings.value (global_proxy_type).toString (); proxy_type->addItems (global_proxy_all_types); for (int i = 0; i < global_proxy_all_types.length (); i++) { @@ -383,10 +383,10 @@ } } // Fill all line edits - proxy_host_name->setText (settings.value (global_proxy_host.key, global_proxy_host.def).toString ()); - proxy_port->setText (settings.value (global_proxy_port.key, global_proxy_port.def).toString ()); - proxy_username->setText (settings.value (global_proxy_user.key, global_proxy_user.def).toString ()); - proxy_password->setText (settings.value (global_proxy_pass.key, global_proxy_pass.def).toString ()); + proxy_host_name->setText (settings.value (global_proxy_host).toString ()); + proxy_port->setText (settings.value (global_proxy_port).toString ()); + proxy_username->setText (settings.value (global_proxy_user).toString ()); + proxy_password->setText (settings.value (global_proxy_pass).toString ()); // Connect relevant signals for dis-/enabling some elements connect (proxy_type, QOverload<int>::of (&QComboBox::currentIndexChanged), this, &settings_dialog::proxy_items_update); @@ -402,8 +402,8 @@ varedit_columnWidth->setValue (settings.value (ve_column_width).toInt ()); varedit_rowHeight->setValue (settings.value (ve_row_height).toInt ()); - varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.key, - settings.value (cs_font.key, default_font)).toString ())); + varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.settings_key (), + settings.value (cs_font.settings_key (), default_font)).toString ())); varedit_fontSize->setValue (settings.value (ve_font_size).toInt ()); connect (varedit_useTerminalFont, &QCheckBox::toggled, varedit_font, &QFontComboBox::setDisabled); @@ -421,11 +421,11 @@ // shortcuts cb_prevent_readline_conflicts->setChecked ( - settings.value (sc_prevent_rl_conflicts.key, - sc_prevent_rl_conflicts.def).toBool ()); + settings.value (sc_prevent_rl_conflicts.settings_key (), + sc_prevent_rl_conflicts.def ()).toBool ()); cb_prevent_readline_conflicts_menu->setChecked ( - settings.value (sc_prevent_rl_conflicts_menu.key, - sc_prevent_rl_conflicts_menu.def).toBool ()); + settings.value (sc_prevent_rl_conflicts_menu.settings_key (), + sc_prevent_rl_conflicts_menu.def ()).toBool ()); // connect the buttons for import/export of the shortcut sets // FIXME: Should there also be a button to discard changes? @@ -447,16 +447,16 @@ group_box_editor_styles); cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ())); cb_color_mode->setChecked (mode > 0); - cb_color_mode->setObjectName (ed_color_mode.key); + cb_color_mode->setObjectName (ed_color_mode.settings_key ()); QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_styles.toStdString ().data ())); pb_reload_default_colors->setToolTip (tr (settings_reload_styles_tooltip.toStdString ().data ())); color_picker *current_line_color = new color_picker ( - settings.value (ed_highlight_current_line_color.key + + settings.value (ed_highlight_current_line_color.settings_key () + settings_color_modes_ext[mode], - ed_highlight_current_line_color.def).value<QColor> (), this); - current_line_color->setObjectName (ed_highlight_current_line_color.key); + ed_highlight_current_line_color.def ()).value<QColor> (), this); + current_line_color->setObjectName (ed_highlight_current_line_color.settings_key ()); QLabel *current_line_color_label = new QLabel( tr ("Color of highlighted current line (magenta (255,0,255) for automatic color)") ); @@ -493,7 +493,7 @@ this, &settings_dialog::button_clicked); // restore last geometry - if (settings.contains (sd_geometry.key)) + if (settings.contains (sd_geometry.settings_key ())) restoreGeometry (settings.value (sd_geometry).toByteArray ()); else setGeometry (QRect (10, 50, 1000, 600)); @@ -560,8 +560,8 @@ gui_settings settings; - settings.setValue (sd_last_tab.key, tabWidget->currentIndex ()); - settings.setValue (sd_geometry.key, saveGeometry ()); + settings.setValue (sd_last_tab.settings_key (), tabWidget->currentIndex ()); + settings.setValue (sd_geometry.settings_key (), saveGeometry ()); settings.sync (); close (); @@ -671,13 +671,13 @@ #if defined (HAVE_QSCINTILLA) QCheckBox *cb_color_mode - = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.key); + = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ()); int m = 0; if (cb_color_mode && cb_color_mode->isChecked ()) m = 1; - color_picker *c_picker = findChild <color_picker *> (ed_highlight_current_line_color.key); + color_picker *c_picker = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ()); if (c_picker) { gui_settings settings; @@ -690,7 +690,7 @@ else { // Get the default value - c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def, m)); + c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def (), m)); } } @@ -945,12 +945,12 @@ gui_settings settings; QCheckBox *cb_color_mode - = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.key); + = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ()); int mode = 0; if (cb_color_mode && cb_color_mode->isChecked ()) mode = 1; - settings.setValue (ed_color_mode.key, mode); + settings.setValue (ed_color_mode.settings_key (), mode); QWidget *tab = tabs_editor_lexers-> findChild <QWidget *> (QString (lexer->language ()) + "_styles"); @@ -966,9 +966,9 @@ color_picker *bg_color; int default_size = 10; - color = findChild <color_picker *> (ed_highlight_current_line_color.key); + color = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ()); if (color) - settings.setValue (ed_highlight_current_line_color.key + settings.setValue (ed_highlight_current_line_color.settings_key () + settings_color_modes_ext[mode], color->color ()); QString default_font_name @@ -1039,7 +1039,7 @@ lexer->writeSettings (settings, group.c_str ()); - settings.setValue (sd_last_editor_styles_tab.key, + settings.setValue (sd_last_editor_styles_tab.settings_key (), tabs_editor_lexers->currentIndex ()); settings.sync (); } @@ -1056,87 +1056,87 @@ widget_icon_set = "LETTER"; else if (general_icon_graphic->isChecked ()) widget_icon_set = "GRAPHIC"; - settings.setValue (dw_icon_set.key, widget_icon_set); + settings.setValue (dw_icon_set.settings_key (), widget_icon_set); // language QString language = comboBox_language->currentText (); if (language == tr ("System setting")) - language = global_language.def.toString (); - settings.setValue (global_language.key, language); + language = global_language.def ().toString (); + settings.setValue (global_language.settings_key (), language); // style QString selected_style = combo_styles->currentText (); - if (selected_style == global_style.def.toString ()) - selected_style = global_style.def.toString (); - settings.setValue (global_style.key, selected_style); + if (selected_style == global_style.def ().toString ()) + selected_style = global_style.def ().toString (); + settings.setValue (global_style.settings_key (), selected_style); // dock widget title bar - settings.setValue (dw_title_custom_style.key, cb_widget_custom_style->isChecked ()); - settings.setValue (dw_title_3d.key, sb_3d_title->value ()); - settings.setValue (dw_title_bg_color.key, m_widget_title_bg_color->color ()); - settings.setValue (dw_title_bg_color_active.key, m_widget_title_bg_color_active->color ()); - settings.setValue (dw_title_fg_color.key, m_widget_title_fg_color->color ()); - settings.setValue (dw_title_fg_color_active.key, m_widget_title_fg_color_active->color ()); + settings.setValue (dw_title_custom_style.settings_key (), cb_widget_custom_style->isChecked ()); + settings.setValue (dw_title_3d.settings_key (), sb_3d_title->value ()); + settings.setValue (dw_title_bg_color.settings_key (), m_widget_title_bg_color->color ()); + settings.setValue (dw_title_bg_color_active.settings_key (), m_widget_title_bg_color_active->color ()); + settings.setValue (dw_title_fg_color.settings_key (), m_widget_title_fg_color->color ()); + settings.setValue (dw_title_fg_color_active.settings_key (), m_widget_title_fg_color_active->color ()); // icon size and theme int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked (); - settings.setValue (global_icon_size.key, icon_size); - settings.setValue (global_icon_theme_index.key, combo_box_icon_theme->currentIndex ()); + settings.setValue (global_icon_size.settings_key (), icon_size); + settings.setValue (global_icon_theme_index.settings_key (), combo_box_icon_theme->currentIndex ()); // native file dialogs - settings.setValue (global_use_native_dialogs.key, cb_use_native_file_dialogs->isChecked ()); + settings.setValue (global_use_native_dialogs.settings_key (), cb_use_native_file_dialogs->isChecked ()); // cursor blinking - settings.setValue (global_cursor_blinking.key, cb_cursor_blinking->isChecked ()); + settings.setValue (global_cursor_blinking.settings_key (), cb_cursor_blinking->isChecked ()); // focus follows mouse - settings.setValue (dw_focus_follows_mouse.key, cb_focus_follows_mouse->isChecked ()); + settings.setValue (dw_focus_follows_mouse.settings_key (), cb_focus_follows_mouse->isChecked ()); // promp to exit - settings.setValue (global_prompt_to_exit.key, cb_prompt_to_exit->isChecked ()); + settings.setValue (global_prompt_to_exit.settings_key (), cb_prompt_to_exit->isChecked ()); // status bar - settings.setValue (global_status_bar.key, cb_status_bar->isChecked ()); + settings.setValue (global_status_bar.settings_key (), cb_status_bar->isChecked ()); // Octave startup - settings.setValue (global_restore_ov_dir.key, cb_restore_octave_dir->isChecked ()); - settings.setValue (global_ov_startup_dir.key, le_octave_dir->text ()); + settings.setValue (global_restore_ov_dir.settings_key (), cb_restore_octave_dir->isChecked ()); + settings.setValue (global_ov_startup_dir.settings_key (), le_octave_dir->text ()); //editor - settings.setValue (global_use_custom_editor.key, useCustomFileEditor->isChecked ()); - settings.setValue (global_custom_editor.key, customFileEditor->text ()); - settings.setValue (ed_show_line_numbers.key, editor_showLineNumbers->isChecked ()); - settings.setValue (ed_line_numbers_size.key, editor_linenr_size->value ()); - settings.setValue (ed_highlight_current_line.key, editor_highlightCurrentLine->isChecked ()); - settings.setValue (ed_long_line_marker.key, editor_long_line_marker->isChecked ()); - settings.setValue (ed_long_line_marker_line.key, editor_long_line_marker_line->isChecked ()); - settings.setValue (ed_long_line_marker_background.key, editor_long_line_marker_background->isChecked ()); - settings.setValue (ed_long_line_column.key, editor_long_line_column->value ()); - settings.setValue (ed_break_lines.key, editor_break_checkbox->isChecked ()); - settings.setValue (ed_break_lines_comments.key, editor_break_comments_checkbox->isChecked ()); - settings.setValue (ed_wrap_lines.key, editor_wrap_checkbox->isChecked ()); - settings.setValue (ed_code_folding.key, cb_code_folding->isChecked ()); - settings.setValue (ed_show_edit_status_bar.key, cb_edit_status_bar->isChecked ()); - settings.setValue (ed_show_toolbar.key, cb_edit_tool_bar->isChecked ()); - settings.setValue (ed_highlight_all_occurrences.key, editor_highlight_all_occurrences->isChecked ()); - settings.setValue (ed_code_completion.key, editor_codeCompletion->isChecked ()); - settings.setValue (ed_code_completion_threshold.key, editor_spinbox_ac_threshold->value ()); - settings.setValue (ed_code_completion_keywords.key, editor_checkbox_ac_keywords->isChecked ()); - settings.setValue (ed_code_completion_octave_builtins.key, editor_checkbox_ac_builtins->isChecked ()); - settings.setValue (ed_code_completion_octave_functions.key, editor_checkbox_ac_functions->isChecked ()); - settings.setValue (ed_code_completion_document.key, editor_checkbox_ac_document->isChecked ()); - settings.setValue (ed_code_completion_case.key, editor_checkbox_ac_case->isChecked ()); - settings.setValue (ed_code_completion_replace.key, editor_checkbox_ac_replace->isChecked ()); - settings.setValue (ed_auto_endif.key, editor_auto_endif->currentIndex ()); - settings.setValue (ed_show_white_space.key, editor_ws_checkbox->isChecked ()); - settings.setValue (ed_show_white_space_indent.key, editor_ws_indent_checkbox->isChecked ()); - settings.setValue (ed_show_eol_chars.key, cb_show_eol->isChecked ()); - settings.setValue (ed_show_hscroll_bar.key, cb_show_hscrollbar->isChecked ()); - settings.setValue (ed_default_eol_mode.key, combo_eol_mode->currentIndex ()); + settings.setValue (global_use_custom_editor.settings_key (), useCustomFileEditor->isChecked ()); + settings.setValue (global_custom_editor.settings_key (), customFileEditor->text ()); + settings.setValue (ed_show_line_numbers.settings_key (), editor_showLineNumbers->isChecked ()); + settings.setValue (ed_line_numbers_size.settings_key (), editor_linenr_size->value ()); + settings.setValue (ed_highlight_current_line.settings_key (), editor_highlightCurrentLine->isChecked ()); + settings.setValue (ed_long_line_marker.settings_key (), editor_long_line_marker->isChecked ()); + settings.setValue (ed_long_line_marker_line.settings_key (), editor_long_line_marker_line->isChecked ()); + settings.setValue (ed_long_line_marker_background.settings_key (), editor_long_line_marker_background->isChecked ()); + settings.setValue (ed_long_line_column.settings_key (), editor_long_line_column->value ()); + settings.setValue (ed_break_lines.settings_key (), editor_break_checkbox->isChecked ()); + settings.setValue (ed_break_lines_comments.settings_key (), editor_break_comments_checkbox->isChecked ()); + settings.setValue (ed_wrap_lines.settings_key (), editor_wrap_checkbox->isChecked ()); + settings.setValue (ed_code_folding.settings_key (), cb_code_folding->isChecked ()); + settings.setValue (ed_show_edit_status_bar.settings_key (), cb_edit_status_bar->isChecked ()); + settings.setValue (ed_show_toolbar.settings_key (), cb_edit_tool_bar->isChecked ()); + settings.setValue (ed_highlight_all_occurrences.settings_key (), editor_highlight_all_occurrences->isChecked ()); + settings.setValue (ed_code_completion.settings_key (), editor_codeCompletion->isChecked ()); + settings.setValue (ed_code_completion_threshold.settings_key (), editor_spinbox_ac_threshold->value ()); + settings.setValue (ed_code_completion_keywords.settings_key (), editor_checkbox_ac_keywords->isChecked ()); + settings.setValue (ed_code_completion_octave_builtins.settings_key (), editor_checkbox_ac_builtins->isChecked ()); + settings.setValue (ed_code_completion_octave_functions.settings_key (), editor_checkbox_ac_functions->isChecked ()); + settings.setValue (ed_code_completion_document.settings_key (), editor_checkbox_ac_document->isChecked ()); + settings.setValue (ed_code_completion_case.settings_key (), editor_checkbox_ac_case->isChecked ()); + settings.setValue (ed_code_completion_replace.settings_key (), editor_checkbox_ac_replace->isChecked ()); + settings.setValue (ed_auto_endif.settings_key (), editor_auto_endif->currentIndex ()); + settings.setValue (ed_show_white_space.settings_key (), editor_ws_checkbox->isChecked ()); + settings.setValue (ed_show_white_space_indent.settings_key (), editor_ws_indent_checkbox->isChecked ()); + settings.setValue (ed_show_eol_chars.settings_key (), cb_show_eol->isChecked ()); + settings.setValue (ed_show_hscroll_bar.settings_key (), cb_show_hscrollbar->isChecked ()); + settings.setValue (ed_default_eol_mode.settings_key (), combo_eol_mode->currentIndex ()); - settings.setValue (ed_tab_position.key, editor_combox_tab_pos->currentIndex ()); - settings.setValue (ed_tabs_rotated.key, editor_cb_tabs_rotated->isChecked ()); - settings.setValue (ed_tabs_max_width.key, editor_sb_tabs_max_width->value ()); + settings.setValue (ed_tab_position.settings_key (), editor_combox_tab_pos->currentIndex ()); + settings.setValue (ed_tabs_rotated.settings_key (), editor_cb_tabs_rotated->isChecked ()); + settings.setValue (ed_tabs_max_width.settings_key (), editor_sb_tabs_max_width->value ()); // Comment strings int rb_uncomment = 0; @@ -1144,55 +1144,55 @@ { if (m_rb_comment_strings[i]->isChecked ()) { - settings.setValue (ed_comment_str.key, i); + settings.setValue (ed_comment_str.settings_key (), i); if (i < 3) - settings.setValue (ed_comment_str_old.key, i); + settings.setValue (ed_comment_str_old.settings_key (), i); else - settings.setValue (ed_comment_str_old.key, ed_comment_str.def); + settings.setValue (ed_comment_str_old.settings_key (), ed_comment_str.def ()); } if (m_rb_uncomment_strings[i]->isChecked ()) rb_uncomment = rb_uncomment + (1 << i); } - settings.setValue (ed_uncomment_str.key, rb_uncomment); + settings.setValue (ed_uncomment_str.settings_key (), rb_uncomment); - settings.setValue (ed_default_enc.key, editor_combo_encoding->currentText ()); - settings.setValue (ed_auto_indent.key, editor_auto_ind_checkbox->isChecked ()); - settings.setValue (ed_tab_indents_line.key, editor_tab_ind_checkbox->isChecked ()); - settings.setValue (ed_backspace_unindents_line.key, editor_bs_unind_checkbox->isChecked ()); - settings.setValue (ed_show_indent_guides.key, editor_ind_guides_checkbox->isChecked ()); - settings.setValue (ed_indent_width.key, editor_ind_width_spinbox->value ()); - settings.setValue (ed_indent_uses_tabs.key, editor_ind_uses_tabs_checkbox->isChecked ()); - settings.setValue (ed_tab_width.key, editor_tab_width_spinbox->value ()); - settings.setValue (ed_restore_session.key, editor_restoreSession->isChecked ()); - settings.setValue (ed_create_new_file.key, editor_create_new_file->isChecked ()); - settings.setValue (ed_hiding_closes_files.key, editor_hiding_closes_files->isChecked ()); - settings.setValue (ed_always_reload_changed_files.key, editor_reload_changed_files->isChecked ()); - settings.setValue (ed_force_newline.key, editor_force_newline->isChecked ()); - settings.setValue (ed_rm_trailing_spaces.key, editor_remove_trailing_spaces->isChecked ()); - settings.setValue (ed_show_dbg_file.key, editor_show_dbg_file->isChecked ()); + settings.setValue (ed_default_enc.settings_key (), editor_combo_encoding->currentText ()); + settings.setValue (ed_auto_indent.settings_key (), editor_auto_ind_checkbox->isChecked ()); + settings.setValue (ed_tab_indents_line.settings_key (), editor_tab_ind_checkbox->isChecked ()); + settings.setValue (ed_backspace_unindents_line.settings_key (), editor_bs_unind_checkbox->isChecked ()); + settings.setValue (ed_show_indent_guides.settings_key (), editor_ind_guides_checkbox->isChecked ()); + settings.setValue (ed_indent_width.settings_key (), editor_ind_width_spinbox->value ()); + settings.setValue (ed_indent_uses_tabs.settings_key (), editor_ind_uses_tabs_checkbox->isChecked ()); + settings.setValue (ed_tab_width.settings_key (), editor_tab_width_spinbox->value ()); + settings.setValue (ed_restore_session.settings_key (), editor_restoreSession->isChecked ()); + settings.setValue (ed_create_new_file.settings_key (), editor_create_new_file->isChecked ()); + settings.setValue (ed_hiding_closes_files.settings_key (), editor_hiding_closes_files->isChecked ()); + settings.setValue (ed_always_reload_changed_files.settings_key (), editor_reload_changed_files->isChecked ()); + settings.setValue (ed_force_newline.settings_key (), editor_force_newline->isChecked ()); + settings.setValue (ed_rm_trailing_spaces.settings_key (), editor_remove_trailing_spaces->isChecked ()); + settings.setValue (ed_show_dbg_file.settings_key (), editor_show_dbg_file->isChecked ()); // file browser - settings.setValue (fb_sync_octdir.key, sync_octave_directory->isChecked ()); - settings.setValue (fb_restore_last_dir.key, cb_restore_file_browser_dir->isChecked ()); - settings.setValue (fb_startup_dir.key, le_file_browser_dir->text ()); - settings.setValue (fb_txt_file_ext.key, le_file_browser_extensions->text ()); + settings.setValue (fb_sync_octdir.settings_key (), sync_octave_directory->isChecked ()); + settings.setValue (fb_restore_last_dir.settings_key (), cb_restore_file_browser_dir->isChecked ()); + settings.setValue (fb_startup_dir.settings_key (), le_file_browser_dir->text ()); + settings.setValue (fb_txt_file_ext.settings_key (), le_file_browser_extensions->text ()); // network - settings.setValue (nr_allow_connection.key, checkbox_allow_web_connect->isChecked ()); - settings.setValue (global_use_proxy.key, use_proxy_server->isChecked ()); - settings.setValue (global_proxy_type.key, proxy_type->currentText ()); - settings.setValue (global_proxy_host.key, proxy_host_name->text ()); - settings.setValue (global_proxy_port.key, proxy_port->text ()); - settings.setValue (global_proxy_user.key, proxy_username->text ()); - settings.setValue (global_proxy_pass.key, proxy_password->text ()); + settings.setValue (nr_allow_connection.settings_key (), checkbox_allow_web_connect->isChecked ()); + settings.setValue (global_use_proxy.settings_key (), use_proxy_server->isChecked ()); + settings.setValue (global_proxy_type.settings_key (), proxy_type->currentText ()); + settings.setValue (global_proxy_host.settings_key (), proxy_host_name->text ()); + settings.setValue (global_proxy_port.settings_key (), proxy_port->text ()); + settings.setValue (global_proxy_user.settings_key (), proxy_username->text ()); + settings.setValue (global_proxy_pass.settings_key (), proxy_password->text ()); // command window - settings.setValue (cs_font_size.key, terminal_fontSize->value ()); - settings.setValue (cs_font.key, terminal_fontName->currentFont ().family ()); - settings.setValue (cs_cursor_use_fgcol.key, terminal_cursorUseForegroundColor->isChecked ()); - settings.setValue (cs_focus_cmd.key, terminal_focus_command->isChecked ()); - settings.setValue (cs_dbg_location.key, terminal_print_dbg_location->isChecked ()); - settings.setValue (cs_hist_buffer.key, terminal_history_buffer->value ()); + settings.setValue (cs_font_size.settings_key (), terminal_fontSize->value ()); + settings.setValue (cs_font.settings_key (), terminal_fontName->currentFont ().family ()); + settings.setValue (cs_cursor_use_fgcol.settings_key (), terminal_cursorUseForegroundColor->isChecked ()); + settings.setValue (cs_focus_cmd.settings_key (), terminal_focus_command->isChecked ()); + settings.setValue (cs_dbg_location.settings_key (), terminal_print_dbg_location->isChecked ()); + settings.setValue (cs_hist_buffer.settings_key (), terminal_history_buffer->value ()); write_terminal_colors (); // the cursor @@ -1201,9 +1201,9 @@ if ((cursor_int > 0) && (cursor_int < cs_cursor_types.size ())) cursor_type = QString (cs_cursor_types[cursor_int].data ()); else - cursor_type = cs_cursor.def.toString (); + cursor_type = cs_cursor.def ().toString (); - settings.setValue (cs_cursor.key, cursor_type); + settings.setValue (cs_cursor.settings_key (), cursor_type); #if defined (HAVE_QSCINTILLA) // editor styles: create lexer, get dialog contents, and write settings @@ -1257,18 +1257,18 @@ write_workspace_colors (); // Variable editor - settings.setValue (ve_column_width.key, varedit_columnWidth->value ()); - settings.setValue (ve_row_height.key, varedit_rowHeight->value ()); - settings.setValue (ve_use_terminal_font.key, varedit_useTerminalFont->isChecked ()); - settings.setValue (ve_alternate_rows.key, varedit_alternate->isChecked ()); - settings.setValue (ve_font_name.key, varedit_font->currentFont ().family ()); - settings.setValue (ve_font_size.key, varedit_fontSize->value ()); + settings.setValue (ve_column_width.settings_key (), varedit_columnWidth->value ()); + settings.setValue (ve_row_height.settings_key (), varedit_rowHeight->value ()); + settings.setValue (ve_use_terminal_font.settings_key (), varedit_useTerminalFont->isChecked ()); + settings.setValue (ve_alternate_rows.settings_key (), varedit_alternate->isChecked ()); + settings.setValue (ve_font_name.settings_key (), varedit_font->currentFont ().family ()); + settings.setValue (ve_font_size.settings_key (), varedit_fontSize->value ()); write_varedit_colors (); // shortcuts - settings.setValue (sc_prevent_rl_conflicts.key, cb_prevent_readline_conflicts->isChecked ()); - settings.setValue (sc_prevent_rl_conflicts_menu.key, cb_prevent_readline_conflicts_menu->isChecked ()); + settings.setValue (sc_prevent_rl_conflicts.settings_key (), cb_prevent_readline_conflicts->isChecked ()); + settings.setValue (sc_prevent_rl_conflicts_menu.settings_key (), cb_prevent_readline_conflicts_menu->isChecked ()); shortcuts_treewidget->write_settings (); @@ -1302,7 +1302,7 @@ QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ())); cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ())); cb_color_mode->setChecked (mode == 1); - cb_color_mode->setObjectName (ws_color_mode.key); + cb_color_mode->setObjectName (ws_color_mode.settings_key ()); connect (m_ws_enable_colors, &QCheckBox::toggled, cb_color_mode, &QCheckBox::setEnabled); style_grid->addWidget (cb_color_mode, row, column); @@ -1326,7 +1326,7 @@ QColor setting_color = settings.color_value (ws_colors[i], mode); color[i] = new color_picker (setting_color); - color[i]->setObjectName (ws_colors[i].key); + color[i]->setObjectName (ws_colors[i].settings_key ()); color[i]->setMinimumSize (30, 10); color[i]->setEnabled (colors_enabled); connect (m_ws_enable_colors, &QCheckBox::toggled, @@ -1362,7 +1362,7 @@ void settings_dialog::update_workspace_colors (int def) { QCheckBox *cb_color_mode - = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.key); + = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ()); int m = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1374,7 +1374,7 @@ for (unsigned int i = 0; i < ws_colors_count; i++) { - c_picker = workspace_colors_box->findChild <color_picker *> (ws_colors[i].key); + c_picker = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ()); if (c_picker) { if (def != settings_reload_default_colors_flag) @@ -1385,7 +1385,7 @@ else { // Get the default value - c_picker->set_color (settings.get_color_value (ws_colors[i].def, m)); + c_picker->set_color (settings.get_color_value (ws_colors[i].def (), m)); } } } @@ -1395,11 +1395,11 @@ { gui_settings settings; - settings.setValue (ws_enable_colors.key, m_ws_enable_colors->isChecked ()); - settings.setValue (ws_hide_tool_tips.key, m_ws_hide_tool_tips->isChecked ()); + settings.setValue (ws_enable_colors.settings_key (), m_ws_enable_colors->isChecked ()); + settings.setValue (ws_hide_tool_tips.settings_key (), m_ws_hide_tool_tips->isChecked ()); QCheckBox *cb_color_mode - = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.key); + = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ()); int mode = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1409,12 +1409,12 @@ for (int i = 0; i < ws_colors_count; i++) { - color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].key); + color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ()); if (color) settings.set_color_value (ws_colors[i], color->color (), mode); } - settings.setValue (ws_color_mode.key, mode); + settings.setValue (ws_color_mode.settings_key (), mode); settings.sync (); } @@ -1432,7 +1432,7 @@ QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ())); cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ())); cb_color_mode->setChecked (mode == 1); - cb_color_mode->setObjectName (cs_color_mode.key); + cb_color_mode->setObjectName (cs_color_mode.settings_key ()); style_grid->addWidget (cb_color_mode, 0, 0); QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ())); @@ -1449,7 +1449,7 @@ description[i]->setAlignment (Qt::AlignRight); QColor setting_color = settings.color_value (cs_colors[i], mode); color[i] = new color_picker (setting_color); - color[i]->setObjectName (cs_colors[i].key); + color[i]->setObjectName (cs_colors[i].settings_key ()); color[i]->setMinimumSize (30, 10); style_grid->addWidget (description[i], row, 2*column); style_grid->addWidget (color[i], row, 2*column+1); @@ -1474,7 +1474,7 @@ void settings_dialog::update_terminal_colors (int def) { QCheckBox *cb_color_mode - = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.key); + = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ()); int m = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1486,7 +1486,7 @@ for (unsigned int i = 0; i < cs_colors_count; i++) { - c_picker = terminal_colors_box->findChild <color_picker *> (cs_colors[i].key); + c_picker = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ()); if (c_picker) { if (def != settings_reload_default_colors_flag) @@ -1497,7 +1497,7 @@ else { // Get the default value - c_picker->set_color (settings.get_color_value (cs_colors[i].def, m)); + c_picker->set_color (settings.get_color_value (cs_colors[i].def (), m)); } } } @@ -1506,7 +1506,7 @@ void settings_dialog::write_terminal_colors (void) { QCheckBox *cb_color_mode - = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.key); + = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ()); int mode = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1518,12 +1518,12 @@ for (int i = 0; i < cs_color_names.size (); i++) { - color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].key); + color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ()); if (color) settings.set_color_value (cs_colors[i], color->color (), mode); } - settings.setValue (cs_color_mode.key, mode); + settings.setValue (cs_color_mode.settings_key (), mode); settings.sync (); } @@ -1541,7 +1541,7 @@ QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ())); cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ())); cb_color_mode->setChecked (mode == 1); - cb_color_mode->setObjectName (ve_color_mode.key); + cb_color_mode->setObjectName (ve_color_mode.settings_key ()); style_grid->addWidget (cb_color_mode, 0, 0); QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ())); @@ -1559,7 +1559,7 @@ QColor setting_color = settings.color_value (ve_colors[i], mode); color[i] = new color_picker (setting_color); - color[i]->setObjectName (ve_colors[i].key); + color[i]->setObjectName (ve_colors[i].settings_key ()); color[i]->setMinimumSize (30, 10); style_grid->addWidget (description[i], row, 2*column); style_grid->addWidget (color[i], row, 2*column+1); @@ -1584,7 +1584,7 @@ void settings_dialog::update_varedit_colors (int def) { QCheckBox *cb_color_mode - = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.key); + = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ()); int m = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1596,7 +1596,7 @@ for (unsigned int i = 0; i < ve_colors_count; i++) { - c_picker = varedit_colors_box->findChild <color_picker *> (ve_colors[i].key); + c_picker = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ()); if (c_picker) { if (def != settings_reload_default_colors_flag) @@ -1607,7 +1607,7 @@ else { // Get the default value - c_picker->set_color (settings.get_color_value (ve_colors[i].def, m)); + c_picker->set_color (settings.get_color_value (ve_colors[i].def (), m)); } } } @@ -1616,7 +1616,7 @@ void settings_dialog::write_varedit_colors (void) { QCheckBox *cb_color_mode - = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.key); + = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ()); int mode = 0; if (cb_color_mode && cb_color_mode->isChecked ()) @@ -1628,12 +1628,12 @@ for (int i = 0; i < ve_colors_count; i++) { - color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].key); + color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ()); if (color) settings.set_color_value (ve_colors[i], color->color (), mode); } - settings.setValue (ve_color_mode.key, mode); + settings.setValue (ve_color_mode.settings_key (), mode); settings.sync (); }
--- a/libgui/src/shortcuts-tree-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/shortcuts-tree-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -601,7 +601,7 @@ it++; } - settings.setValue (sc_main_ctrld.key, sc_ctrld); + settings.setValue (sc_main_ctrld.settings_key (), sc_ctrld); settings.sync (); } @@ -644,7 +644,7 @@ settings.endGroup (); - settings.setValue (sc_main_ctrld.key, sc_ctrld); + settings.setValue (sc_main_ctrld.settings_key (), sc_ctrld); settings.sync (); } @@ -690,7 +690,7 @@ it++; } - settings.setValue (sc_main_ctrld.key, sc_ctrld); + settings.setValue (sc_main_ctrld.settings_key (), sc_ctrld); settings.sync (); }
--- a/libgui/src/terminal-dock-widget.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/terminal-dock-widget.cc Tue Jan 03 08:03:20 2023 -0500 @@ -118,7 +118,7 @@ font.setStyleHint (QFont::TypeWriter); QString default_font = settings.value (global_mono_font).toString (); font.setFamily - (settings.value (cs_font.key, default_font).toString ()); + (settings.value (cs_font.settings_key (), default_font).toString ()); font.setPointSize (settings.value (cs_font_size).toInt ()); @@ -185,7 +185,7 @@ // Reset use of Ctrl-D. Do this before the call to beginGroup // because sc_main_ctrld.key already begins with the sc_group // prefix. - settings.setValue (sc_main_ctrld.key, false); + settings.setValue (sc_main_ctrld.settings_key (), false); settings.beginGroup (sc_group); const QStringList shortcut_settings_keys = settings.allKeys (); @@ -206,7 +206,7 @@ if (actual == QKeySequence (Qt::ControlModifier+Qt::Key_D)) { - settings.setValue (sc_main_ctrld.key, true); + settings.setValue (sc_main_ctrld.settings_key (), true); break; } }
--- a/libgui/src/variable-editor.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/variable-editor.cc Tue Jan 03 08:03:20 2023 -0500 @@ -1424,12 +1424,12 @@ if (m_use_terminal_font) { - font_name = settings.value (cs_font.key, default_font).toString (); + font_name = settings.value (cs_font.settings_key (), default_font).toString (); font_size = settings.value (cs_font_size).toInt (); } else { - font_name = settings.value (ve_font_name.key, default_font).toString (); + font_name = settings.value (ve_font_name.settings_key (), default_font).toString (); font_size = settings.value (ve_font_size).toInt (); }
--- a/libgui/src/welcome-wizard.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/welcome-wizard.cc Tue Jan 03 08:03:20 2023 -0500 @@ -144,7 +144,7 @@ gui_settings settings; - settings.setValue (nr_allow_connection.key, m_allow_web_connect_state); + settings.setValue (nr_allow_connection.settings_key (), m_allow_web_connect_state); settings.sync (); @@ -248,7 +248,7 @@ QHBoxLayout *checkbox_layout = new QHBoxLayout; - bool allow_connection = nr_allow_connection.def.toBool (); + bool allow_connection = nr_allow_connection.def ().toBool (); if (allow_connection) m_checkbox->setCheckState (Qt::Checked); else
--- a/libgui/src/workspace-view.cc Mon Jan 02 12:38:44 2023 -0500 +++ b/libgui/src/workspace-view.cc Tue Jan 03 08:03:20 2023 -0500 @@ -60,7 +60,7 @@ m_filter->setToolTip (tr ("Enter text to filter the workspace")); m_filter->setEditable (true); - m_filter->setMaxCount (ws_max_filter_history.def.toInt ()); + m_filter->setMaxCount (ws_max_filter_history.def ().toInt ()); m_filter->setInsertPolicy (QComboBox::NoInsert); m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon); QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -110,7 +110,7 @@ m_view->setSortingEnabled (true); // Initialize column order and width of the workspace m_view->horizontalHeader ()->restoreState - (settings.value (ws_column_state.key).toByteArray ()); + (settings.value (ws_column_state.settings_key ()).toByteArray ()); // Set header properties for sorting m_view->horizontalHeader ()->setSectionsClickable (true); @@ -129,7 +129,7 @@ this, &workspace_view::header_contextmenu_requested); // Init state of the filter - m_filter->addItems (settings.value (ws_mru_list.key).toStringList ()); + m_filter->addItems (settings.value (ws_mru_list.settings_key ()).toStringList ()); bool filter_state = settings.value (ws_filter_active).toBool (); m_filter_checkbox->setChecked (filter_state); @@ -211,21 +211,21 @@ { gui_settings settings; - settings.setValue (ws_column_state.key, + settings.setValue (ws_column_state.settings_key (), m_view->horizontalHeader ()->saveState ()); int sort_column = m_view->horizontalHeader ()->sortIndicatorSection (); Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder (); - settings.setValue (ws_sort_column.key, sort_column); - settings.setValue (ws_sort_order.key, sort_order); + settings.setValue (ws_sort_column.settings_key (), sort_column); + settings.setValue (ws_sort_order.settings_key (), sort_order); - settings.setValue (ws_filter_active.key, m_filter_checkbox->isChecked ()); - settings.setValue (ws_filter_shown.key, m_filter_shown); + settings.setValue (ws_filter_active.settings_key (), m_filter_checkbox->isChecked ()); + settings.setValue (ws_filter_shown.settings_key (), m_filter_shown); QStringList mru; for (int i = 0; i < m_filter->count (); i++) mru.append (m_filter->itemText (i)); - settings.setValue (ws_mru_list.key, mru); + settings.setValue (ws_mru_list.settings_key (), mru); settings.sync ();