changeset 31695:5749674b826e

store constant shortcut data in global QHash object This change is a step toward removing the shortcut_manager class * gui-preferences-sc.cc, gui-preferences.cc: New files. * libgui/src/module.mk: Update. * gui-preferences-sc.h, gui-preferences-sc.cc: Declare shortcut objects extern instead of const and initialize them in source file instead of header. (all_shortcut_preferences): New singleton class for global shortcut data. * gui-preferences.h, gui-preferences.cc (sc_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. (sc_pref::m_description, sc_pref::description): New data member and accessor function. (sc_pref::sc_pref): Include description in constructor argument list. Change all uses. Store shortcut info in global all_shortcut_preferences hash when creating sc_pref objects. Use settings_keys instead of keys to avoid confusion between the index key use for QSettings and keyboard keys.
author John W. Eaton <jwe@octave.org>
date Sun, 25 Dec 2022 20:37:53 -0500
parents 5629d97c174f
children 8fed04d0607c
files libgui/src/gui-preferences-sc.cc libgui/src/gui-preferences-sc.h libgui/src/gui-preferences.cc libgui/src/gui-preferences.h libgui/src/gui-settings.cc libgui/src/module.mk libgui/src/shortcut-manager.cc
diffstat 7 files changed, 513 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/gui-preferences-sc.cc	Sun Dec 25 20:37:53 2022 -0500
@@ -0,0 +1,218 @@
+////////////////////////////////////////////////////////////////////////
+//
+// 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 <QCoreApplication>
+#include <QSet>
+
+#include "gui-preferences-sc.h"
+
+// Note: Trying to shorten the uses of
+//
+//   QCoreApplication::translate (CONTEXT, STRING)
+//
+// by defining a macro won't work because lupdate won't know to look for
+// the macro.
+
+sc_pref sc_dock_widget_dock (QCoreApplication::translate ("shortcuts", "Undock/Dock Widget"), sc_dock_widget + ":dock", CTRL_ALT + Qt::Key_D);
+sc_pref sc_dock_widget_close (QCoreApplication::translate ("shortcuts", "Close Widget"), sc_dock_widget + ":close", CTRL_ALT + Qt::Key_C);
+
+// Main window menu
+
+// file
+sc_pref sc_main_file_new_file (QCoreApplication::translate ("shortcuts", "New File"), sc_main_file + ":new_file", QKeySequence::New);
+sc_pref sc_main_file_new_function (QCoreApplication::translate ("shortcuts", "New Function"), sc_main_file + ":new_function", CTRL_SHIFT + Qt::Key_N);
+sc_pref sc_main_file_new_figure (QCoreApplication::translate ("shortcuts", "New Figure"), sc_main_file + ":new_figure", QKeySequence::UnknownKey);
+sc_pref sc_main_file_open_file (QCoreApplication::translate ("shortcuts", "Open File"), sc_main_file + ":open_file", QKeySequence::Open);
+sc_pref sc_main_file_load_workspace (QCoreApplication::translate ("shortcuts", "Load Workspace"), sc_main_file + ":load_workspace", QKeySequence::UnknownKey);
+sc_pref sc_main_file_save_workspace (QCoreApplication::translate ("shortcuts", "Save Workspace As"), sc_main_file + ":save_workspace", QKeySequence::UnknownKey);
+sc_pref sc_main_file_exit (QCoreApplication::translate ("shortcuts", "Exit Octave"), sc_main_file + ":exit", QKeySequence::Quit);
+
+// edit
+sc_pref sc_main_edit_copy (QCoreApplication::translate ("shortcuts", "Copy"), sc_main_edit + ":copy", QKeySequence::Copy);
+sc_pref sc_main_edit_paste (QCoreApplication::translate ("shortcuts", "Paste"), sc_main_edit + ":paste", QKeySequence::Paste);
+sc_pref sc_main_edit_undo (QCoreApplication::translate ("shortcuts", "Undo"), sc_main_edit + ":undo", QKeySequence::Undo);
+sc_pref sc_main_edit_select_all (QCoreApplication::translate ("shortcuts", "Select All"), sc_main_edit + ":select_all", QKeySequence::SelectAll);
+sc_pref sc_main_edit_clear_clipboard (QCoreApplication::translate ("shortcuts", "Clear Clipboard"), sc_main_edit + ":clear_clipboard", QKeySequence::UnknownKey);
+sc_pref sc_main_edit_find_in_files (QCoreApplication::translate ("shortcuts", "Find in Files"), sc_main_edit + ":find_in_files", CTRL_SHIFT + Qt::Key_F);
+sc_pref sc_main_edit_clear_command_window (QCoreApplication::translate ("shortcuts", "Clear Command Window"), sc_main_edit + ":clear_command_window", QKeySequence::UnknownKey);
+sc_pref sc_main_edit_clear_history (QCoreApplication::translate ("shortcuts", "Clear Command History"), sc_main_edit + ":clear_history", QKeySequence::UnknownKey);
+sc_pref sc_main_edit_clear_workspace (QCoreApplication::translate ("shortcuts", "Clear Workspace"), sc_main_edit + ":clear_workspace", QKeySequence::UnknownKey);
+sc_pref sc_main_edit_set_path (QCoreApplication::translate ("shortcuts", "Set Path"), sc_main_edit + ":set_path", QKeySequence::UnknownKey);
+sc_pref sc_main_edit_preferences (QCoreApplication::translate ("shortcuts", "Preferences"), sc_main_edit + ":preferences", QKeySequence::UnknownKey);
+
+// debug
+sc_pref sc_main_debug_step_over (QCoreApplication::translate ("shortcuts", "Step"), sc_main_debug + ":step_over", PRE + Qt::Key_F10);
+sc_pref sc_main_debug_step_into (QCoreApplication::translate ("shortcuts", "Step Into"), sc_main_debug + ":step_into", PRE + Qt::Key_F11);
+sc_pref sc_main_debug_step_out (QCoreApplication::translate ("shortcuts", "Step Out"), sc_main_debug + ":step_out", PRE + Qt::ShiftModifier + Qt::Key_F11);
+sc_pref sc_main_debug_continue (QCoreApplication::translate ("shortcuts", "Continue"), sc_main_debug + ":continue", PRE + Qt::Key_F5);
+sc_pref sc_main_debug_quit (QCoreApplication::translate ("shortcuts", "Quit Debug Mode"), sc_main_debug + ":quit", PRE + Qt::ShiftModifier + Qt::Key_F5);
+
+// tools
+sc_pref sc_main_tools_start_profiler (QCoreApplication::translate ("shortcuts", "Start/Stop Profiler Session"), sc_main_tools + ":start_profiler", CTRL_SHIFT + Qt::Key_P);
+sc_pref sc_main_tools_resume_profiler (QCoreApplication::translate ("shortcuts", "Resume Profiler Session"), sc_main_tools + ":resume_profiler", QKeySequence::UnknownKey);
+sc_pref sc_main_tools_show_profiler (QCoreApplication::translate ("shortcuts", "Show Profile Data"), sc_main_tools + ":show_profiler", Qt::AltModifier + Qt::ShiftModifier + Qt::Key_P);
+
+
+// window
+sc_pref sc_main_window_show_command (QCoreApplication::translate ("shortcuts", "Show Command Window"), sc_main_window + ":show_command", PRE + CTRL_SHIFT + Qt::Key_0);
+sc_pref sc_main_window_show_history (QCoreApplication::translate ("shortcuts", "Show Command History"), sc_main_window + ":show_history", PRE + CTRL_SHIFT + Qt::Key_1);
+sc_pref sc_main_window_show_file_browser (QCoreApplication::translate ("shortcuts", "Show File Browser"), sc_main_window + ":show_file_browser", PRE + CTRL_SHIFT + Qt::Key_2);
+sc_pref sc_main_window_show_workspace (QCoreApplication::translate ("shortcuts", "Show Workspace"), sc_main_window + ":show_workspace", PRE + CTRL_SHIFT + Qt::Key_3);
+sc_pref sc_main_window_show_editor (QCoreApplication::translate ("shortcuts", "Show Editor"), sc_main_window + ":show_editor", PRE + CTRL_SHIFT + Qt::Key_4);
+sc_pref sc_main_window_show_doc (QCoreApplication::translate ("shortcuts", "Show Documentation"), sc_main_window + ":show_doc", PRE + CTRL_SHIFT + Qt::Key_5);
+sc_pref sc_main_window_show_variable_editor (QCoreApplication::translate ("shortcuts", "Show Variable Editor"), sc_main_window + ":show_variable_editor", PRE + CTRL_SHIFT + Qt::Key_6);
+sc_pref sc_main_window_command (QCoreApplication::translate ("shortcuts", "Command Window"), sc_main_window + ":command", PRE + CTRL + Qt::Key_0);
+sc_pref sc_main_window_history (QCoreApplication::translate ("shortcuts", "Command History"), sc_main_window + ":history", PRE + CTRL + Qt::Key_1);
+sc_pref sc_main_window_file_browser (QCoreApplication::translate ("shortcuts", "File Browser"), sc_main_window + ":file_browser", PRE + CTRL + Qt::Key_2);
+sc_pref sc_main_window_workspace (QCoreApplication::translate ("shortcuts", "Workspace"), sc_main_window + ":workspace", PRE + CTRL + Qt::Key_3);
+sc_pref sc_main_window_editor (QCoreApplication::translate ("shortcuts", "Editor"), sc_main_window + ":editor", PRE + CTRL + Qt::Key_4);
+sc_pref sc_main_window_doc (QCoreApplication::translate ("shortcuts", "Documentation"), sc_main_window + ":doc", PRE + CTRL + Qt::Key_5);
+sc_pref sc_main_window_variable_editor (QCoreApplication::translate ("shortcuts", "Variable Editor"), sc_main_window + ":variable_editor", PRE + CTRL + Qt::Key_6);
+sc_pref sc_main_window_previous_dock (QCoreApplication::translate ("shortcuts", "Previous Widget"), sc_main_window + ":previous_widget", PRE + CTRL_ALT + Qt::Key_P);
+sc_pref sc_main_window_reset (QCoreApplication::translate ("shortcuts", "Reset Default Window Layout"), sc_main_window + ":reset", QKeySequence::UnknownKey);
+
+// help
+sc_pref sc_main_help_ondisk_doc (QCoreApplication::translate ("shortcuts", "Show On-disk Documentation"), sc_main_help + ":ondisk_doc", QKeySequence::UnknownKey);
+sc_pref sc_main_help_online_doc (QCoreApplication::translate ("shortcuts", "Show Online Documentation"), sc_main_help + ":online_doc", QKeySequence::UnknownKey);
+sc_pref sc_main_help_report_bug (QCoreApplication::translate ("shortcuts", "Report Bug"), sc_main_help + ":report_bug", QKeySequence::UnknownKey);
+sc_pref sc_main_help_packages (QCoreApplication::translate ("shortcuts", "Octave Packages"), sc_main_help + ":packages", QKeySequence::UnknownKey);
+sc_pref sc_main_help_contribute (QCoreApplication::translate ("shortcuts", "Contribute to Octave"), sc_main_help + ":contribute", QKeySequence::UnknownKey);
+sc_pref sc_main_help_developer (QCoreApplication::translate ("shortcuts", "Octave Developer Resources"), sc_main_help + ":developer", QKeySequence::UnknownKey);
+sc_pref sc_main_help_about (QCoreApplication::translate ("shortcuts", "About Octave"), sc_main_help + ":about", QKeySequence::UnknownKey);
+
+// news
+sc_pref sc_main_news_release_notes (QCoreApplication::translate ("shortcuts", "Release Notes"), sc_main_news + ":release_notes", QKeySequence::UnknownKey);
+sc_pref sc_main_news_community_news (QCoreApplication::translate ("shortcuts", "Community News"), sc_main_news + ":community_news", QKeySequence::UnknownKey);
+
+// Tab handling
+// The following shortcuts are moved into a separate tab.  The key names
+// are not change for preserving compatibility with older versions
+sc_pref sc_edit_file_close (QCoreApplication::translate ("shortcuts", "Close Tab"), sc_edit_file_cl, QKeySequence::Close);
+sc_pref sc_edit_file_close_all (QCoreApplication::translate ("shortcuts", "Close All Tabs"), sc_edit_file_cl + "_all", QKeySequence::UnknownKey);
+sc_pref sc_edit_file_close_other (QCoreApplication::translate ("shortcuts", "Close Other Tabs"), sc_edit_file_cl + "_other", QKeySequence::UnknownKey);
+sc_pref sc_edit_tabs_switch_left_tab (QCoreApplication::translate ("shortcuts", "Switch to Left Tab"), sc_edit_tabs + ":switch_left_tab", CTRL + Qt::Key_PageUp);
+sc_pref sc_edit_tabs_switch_right_tab (QCoreApplication::translate ("shortcuts", "Switch to Right Tab"), sc_edit_tabs + ":switch_right_tab", CTRL + Qt::Key_PageDown);
+sc_pref sc_edit_tabs_move_tab_left (QCoreApplication::translate ("shortcuts", "Move Tab Left"), sc_edit_tabs + ":move_tab_left", Qt::AltModifier + Qt::Key_PageUp);
+sc_pref sc_edit_tabs_move_tab_right (QCoreApplication::translate ("shortcuts", "Move Tab Right"), sc_edit_tabs + ":move_tab_right", Qt::AltModifier + Qt::Key_PageDown);
+
+// Zooming
+sc_pref sc_edit_view_zoom_in (QCoreApplication::translate ("shortcuts", "Zoom In"), sc_edit_view_zoom + "_in", QKeySequence::ZoomIn);
+sc_pref sc_edit_view_zoom_out (QCoreApplication::translate ("shortcuts", "Zoom Out"), sc_edit_view_zoom + "_out", QKeySequence::ZoomOut);
+#if defined (Q_OS_MAC)
+sc_pref sc_edit_view_zoom_normal (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", CTRL + Qt::Key_Underscore);
+#else
+sc_pref sc_edit_view_zoom_normal (QCoreApplication::translate ("shortcuts", "Zoom Normal"), sc_edit_view_zoom + "_normal", CTRL + Qt::Key_Period);
+#endif
+
+// Actions of the editor
+
+// file
+sc_pref sc_edit_file_edit_function (QCoreApplication::translate ("shortcuts", "Edit Function"), sc_edit_file + ":edit_function", CTRL + Qt::Key_E);
+sc_pref sc_edit_file_save (QCoreApplication::translate ("shortcuts", "Save File"), sc_edit_file + ":save", QKeySequence::Save);
+sc_pref sc_edit_file_save_as (QCoreApplication::translate ("shortcuts", "Save File As"), sc_edit_file + ":save_as", QKeySequence::SaveAs);
+sc_pref sc_edit_file_print (QCoreApplication::translate ("shortcuts", "Print"), sc_edit_file + ":print", QKeySequence::Print);
+
+// edit
+sc_pref sc_edit_edit_redo (QCoreApplication::translate ("shortcuts", "Redo"), sc_edit_edit + ":redo", QKeySequence::Redo);
+sc_pref sc_edit_edit_cut (QCoreApplication::translate ("shortcuts", "Cut"), sc_edit_edit + ":cut", QKeySequence::Cut);
+sc_pref sc_edit_edit_find_replace (QCoreApplication::translate ("shortcuts", "Find and Replace"), sc_edit_edit_find + "_replace", QKeySequence::Find);
+sc_pref sc_edit_edit_find_next (QCoreApplication::translate ("shortcuts", "Find Next"), sc_edit_edit_find + "_next", QKeySequence::FindNext);
+sc_pref sc_edit_edit_find_previous (QCoreApplication::translate ("shortcuts", "Find Previous"), sc_edit_edit_find + "_previous", QKeySequence::FindPrevious);
+sc_pref sc_edit_edit_delete_start_word (QCoreApplication::translate ("shortcuts", "Delete to Start of Word"), sc_edit_edit + ":delete_start_word", QKeySequence::DeleteStartOfWord);
+sc_pref sc_edit_edit_delete_end_word (QCoreApplication::translate ("shortcuts", "Delete to End of Word"), sc_edit_edit + ":delete_end_word", QKeySequence::DeleteEndOfWord);
+sc_pref sc_edit_edit_delete_start_line (QCoreApplication::translate ("shortcuts", "Delete to Start of Line"), sc_edit_edit + ":delete_start_line", CTRL_SHIFT + Qt::Key_Backspace);
+sc_pref sc_edit_edit_delete_end_line (QCoreApplication::translate ("shortcuts", "Delete to End of Line"), sc_edit_edit + ":delete_end_line", CTRL_SHIFT + Qt::Key_Delete);
+sc_pref sc_edit_edit_delete_line (QCoreApplication::translate ("shortcuts", "Delete Line"), sc_edit_edit + ":delete_line", CTRL_SHIFT + Qt::Key_L);
+sc_pref sc_edit_edit_copy_line (QCoreApplication::translate ("shortcuts", "Copy Line"), sc_edit_edit + ":copy_line", CTRL_SHIFT + Qt::Key_C);
+sc_pref sc_edit_edit_cut_line (QCoreApplication::translate ("shortcuts", "Cut Line"), sc_edit_edit + ":cut_line", CTRL_SHIFT + Qt::Key_X);
+sc_pref sc_edit_edit_duplicate_selection (QCoreApplication::translate ("shortcuts", "Duplicate Selection/Line"), sc_edit_edit + ":duplicate_selection", CTRL + Qt::Key_D);
+sc_pref sc_edit_edit_transpose_line (QCoreApplication::translate ("shortcuts", "Transpose Line"), sc_edit_edit + ":transpose_line", CTRL + Qt::Key_T);
+sc_pref sc_edit_edit_completion_list (QCoreApplication::translate ("shortcuts", "Show Completion List"), sc_edit_edit + ":completion_list", CTRL + Qt::Key_Space);
+
+sc_pref sc_edit_edit_comment_selection (QCoreApplication::translate ("shortcuts", "Comment Selection"), sc_edit_edit + ":comment_selection", CTRL + Qt::Key_R);
+sc_pref sc_edit_edit_uncomment_selection (QCoreApplication::translate ("shortcuts", "Uncomment Selection"), sc_edit_edit + ":uncomment_selection", CTRL_SHIFT + Qt::Key_R);
+sc_pref sc_edit_edit_comment_var_selection (QCoreApplication::translate ("shortcuts", "Comment Selection (Choosing String)"), sc_edit_edit + ":comment_var_selection", CTRL_ALT + Qt::Key_R);
+sc_pref sc_edit_edit_upper_case (QCoreApplication::translate ("shortcuts", "Uppercase Selection"), sc_edit_edit + ":upper_case", CTRL + Qt::Key_U);
+sc_pref sc_edit_edit_lower_case (QCoreApplication::translate ("shortcuts", "Lowercase Selection"), sc_edit_edit + ":lower_case", CTRL_ALT + Qt::Key_U);
+
+#if defined (Q_OS_MAC)
+sc_pref sc_edit_edit_indent_selection (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", PRE + Qt::Key_Tab);
+sc_pref sc_edit_edit_unindent_selection (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", PRE + Qt::ShiftModifier + Qt::Key_Tab);
+#else
+sc_pref sc_edit_edit_indent_selection (QCoreApplication::translate ("shortcuts", "Indent Selection Rigidly"), sc_edit_edit + ":indent_selection", CTRL + Qt::Key_Tab);
+sc_pref sc_edit_edit_unindent_selection (QCoreApplication::translate ("shortcuts", "Unindent Selection Rigidly"), sc_edit_edit + ":unindent_selection", CTRL_SHIFT + Qt::Key_Tab);
+#endif
+sc_pref sc_edit_edit_smart_indent_line_or_selection (QCoreApplication::translate ("shortcuts", "Indent Code"), sc_edit_edit + ":smart_indent_line_or_selection", QKeySequence::UnknownKey);
+
+sc_pref sc_edit_edit_conv_eol_winows (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Windows"), sc_edit_edit + ":conv_eol_winows", QKeySequence::UnknownKey);
+sc_pref sc_edit_edit_conv_eol_unix (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Unix"), sc_edit_edit + ":conv_eol_unix", QKeySequence::UnknownKey);
+sc_pref sc_edit_edit_conv_eol_mac (QCoreApplication::translate ("shortcuts", "Convert Line Endings to Mac"), sc_edit_edit + ":conv_eol_mac", QKeySequence::UnknownKey);
+
+sc_pref sc_edit_edit_goto_line (QCoreApplication::translate ("shortcuts", "Goto Line"), sc_edit_edit + ":goto_line", CTRL + Qt::Key_L);
+sc_pref sc_edit_edit_move_to_brace (QCoreApplication::translate ("shortcuts", "Move to Matching Brace"), sc_edit_edit + ":move_to_brace", CTRL + Qt::Key_M);
+sc_pref sc_edit_edit_select_to_brace (QCoreApplication::translate ("shortcuts", "Select to Matching Brace"), sc_edit_edit + ":select_to_brace", CTRL_SHIFT + Qt::Key_M);
+sc_pref sc_edit_edit_toggle_bookmark (QCoreApplication::translate ("shortcuts", "Toggle Bookmark"), sc_edit_edit + ":toggle_bookmark", PRE + Qt::Key_F7);
+sc_pref sc_edit_edit_next_bookmark (QCoreApplication::translate ("shortcuts", "Next Bookmark"), sc_edit_edit + ":next_bookmark", PRE + Qt::Key_F2);
+sc_pref sc_edit_edit_previous_bookmark (QCoreApplication::translate ("shortcuts", "Previous Bookmark"), sc_edit_edit + ":previous_bookmark", PRE + Qt::SHIFT + Qt::Key_F2);
+sc_pref sc_edit_edit_remove_bookmark (QCoreApplication::translate ("shortcuts", "Remove All Bookmark"), sc_edit_edit + ":remove_bookmark", QKeySequence::UnknownKey);
+
+sc_pref sc_edit_edit_preferences (QCoreApplication::translate ("shortcuts", "Preferences"), sc_edit_edit + ":preferences", QKeySequence::UnknownKey);
+sc_pref sc_edit_edit_styles_preferences (QCoreApplication::translate ("shortcuts", "Styles Preferences"), sc_edit_edit + ":styles_preferences", QKeySequence::UnknownKey);
+
+// view
+sc_pref sc_edit_view_show_line_numbers (QCoreApplication::translate ("shortcuts", "Show Line Numbers"), sc_edit_view + ":show_line_numbers", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_white_spaces (QCoreApplication::translate ("shortcuts", "Show Whitespace Characters"), sc_edit_view + ":show_white_spaces", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_eol_chars (QCoreApplication::translate ("shortcuts", "Show Line Endings"), sc_edit_view + ":show_eol_chars", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_ind_guides (QCoreApplication::translate ("shortcuts", "Show Indentation Guides"), sc_edit_view + ":show_ind_guides", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_long_line (QCoreApplication::translate ("shortcuts", "Show Long Line Marker"), sc_edit_view + ":show_long_line", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_toolbar (QCoreApplication::translate ("shortcuts", "Show Toolbar"), sc_edit_view + ":show_toolbar", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_statusbar (QCoreApplication::translate ("shortcuts", "Show Statusbar"), sc_edit_view + ":show_statusbar", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_show_hscrollbar (QCoreApplication::translate ("shortcuts", "Show Horizontal Scrollbar"), sc_edit_view + ":show_hscrollbar", QKeySequence::UnknownKey);
+sc_pref sc_edit_view_sort_tabs (QCoreApplication::translate ("shortcuts", "Sort Tabs Alphabetically"), sc_edit_view + ":sort_tabs", QKeySequence::UnknownKey);
+
+// debug
+sc_pref sc_edit_debug_toggle_breakpoint (QCoreApplication::translate ("shortcuts", "Toggle Breakpoint"), sc_edit_debug + ":toggle_breakpoint", QKeySequence::UnknownKey);
+sc_pref sc_edit_debug_next_breakpoint (QCoreApplication::translate ("shortcuts", "Next Breakpoint"), sc_edit_debug + ":next_breakpoint", QKeySequence::UnknownKey);
+sc_pref sc_edit_debug_previous_breakpoint (QCoreApplication::translate ("shortcuts", "Previous Breakpoint"), sc_edit_debug + ":previous_breakpoint", QKeySequence::UnknownKey);
+sc_pref sc_edit_debug_remove_breakpoints (QCoreApplication::translate ("shortcuts", "Remove All Breakpoints"), sc_edit_debug + ":remove_breakpoints", QKeySequence::UnknownKey);
+
+// run
+sc_pref sc_edit_run_run_file (QCoreApplication::translate ("shortcuts", "Run File"), sc_edit_run + ":run_file", PRE + Qt::Key_F5);
+sc_pref sc_edit_run_run_selection (QCoreApplication::translate ("shortcuts", "Run Selection"), sc_edit_run + ":run_selection", PRE + Qt::Key_F9);
+
+// help
+sc_pref sc_edit_help_help_keyword (QCoreApplication::translate ("shortcuts", "Help on Keyword"), sc_edit_help + ":help_keyword", QKeySequence::HelpContents);
+sc_pref sc_edit_help_doc_keyword (QCoreApplication::translate ("shortcuts", "Document on Keyword"), sc_edit_help + ":doc_keyword", Qt::SHIFT + Qt::Key_F1);
+
+
+// Documentation browser
+sc_pref sc_doc_go_home (QCoreApplication::translate ("shortcuts", "Go to Homepage"), sc_doc + ":go_home", Qt::AltModifier + Qt::Key_Home);
+sc_pref sc_doc_go_back (QCoreApplication::translate ("shortcuts", "Go Back one Page"), sc_doc + ":go_back", QKeySequence::Back);
+sc_pref sc_doc_go_next (QCoreApplication::translate ("shortcuts", "Go Forward one Page"), sc_doc + ":go_next", QKeySequence::Forward);
+sc_pref sc_doc_bookmark (QCoreApplication::translate ("shortcuts", "Bookmark this Page"), sc_doc + ":bookmark", CTRL + Qt::Key_D);
--- a/libgui/src/gui-preferences-sc.h	Sun Dec 25 16:11:47 2022 -0500
+++ b/libgui/src/gui-preferences-sc.h	Sun Dec 25 20:37:53 2022 -0500
@@ -26,6 +26,8 @@
 #if ! defined (octave_gui_preferences_sc_h)
 #define octave_gui_preferences_sc_h 1
 
+#include <QSet>
+
 #include "gui-preferences.h"
 
 // Define shortcuts
@@ -56,206 +58,206 @@
 const Qt::KeyboardModifiers CTRL_ALT = CTRL | Qt::AltModifier;
 
 // Shortcuts not related to specific Menus
-
+ 
 // Dock widgets
 const QString sc_dock_widget ("dock_widget");
-const sc_pref sc_dock_widget_dock (sc_dock_widget + ":dock", CTRL_ALT + Qt::Key_D);
-const sc_pref sc_dock_widget_close (sc_dock_widget + ":close", CTRL_ALT + Qt::Key_C);
+extern sc_pref sc_dock_widget_dock;
+extern sc_pref sc_dock_widget_close;
 
 // Main window menu
 
 // file
 const QString sc_main_file ("main_file");
-const sc_pref sc_main_file_new_file (sc_main_file + ":new_file", QKeySequence::New);
-const sc_pref sc_main_file_new_function (sc_main_file + ":new_function", CTRL_SHIFT + Qt::Key_N);
-const sc_pref sc_main_file_new_figure (sc_main_file + ":new_figure", QKeySequence::UnknownKey);
-const sc_pref sc_main_file_open_file (sc_main_file + ":open_file", QKeySequence::Open);
-const sc_pref sc_main_file_load_workspace (sc_main_file + ":load_workspace", QKeySequence::UnknownKey);
-const sc_pref sc_main_file_save_workspace (sc_main_file + ":save_workspace", QKeySequence::UnknownKey);
-const sc_pref sc_main_file_exit (sc_main_file + ":exit", QKeySequence::Quit);
+extern sc_pref sc_main_file_new_file;
+extern sc_pref sc_main_file_new_function;
+extern sc_pref sc_main_file_new_figure;
+extern sc_pref sc_main_file_open_file;
+extern sc_pref sc_main_file_load_workspace;
+extern sc_pref sc_main_file_save_workspace;
+extern sc_pref sc_main_file_exit;
 
 // edit
 const QString sc_main_edit ("main_edit");
-const sc_pref sc_main_edit_copy (sc_main_edit + ":copy", QKeySequence::Copy);
-const sc_pref sc_main_edit_paste (sc_main_edit + ":paste", QKeySequence::Paste);
-const sc_pref sc_main_edit_undo (sc_main_edit + ":undo", QKeySequence::Undo);
-const sc_pref sc_main_edit_select_all (sc_main_edit + ":select_all", QKeySequence::SelectAll);
-const sc_pref sc_main_edit_clear_clipboard (sc_main_edit + ":clear_clipboard", QKeySequence::UnknownKey);
-const sc_pref sc_main_edit_find_in_files (sc_main_edit + ":find_in_files", CTRL_SHIFT + Qt::Key_F);
-const sc_pref sc_main_edit_clear_command_window (sc_main_edit + ":clear_command_window", QKeySequence::UnknownKey);
-const sc_pref sc_main_edit_clear_history (sc_main_edit + ":clear_history", QKeySequence::UnknownKey);
-const sc_pref sc_main_edit_clear_workspace (sc_main_edit + ":clear_workspace", QKeySequence::UnknownKey);
-const sc_pref sc_main_edit_set_path (sc_main_edit + ":set_path", QKeySequence::UnknownKey);
-const sc_pref sc_main_edit_preferences (sc_main_edit + ":preferences", QKeySequence::UnknownKey);
+extern sc_pref sc_main_edit_copy;
+extern sc_pref sc_main_edit_paste;
+extern sc_pref sc_main_edit_undo;
+extern sc_pref sc_main_edit_select_all;
+extern sc_pref sc_main_edit_clear_clipboard;
+extern sc_pref sc_main_edit_find_in_files;
+extern sc_pref sc_main_edit_clear_command_window;
+extern sc_pref sc_main_edit_clear_history;
+extern sc_pref sc_main_edit_clear_workspace;
+extern sc_pref sc_main_edit_set_path;
+extern sc_pref sc_main_edit_preferences;
 
 // debug
 const QString sc_main_debug ("main_debug");
-const sc_pref sc_main_debug_step_over (sc_main_debug + ":step_over", PRE + Qt::Key_F10);
-const sc_pref sc_main_debug_step_into (sc_main_debug + ":step_into", PRE + Qt::Key_F11);
-const sc_pref sc_main_debug_step_out (sc_main_debug + ":step_out", PRE + Qt::ShiftModifier + Qt::Key_F11);
-const sc_pref sc_main_debug_continue (sc_main_debug + ":continue", PRE + Qt::Key_F5);
-const sc_pref sc_main_debug_quit (sc_main_debug + ":quit", PRE + Qt::ShiftModifier + Qt::Key_F5);
+extern sc_pref sc_main_debug_step_over;
+extern sc_pref sc_main_debug_step_into;
+extern sc_pref sc_main_debug_step_out;
+extern sc_pref sc_main_debug_continue;
+extern sc_pref sc_main_debug_quit;
 
 // tools
 const QString sc_main_tools ("main_tools");
-const sc_pref sc_main_tools_start_profiler (sc_main_tools + ":start_profiler", CTRL_SHIFT + Qt::Key_P);
-const sc_pref sc_main_tools_resume_profiler (sc_main_tools + ":resume_profiler", QKeySequence::UnknownKey);
-const sc_pref sc_main_tools_show_profiler (sc_main_tools + ":show_profiler", Qt::AltModifier + Qt::ShiftModifier + Qt::Key_P);
+extern sc_pref sc_main_tools_start_profiler;
+extern sc_pref sc_main_tools_resume_profiler;
+extern sc_pref sc_main_tools_show_profiler;
 
 
 // window
 const QString sc_main_window ("main_window");
-const sc_pref sc_main_window_show_command (sc_main_window + ":show_command", PRE + CTRL_SHIFT + Qt::Key_0);
-const sc_pref sc_main_window_show_history (sc_main_window + ":show_history", PRE + CTRL_SHIFT + Qt::Key_1);
-const sc_pref sc_main_window_show_file_browser (sc_main_window + ":show_file_browser", PRE + CTRL_SHIFT + Qt::Key_2);
-const sc_pref sc_main_window_show_workspace (sc_main_window + ":show_workspace", PRE + CTRL_SHIFT + Qt::Key_3);
-const sc_pref sc_main_window_show_editor (sc_main_window + ":show_editor", PRE + CTRL_SHIFT + Qt::Key_4);
-const sc_pref sc_main_window_show_doc (sc_main_window + ":show_doc", PRE + CTRL_SHIFT + Qt::Key_5);
-const sc_pref sc_main_window_show_variable_editor (sc_main_window + ":show_variable_editor", PRE + CTRL_SHIFT + Qt::Key_6);
-const sc_pref sc_main_window_command (sc_main_window + ":command", PRE + CTRL + Qt::Key_0);
-const sc_pref sc_main_window_history (sc_main_window + ":history", PRE + CTRL + Qt::Key_1);
-const sc_pref sc_main_window_file_browser (sc_main_window + ":file_browser", PRE + CTRL + Qt::Key_2);
-const sc_pref sc_main_window_workspace (sc_main_window + ":workspace", PRE + CTRL + Qt::Key_3);
-const sc_pref sc_main_window_editor (sc_main_window + ":editor", PRE + CTRL + Qt::Key_4);
-const sc_pref sc_main_window_doc (sc_main_window + ":doc", PRE + CTRL + Qt::Key_5);
-const sc_pref sc_main_window_variable_editor (sc_main_window + ":variable_editor", PRE + CTRL + Qt::Key_6);
-const sc_pref sc_main_window_previous_dock (sc_main_window + ":previous_widget", PRE + CTRL_ALT + Qt::Key_P);
-const sc_pref sc_main_window_reset (sc_main_window + ":reset", QKeySequence::UnknownKey);
+extern sc_pref sc_main_window_show_command;
+extern sc_pref sc_main_window_show_history;
+extern sc_pref sc_main_window_show_file_browser;
+extern sc_pref sc_main_window_show_workspace;
+extern sc_pref sc_main_window_show_editor;
+extern sc_pref sc_main_window_show_doc;
+extern sc_pref sc_main_window_show_variable_editor;
+extern sc_pref sc_main_window_command;
+extern sc_pref sc_main_window_history;
+extern sc_pref sc_main_window_file_browser;
+extern sc_pref sc_main_window_workspace;
+extern sc_pref sc_main_window_editor;
+extern sc_pref sc_main_window_doc;
+extern sc_pref sc_main_window_variable_editor;
+extern sc_pref sc_main_window_previous_dock;
+extern sc_pref sc_main_window_reset;
 
 // help
 const QString sc_main_help ("main_help");
-const sc_pref sc_main_help_ondisk_doc (sc_main_help + ":ondisk_doc", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_online_doc (sc_main_help + ":online_doc", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_report_bug (sc_main_help + ":report_bug", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_packages (sc_main_help + ":packages", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_contribute (sc_main_help + ":contribute", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_developer (sc_main_help + ":developer", QKeySequence::UnknownKey);
-const sc_pref sc_main_help_about (sc_main_help + ":about", QKeySequence::UnknownKey);
+extern sc_pref sc_main_help_ondisk_doc;
+extern sc_pref sc_main_help_online_doc;
+extern sc_pref sc_main_help_report_bug;
+extern sc_pref sc_main_help_packages;
+extern sc_pref sc_main_help_contribute;
+extern sc_pref sc_main_help_developer;
+extern sc_pref sc_main_help_about;
 
 // news
 const QString sc_main_news ("main_news");
-const sc_pref sc_main_news_release_notes (sc_main_news + ":release_notes", QKeySequence::UnknownKey);
-const sc_pref sc_main_news_community_news (sc_main_news + ":community_news", QKeySequence::UnknownKey);
+extern sc_pref sc_main_news_release_notes;
+extern sc_pref sc_main_news_community_news;
 
 // Tab handling
 // The following shortcuts are moved into a separate tab.  The key names
 // are not change for preserving compatibility with older versions
 const QString sc_edit_file ("editor_file");
 const QString sc_edit_file_cl (sc_edit_file + ":close");
-const sc_pref sc_edit_file_close (sc_edit_file_cl, QKeySequence::Close);
-const sc_pref sc_edit_file_close_all (sc_edit_file_cl + "_all", QKeySequence::UnknownKey);
-const sc_pref sc_edit_file_close_other (sc_edit_file_cl + "_other", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_file_close;
+extern sc_pref sc_edit_file_close_all;
+extern sc_pref sc_edit_file_close_other;
 const QString sc_edit_tabs ("editor_tabs");
-const sc_pref sc_edit_tabs_switch_left_tab (sc_edit_tabs + ":switch_left_tab", CTRL + Qt::Key_PageUp);
-const sc_pref sc_edit_tabs_switch_right_tab (sc_edit_tabs + ":switch_right_tab", CTRL + Qt::Key_PageDown);
-const sc_pref sc_edit_tabs_move_tab_left (sc_edit_tabs + ":move_tab_left", Qt::AltModifier + Qt::Key_PageUp);
-const sc_pref sc_edit_tabs_move_tab_right (sc_edit_tabs + ":move_tab_right", Qt::AltModifier + Qt::Key_PageDown);
+extern sc_pref sc_edit_tabs_switch_left_tab;
+extern sc_pref sc_edit_tabs_switch_right_tab;
+extern sc_pref sc_edit_tabs_move_tab_left;
+extern sc_pref sc_edit_tabs_move_tab_right;
 
 // Zooming
 const QString sc_edit_zoom ("editor_zoom"); // only a group name in the pref dialog
 const QString sc_edit_view ("editor_view");
 const QString sc_edit_view_zoom (sc_edit_view + ":zoom");
-const sc_pref sc_edit_view_zoom_in (sc_edit_view_zoom + "_in", QKeySequence::ZoomIn);
-const sc_pref sc_edit_view_zoom_out (sc_edit_view_zoom + "_out", QKeySequence::ZoomOut);
+extern sc_pref sc_edit_view_zoom_in;
+extern sc_pref sc_edit_view_zoom_out;
 #if defined (Q_OS_MAC)
-const sc_pref sc_edit_view_zoom_normal (sc_edit_view_zoom + "_normal", CTRL + Qt::Key_Underscore);
+extern sc_pref sc_edit_view_zoom_normal;
 #else
-const sc_pref sc_edit_view_zoom_normal (sc_edit_view_zoom + "_normal", CTRL + Qt::Key_Period);
+extern sc_pref sc_edit_view_zoom_normal;
 #endif
 
 // Actions of the editor
 
 // file
-const sc_pref sc_edit_file_edit_function (sc_edit_file + ":edit_function", CTRL + Qt::Key_E);
-const sc_pref sc_edit_file_save (sc_edit_file + ":save", QKeySequence::Save);
-const sc_pref sc_edit_file_save_as (sc_edit_file + ":save_as", QKeySequence::SaveAs);
-const sc_pref sc_edit_file_print (sc_edit_file + ":print", QKeySequence::Print);
+extern sc_pref sc_edit_file_edit_function;
+extern sc_pref sc_edit_file_save;
+extern sc_pref sc_edit_file_save_as;
+extern sc_pref sc_edit_file_print;
 
 // edit
 const QString sc_edit_find ("editor_find"); // only a group name in the pref dialog
 const QString sc_edit_edit ("editor_edit");
 const QString sc_edit_edit_find (sc_edit_edit + ":find");
-const sc_pref sc_edit_edit_redo (sc_edit_edit + ":redo", QKeySequence::Redo);
-const sc_pref sc_edit_edit_cut (sc_edit_edit + ":cut", QKeySequence::Cut);
-const sc_pref sc_edit_edit_find_replace (sc_edit_edit_find + "_replace", QKeySequence::Find);
-const sc_pref sc_edit_edit_find_next (sc_edit_edit_find + "_next", QKeySequence::FindNext);
-const sc_pref sc_edit_edit_find_previous (sc_edit_edit_find + "_previous", QKeySequence::FindPrevious);
-const sc_pref sc_edit_edit_delete_start_word (sc_edit_edit + ":delete_start_word", QKeySequence::DeleteStartOfWord);
-const sc_pref sc_edit_edit_delete_end_word (sc_edit_edit + ":delete_end_word", QKeySequence::DeleteEndOfWord);
-const sc_pref sc_edit_edit_delete_start_line (sc_edit_edit + ":delete_start_line", CTRL_SHIFT + Qt::Key_Backspace);
-const sc_pref sc_edit_edit_delete_end_line (sc_edit_edit + ":delete_end_line", CTRL_SHIFT + Qt::Key_Delete);
-const sc_pref sc_edit_edit_delete_line (sc_edit_edit + ":delete_line", CTRL_SHIFT + Qt::Key_L);
-const sc_pref sc_edit_edit_copy_line (sc_edit_edit + ":copy_line", CTRL_SHIFT + Qt::Key_C);
-const sc_pref sc_edit_edit_cut_line (sc_edit_edit + ":cut_line", CTRL_SHIFT + Qt::Key_X);
-const sc_pref sc_edit_edit_duplicate_selection (sc_edit_edit + ":duplicate_selection", CTRL + Qt::Key_D);
-const sc_pref sc_edit_edit_transpose_line (sc_edit_edit + ":transpose_line", CTRL + Qt::Key_T);
-const sc_pref sc_edit_edit_completion_list (sc_edit_edit + ":completion_list", CTRL + Qt::Key_Space);
+extern sc_pref sc_edit_edit_redo;
+extern sc_pref sc_edit_edit_cut;
+extern sc_pref sc_edit_edit_find_replace;
+extern sc_pref sc_edit_edit_find_next;
+extern sc_pref sc_edit_edit_find_previous;
+extern sc_pref sc_edit_edit_delete_start_word;
+extern sc_pref sc_edit_edit_delete_end_word;
+extern sc_pref sc_edit_edit_delete_start_line;
+extern sc_pref sc_edit_edit_delete_end_line;
+extern sc_pref sc_edit_edit_delete_line;
+extern sc_pref sc_edit_edit_copy_line;
+extern sc_pref sc_edit_edit_cut_line;
+extern sc_pref sc_edit_edit_duplicate_selection;
+extern sc_pref sc_edit_edit_transpose_line;
+extern sc_pref sc_edit_edit_completion_list;
 
-const sc_pref sc_edit_edit_comment_selection (sc_edit_edit + ":comment_selection", CTRL + Qt::Key_R);
-const sc_pref sc_edit_edit_uncomment_selection (sc_edit_edit + ":uncomment_selection", CTRL_SHIFT + Qt::Key_R);
-const sc_pref sc_edit_edit_comment_var_selection (sc_edit_edit + ":comment_var_selection", CTRL_ALT + Qt::Key_R);
-const sc_pref sc_edit_edit_upper_case (sc_edit_edit + ":upper_case", CTRL + Qt::Key_U);
-const sc_pref sc_edit_edit_lower_case (sc_edit_edit + ":lower_case", CTRL_ALT + Qt::Key_U);
+extern sc_pref sc_edit_edit_comment_selection;
+extern sc_pref sc_edit_edit_uncomment_selection;
+extern sc_pref sc_edit_edit_comment_var_selection;
+extern sc_pref sc_edit_edit_upper_case;
+extern sc_pref sc_edit_edit_lower_case;
 
 #if defined (Q_OS_MAC)
-const sc_pref sc_edit_edit_indent_selection (sc_edit_edit + ":indent_selection", PRE + Qt::Key_Tab);
-const sc_pref sc_edit_edit_unindent_selection (sc_edit_edit + ":unindent_selection", PRE + Qt::ShiftModifier + Qt::Key_Tab);
+extern sc_pref sc_edit_edit_indent_selection;
+extern sc_pref sc_edit_edit_unindent_selection;
 #else
-const sc_pref sc_edit_edit_indent_selection (sc_edit_edit + ":indent_selection", CTRL + Qt::Key_Tab);
-const sc_pref sc_edit_edit_unindent_selection (sc_edit_edit + ":unindent_selection", CTRL_SHIFT + Qt::Key_Tab);
+extern sc_pref sc_edit_edit_indent_selection;
+extern sc_pref sc_edit_edit_unindent_selection;
 #endif
-const sc_pref sc_edit_edit_smart_indent_line_or_selection (sc_edit_edit + ":smart_indent_line_or_selection", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_edit_smart_indent_line_or_selection;
 
-const sc_pref sc_edit_edit_conv_eol_winows (sc_edit_edit + ":conv_eol_winows", QKeySequence::UnknownKey);
-const sc_pref sc_edit_edit_conv_eol_unix (sc_edit_edit + ":conv_eol_unix", QKeySequence::UnknownKey);
-const sc_pref sc_edit_edit_conv_eol_mac (sc_edit_edit + ":conv_eol_mac", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_edit_conv_eol_winows;
+extern sc_pref sc_edit_edit_conv_eol_unix;
+extern sc_pref sc_edit_edit_conv_eol_mac;
 
-const sc_pref sc_edit_edit_goto_line (sc_edit_edit + ":goto_line", CTRL + Qt::Key_L);
-const sc_pref sc_edit_edit_move_to_brace (sc_edit_edit + ":move_to_brace", CTRL + Qt::Key_M);
-const sc_pref sc_edit_edit_select_to_brace (sc_edit_edit + ":select_to_brace", CTRL_SHIFT + Qt::Key_M);
-const sc_pref sc_edit_edit_toggle_bookmark (sc_edit_edit + ":toggle_bookmark", PRE + Qt::Key_F7);
-const sc_pref sc_edit_edit_next_bookmark (sc_edit_edit + ":next_bookmark", PRE + Qt::Key_F2);
-const sc_pref sc_edit_edit_previous_bookmark (sc_edit_edit + ":previous_bookmark", PRE + Qt::SHIFT + Qt::Key_F2);
-const sc_pref sc_edit_edit_remove_bookmark (sc_edit_edit + ":remove_bookmark", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_edit_goto_line;
+extern sc_pref sc_edit_edit_move_to_brace;
+extern sc_pref sc_edit_edit_select_to_brace;
+extern sc_pref sc_edit_edit_toggle_bookmark;
+extern sc_pref sc_edit_edit_next_bookmark;
+extern sc_pref sc_edit_edit_previous_bookmark;
+extern sc_pref sc_edit_edit_remove_bookmark;
 
-const sc_pref sc_edit_edit_preferences (sc_edit_edit + ":preferences", QKeySequence::UnknownKey);
-const sc_pref sc_edit_edit_styles_preferences (sc_edit_edit + ":styles_preferences", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_edit_preferences;
+extern sc_pref sc_edit_edit_styles_preferences;
 
 // view
-const sc_pref sc_edit_view_show_line_numbers (sc_edit_view + ":show_line_numbers", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_white_spaces (sc_edit_view + ":show_white_spaces", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_eol_chars (sc_edit_view + ":show_eol_chars", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_ind_guides (sc_edit_view + ":show_ind_guides", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_long_line (sc_edit_view + ":show_long_line", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_toolbar (sc_edit_view + ":show_toolbar", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_statusbar (sc_edit_view + ":show_statusbar", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_show_hscrollbar (sc_edit_view + ":show_hscrollbar", QKeySequence::UnknownKey);
-const sc_pref sc_edit_view_sort_tabs (sc_edit_view + ":sort_tabs", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_view_show_line_numbers;
+extern sc_pref sc_edit_view_show_white_spaces;
+extern sc_pref sc_edit_view_show_eol_chars;
+extern sc_pref sc_edit_view_show_ind_guides;
+extern sc_pref sc_edit_view_show_long_line;
+extern sc_pref sc_edit_view_show_toolbar;
+extern sc_pref sc_edit_view_show_statusbar;
+extern sc_pref sc_edit_view_show_hscrollbar;
+extern sc_pref sc_edit_view_sort_tabs;
 
 // debug
 const QString sc_edit_debug ("editor_debug");
-const sc_pref sc_edit_debug_toggle_breakpoint (sc_edit_debug + ":toggle_breakpoint", QKeySequence::UnknownKey);
-const sc_pref sc_edit_debug_next_breakpoint (sc_edit_debug + ":next_breakpoint", QKeySequence::UnknownKey);
-const sc_pref sc_edit_debug_previous_breakpoint (sc_edit_debug + ":previous_breakpoint", QKeySequence::UnknownKey);
-const sc_pref sc_edit_debug_remove_breakpoints (sc_edit_debug + ":remove_breakpoints", QKeySequence::UnknownKey);
+extern sc_pref sc_edit_debug_toggle_breakpoint;
+extern sc_pref sc_edit_debug_next_breakpoint;
+extern sc_pref sc_edit_debug_previous_breakpoint;
+extern sc_pref sc_edit_debug_remove_breakpoints;
 
 // run
 const QString sc_edit_run ("editor_run");
-const sc_pref sc_edit_run_run_file (sc_edit_run + ":run_file", PRE + Qt::Key_F5);
-const sc_pref sc_edit_run_run_selection (sc_edit_run + ":run_selection", PRE + Qt::Key_F9);
+extern sc_pref sc_edit_run_run_file;
+extern sc_pref sc_edit_run_run_selection;
 
 // help
 const QString sc_edit_help ("editor_help");
-const sc_pref sc_edit_help_help_keyword (sc_edit_help + ":help_keyword", QKeySequence::HelpContents);
-const sc_pref sc_edit_help_doc_keyword (sc_edit_help + ":doc_keyword", Qt::SHIFT + Qt::Key_F1);
+extern sc_pref sc_edit_help_help_keyword;
+extern sc_pref sc_edit_help_doc_keyword;
 
 
 // Documentation browser
 const QString sc_doc ("doc_browser");
-const sc_pref sc_doc_go_home (sc_doc + ":go_home", Qt::AltModifier + Qt::Key_Home);
-const sc_pref sc_doc_go_back (sc_doc + ":go_back", QKeySequence::Back);
-const sc_pref sc_doc_go_next (sc_doc + ":go_next", QKeySequence::Forward);
-const sc_pref sc_doc_bookmark (sc_doc + ":bookmark", CTRL + Qt::Key_D);
+extern sc_pref sc_doc_go_home;
+extern sc_pref sc_doc_go_back;
+extern sc_pref sc_doc_go_next;
+extern sc_pref sc_doc_bookmark;
 
 
 // Other normal, shortcut related options
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/gui-preferences.cc	Sun Dec 25 20:37:53 2022 -0500
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////
+//
+// 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-sc.h"
+#include "gui-preferences.h"
+
+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),
+    m_def_std (QKeySequence::UnknownKey)
+{
+  all_shortcut_preferences::insert (settings_key, *this);
+}
+
+sc_pref::sc_pref (const QString& description, const QString& settings_key,
+                  unsigned int def)
+  : m_description (description), m_settings_key (settings_key), m_def (def),
+    m_def_std (QKeySequence::UnknownKey)
+{
+  all_shortcut_preferences::insert (settings_key, *this);
+}
+
+sc_pref::sc_pref (const QString& description, const QString& settings_key,
+                  QKeySequence::StandardKey def_std)
+  : m_description (description), m_settings_key (settings_key), m_def (0),
+    m_def_std (def_std)
+{
+  all_shortcut_preferences::insert (settings_key, *this);
+}
+
+all_shortcut_preferences *all_shortcut_preferences::s_instance = nullptr;
+
+void all_shortcut_preferences::insert (const QString& settings_key,
+                                       const sc_pref& scpref)
+{
+  ensure_instance ();
+
+  s_instance->do_insert (settings_key, scpref);
+}
+
+void all_shortcut_preferences::do_insert (const QString& settings_key,
+                                          const sc_pref& scpref)
+{
+  m_hash.insert (settings_key, scpref);
+}
+
+void all_shortcut_preferences::ensure_instance (void)
+{
+  if (! s_instance)
+    s_instance = new all_shortcut_preferences ();
+}
--- a/libgui/src/gui-preferences.h	Sun Dec 25 16:11:47 2022 -0500
+++ b/libgui/src/gui-preferences.h	Sun Dec 25 20:37:53 2022 -0500
@@ -60,32 +60,85 @@
 
 const QString sc_group ("shortcuts/");  // group name is handled separately
 
-struct sc_pref
+class sc_pref
 {
-  sc_pref (const QString& key_arg, Qt::Key def_arg)
-    : key (key_arg), def (static_cast<unsigned int> (def_arg)),
-      def_std (QKeySequence::UnknownKey)
-  { }
+public:
+
+  // Default constructed sc_pref objects are invalid, but we need this
+  // to create QHash objects that contain sc_pref objects.  No invalid
+  // sc_pref objects should acutally be used.
+
+  sc_pref (void) = default;
+
+  sc_pref (const QString& description, const QString& settings_key,
+           Qt::Key def);
+
+  sc_pref (const QString& description_arg, const QString& settings_key,
+           unsigned int def);
+
+  sc_pref (const QString& description_arg, const QString& settings_key,
+           QKeySequence::StandardKey def_std);
+
+  sc_pref (const sc_pref&) = default;
+
+  sc_pref& operator = (const sc_pref&) = default;
+
+  ~sc_pref (void) = default;
+
+  QString description (void) const { return m_description; }
 
-  sc_pref (const QString& key_arg, unsigned int def_arg)
-    : key (key_arg), def (def_arg), def_std (QKeySequence::UnknownKey)
-  { }
+  QString settings_key (void) const { return m_settings_key; }
+
+  unsigned int def (void) const { return m_def; }
+
+  QKeySequence::StandardKey def_std (void) const { return m_def_std; }
+
+private:
+
+  // Description of the shortcut.
+  QString m_description;
+
+  // The settings key name.
+  QString m_settings_key;
 
-  sc_pref (const QString& key_arg, QKeySequence::StandardKey def_std_arg)
-    : key (key_arg), def (0), def_std (def_std_arg)
-  { }
+  // The default as key.
+  unsigned int m_def;
+
+  // The default as standard key.
+  QKeySequence::StandardKey m_def_std;
+};
+
+// FIXME: Is there a better/more modern way to manage this data than to
+// have this style of singleton class?
+
+class all_shortcut_preferences
+{
+public:
+
+  all_shortcut_preferences (void) = default;
 
   // No copying!
 
-  sc_pref (const sc_pref&) = delete;
+  all_shortcut_preferences (const all_shortcut_preferences&) = delete;
 
-  sc_pref& operator = (const sc_pref&) = delete;
+  all_shortcut_preferences&
+  operator = (const all_shortcut_preferences&) = delete;
+
+  ~all_shortcut_preferences (void) = default;
+
+  static void insert (const QString& settings_key, const sc_pref& scpref);
 
-  ~sc_pref (void) = default;
+private:
+
+  // Map from shortcut identifier (settings key) to sc_pref object.
+  QHash <QString, sc_pref> m_hash;
 
-  const QString key;                        // the key name
-  const unsigned int def;                   // the default as key
-  const QKeySequence::StandardKey def_std;  // the default as standard key
+  void do_insert (const QString& settings_key, const sc_pref& scpref);
+
+  static void ensure_instance (void);
+
+  // Map from shortcut identifier (settings key) to sc_pref object.
+  static all_shortcut_preferences *s_instance;
 };
 
 #endif
--- a/libgui/src/gui-settings.cc	Sun Dec 25 16:11:47 2022 -0500
+++ b/libgui/src/gui-settings.cc	Sun Dec 25 20:37:53 2022 -0500
@@ -116,26 +116,27 @@
     setValue (pref.key + settings_color_modes_ext[m], QVariant (color));
   }
 
-  QString gui_settings::sc_value (const sc_pref& pref) const
+  QString gui_settings::sc_value (const sc_pref& scpref) const
   {
-    QKeySequence key_seq = sc_def_value (pref);
+    QKeySequence key_seq = sc_def_value (scpref);
 
     // Get the value from the settings where the key sequences are stored
     // as strings
-    return value (sc_group + pref.key, key_seq.toString ()).toString ();
+    return value (sc_group + scpref.settings_key (),
+                  key_seq.toString ()).toString ();
   }
 
-  QKeySequence gui_settings::sc_def_value (const sc_pref& pref) const
+  QKeySequence gui_settings::sc_def_value (const sc_pref& scpref) const
   {
     QKeySequence key_seq = QKeySequence ();
 
     // Check, which of the elements for the default value in the sc_pref
     // structure has a valid value and take this as default.  If both
     // elements are not valid, leave the key sequence empty
-    if (pref.def)
-      key_seq = QKeySequence (pref.def);
-    else if (pref.def_std != QKeySequence::UnknownKey)
-      key_seq = QKeySequence (pref.def_std);
+    if (scpref.def ())
+      key_seq = QKeySequence (scpref.def ());
+    else if (scpref.def_std () != QKeySequence::UnknownKey)
+      key_seq = QKeySequence (scpref.def_std ());
 
     return key_seq;
   }
@@ -155,7 +156,8 @@
     if (! shortcut.isEmpty ())
       action->setShortcut (QKeySequence (shortcut));
     else
-      qDebug () << "Key: " << scpref.key << " not found in settings";
+      qDebug () << "Key: " << scpref.settings_key ()
+                << " not found in settings";
   }
 
   void gui_settings::shortcut (QShortcut *sc, const sc_pref& scpref)
@@ -165,7 +167,8 @@
     if (! shortcut.isEmpty ())
       sc->setKey (QKeySequence (shortcut));
     else
-      qDebug () << "Key: " << scpref.key << " not found in settings";
+      qDebug () << "Key: " << scpref.settings_key ()
+                << " not found in settings";
   }
 
   void gui_settings::config_icon_theme (void)
@@ -257,8 +260,8 @@
     // Use hard coded default on macOS, since selection of fixed width
     // default font is unreliable (see bug #59128).
     // Test for macOS default fixed width font
-    if (fonts.contains (global_mono_font.def.toString ()))
-      default_family = global_mono_font.def.toString ();
+    if (fonts.contains (global_mono_font.def ().toString ()))
+      default_family = global_mono_font.def ().toString ();
 #endif
 
     // If default font is still empty (on all other platforms or
--- a/libgui/src/module.mk	Sun Dec 25 16:11:47 2022 -0500
+++ b/libgui/src/module.mk	Sun Dec 25 20:37:53 2022 -0500
@@ -410,6 +410,8 @@
   %reldir%/external-editor-interface.cc \
   %reldir%/files-dock-widget.cc \
   %reldir%/graphics-init.cc \
+  %reldir%/gui-preferences-sc.cc \
+  %reldir%/gui-preferences.cc \
   %reldir%/gui-settings.cc \
   %reldir%/history-dock-widget.cc \
   %reldir%/interpreter-qobject.cc \
--- a/libgui/src/shortcut-manager.cc	Sun Dec 25 16:11:47 2022 -0500
+++ b/libgui/src/shortcut-manager.cc	Sun Dec 25 20:37:53 2022 -0500
@@ -588,7 +588,7 @@
     // append the new shortcut to the list
     shortcut_t shortcut_info;
     shortcut_info.m_description = description;
-    shortcut_info.m_settings_key = sc.key;
+    shortcut_info.m_settings_key = sc.settings_key ();
     shortcut_info.m_actual_sc = actual;
     shortcut_info.m_default_sc = settings.sc_def_value (sc);
     m_sc << shortcut_info;
@@ -600,7 +600,7 @@
     // check whether ctrl+d is used from main window, i.e. is a global shortcut
     QString main_group_prefix
       = sc_main_file.mid (0, sc_main_file.indexOf ('_') + 1);
-    if (sc.key.startsWith (main_group_prefix)
+    if (sc.settings_key ().startsWith (main_group_prefix)
         && actual == QKeySequence (Qt::ControlModifier+Qt::Key_D))
       settings.setValue (sc_main_ctrld.key, true);
   }