annotate libgui/src/shortcut-manager.h @ 21203:710e700cdd7f

maint: Clean up naming and indentation of #ifdef blocks in libgui Rename guard #ifdef names to use octave_ namespace prefix and file name. Indent #ifdef blocks. * Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc, TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h, annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h, color-picker.cc, color-picker.h, dialog.cc, documentation-dock-widget.cc, documentation-dock-widget.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, find-files-model.cc, find-files-model.h, history-dock-widget.cc, history-dock-widget.h, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, octave-qscintilla.cc, octave-txt-lexer.cc, main-window.cc, octave-cmd.cc, octave-dock-widget.cc, octave-gui.cc, octave-interpreter.cc, octave-interpreter.h, octave-qt-link.cc, octave-qt-link.h, parser.cc, webinfo.cc, resource-manager.cc, resource-manager.h, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h, terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-view.cc: Clean up naming and indentation of #ifdef blocks in libgui.
author Rik <rik@octave.org>
date Sat, 06 Feb 2016 07:32:37 -0800
parents 9d9270e2f98f
children 6c2fd62db1f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
1 /*
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19664
diff changeset
3 Copyright (C) 2014-2015 Torsten <ttl@justmail.de>
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
4
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
5 This file is part of Octave.
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
6
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
10 option) any later version.
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
11
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
15 for more details.
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
16
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
20
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
21 */
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
22
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
23 #if ! defined (octave_shortcut_manager_h)
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
24 #define octave_shortcut_manager_h 1
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
25
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
26 #include <QWidget>
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
27 #include <QTreeWidget>
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
28 #include <QLineEdit>
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
29 #include <QKeyEvent>
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
30 #include <QLabel>
18656
1b289f45187f add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents: 18611
diff changeset
31 #include <QSettings>
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
32
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
33 class enter_shortcut : public QLineEdit
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
34 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
35 Q_OBJECT
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
36
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
37 public:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
38 enter_shortcut (QWidget *p = 0);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
39 ~enter_shortcut ();
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
40
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
41 virtual void keyPressEvent (QKeyEvent *e);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
42
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
43 public slots:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
44 void handle_direct_shortcut (int);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
45
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
46 private:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
47 bool _direct_shortcut;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
48
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
49 };
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
50
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
51
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
52 class shortcut_manager : public QWidget
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
53 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
54 Q_OBJECT
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
55
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
56 public:
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
57
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
58 enum
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
59 {
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
60 OSC_IMPORT = 0,
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
61 OSC_EXPORT = 1,
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
62 OSC_DEFAULT = 2
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
63 };
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
64
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
65 shortcut_manager ();
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
66 ~shortcut_manager ();
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
67
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
68 static void init_data ()
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
69 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
70 if (instance_ok ())
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
71 instance->do_init_data ();
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
72 }
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
73
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
74 static void write_shortcuts (QSettings *settings, bool closing)
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
75 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
76 if (instance_ok ())
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
77 instance->do_write_shortcuts (settings, closing);
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
78 }
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
79
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
80 static void set_shortcut (QAction *action, const QString& key)
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
81 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
82 if (instance_ok ())
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
83 instance->do_set_shortcut (action, key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
84 }
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
85
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
86 static void fill_treewidget (QTreeWidget *tree_view)
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
87 {
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
88 if (instance_ok ())
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
89 instance->do_fill_treewidget (tree_view);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
90 }
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
91
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
92 static void import_export (int action)
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18728
diff changeset
93 {
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18728
diff changeset
94 if (instance_ok ())
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
95 instance->do_import_export (action);
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18728
diff changeset
96 }
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18728
diff changeset
97
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
98 public slots:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
99
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
100 signals:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
101
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
102 protected:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
103
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
104 protected slots:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
105
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
106 void handle_double_clicked (QTreeWidgetItem*, int);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
107 void shortcut_dialog_finished (int);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
108 void shortcut_dialog_set_default ();
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
109
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
110 private:
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
111
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
112 static shortcut_manager *instance;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
113 static void cleanup_instance (void) { delete instance; instance = 0; }
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
114
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
115 // No copying!
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
116
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
117 shortcut_manager (const shortcut_manager&);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
118 shortcut_manager& operator = (const shortcut_manager&);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
119
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
120 static bool instance_ok (void);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
121
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
122 void init (QString, QString, QKeySequence);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
123 void do_init_data ();
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
124 void do_write_shortcuts (QSettings *settings, bool closing);
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
125 void do_set_shortcut (QAction *action, const QString& key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
126 void do_fill_treewidget (QTreeWidget *tree_view);
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
127 bool do_import_export (int action);
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
128 void shortcut_dialog (int);
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
129 void import_shortcuts (QSettings *settings);
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
130 bool overwrite_all_shortcuts (void);
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
131
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
132 class shortcut_t
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
133 {
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
134 public:
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
135
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
136 shortcut_t (void)
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
137 : tree_item (0), description (), settings_key (),
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
138 actual_sc (QKeySequence ()), default_sc (QKeySequence ())
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
139 { }
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
140
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
141 shortcut_t (const shortcut_t& x)
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
142 : tree_item (x.tree_item), description (x.description),
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
143 settings_key (x.settings_key)
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
144 {
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
145 actual_sc = x.actual_sc;
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
146 default_sc = x.default_sc;
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
147 }
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
148
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
149 shortcut_t& operator = (const shortcut_t& x)
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
150 {
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
151 if (&x != this)
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
152 {
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
153 tree_item = x.tree_item;
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
154 description = x.description;
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
155 settings_key = x.settings_key;
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
156
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
157 actual_sc = QKeySequence ();
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
158 default_sc = QKeySequence ();
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
159
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
160 actual_sc = x.actual_sc;
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
161 default_sc = x.default_sc;
19783
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
162 }
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
163
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
164 return *this;
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
165 }
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
166
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
167 ~shortcut_t (void)
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
168 {
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
169 }
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
170
2dd6d5bdf11d avoid warnings about arrays in structure from GCC
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
171 QTreeWidgetItem *tree_item;
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
172 QString description;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
173 QString settings_key;
20685
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
174 QKeySequence actual_sc;
be130eb147f8 provide only one set of gui shortcuts at a time
Torsten <ttl@justmail.de>
parents: 20181
diff changeset
175 QKeySequence default_sc;
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
176 };
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
177
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
178 QList<shortcut_t> _sc;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
179 QHash<QString, int> _shortcut_hash;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
180 QHash<QString, int> _action_hash;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
181 QHash <QString, QTreeWidgetItem*> _level_hash;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
182 QHash<int, QTreeWidgetItem*> _index_item_hash;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
183 QHash<QTreeWidgetItem*, int> _item_index_hash;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
184
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
185 QDialog *_dialog;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
186 enter_shortcut *_edit_actual;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
187 QLabel *_label_default;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
188 int _handled_index;
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
189
18656
1b289f45187f add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents: 18611
diff changeset
190 QSettings *_settings;
1b289f45187f add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents: 18611
diff changeset
191
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
192 };
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
193
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
diff changeset
194
20945
9d9270e2f98f eliminate comments after preprocessor conditionals
John W. Eaton <jwe@octave.org>
parents: 20702
diff changeset
195 #endif