Mercurial > octave
annotate libgui/src/gui-preferences.h @ 32051:17a09d2bbe0f
gui: Remove usage of QTextCodec from some more places.
* libgui/src/gui-preference.h: Remove unused header.
* libgui/src/octave-qobject.cc: Include header only if function from it are
used.
* m4/acinclude.m4: Do not require Qt6Core5Compat on platforms that don't need
it.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 23 Apr 2023 11:08:16 +0200 |
parents | febd82d1a8de |
children | 2e484f9f1f18 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
3 // Copyright (C) 2017-2023 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
25 |
27413
b67e5dc2e34a
use consistent naming pattern for include file guards in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
26 #if ! defined (octave_gui_preferences_h) |
b67e5dc2e34a
use consistent naming pattern for include file guards in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
27 #define octave_gui_preferences_h 1 |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
28 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
29 #include "octave-config.h" |
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
30 |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
31 #include <QStringList> |
27055
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26376
diff
changeset
|
32 #include <QStyle> |
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26376
diff
changeset
|
33 #include <QTabWidget> |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
34 #include <QVariant> |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
35 |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
36 // FIXME: Would it be possible/make sense to merge gui_pref and sc_pref |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
37 // into a single class or to at least have them derived from a common |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
38 // base class so we could have one global hash table that contains all |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
39 // of them? |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
40 |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
41 // Structure for the definition of pairs: key and default value |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
42 |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
43 class gui_pref |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
44 { |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
45 public: |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
46 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
47 // Default constructed gui_pref objects are invalid, but we need this |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
48 // to create QHash objects that contain gui_pref objects. No invalid |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
49 // gui_pref objects should acutally be used. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
50 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
51 gui_pref () = default; |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
52 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
53 gui_pref (const QString& settings_key, const QVariant& def, |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
54 bool ignore = false); |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
55 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
56 gui_pref (const gui_pref&) = default; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
57 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
58 gui_pref& operator = (const gui_pref&) = default; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
59 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
60 ~gui_pref () = default; |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
61 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
62 QString settings_key () const { return m_settings_key; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
63 QVariant def () const { return m_def; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
64 bool ignore () const { return m_ignore; } |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
65 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
66 private: |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
67 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
68 // The settings key name. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
69 QString m_settings_key; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
70 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
71 // The default value. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
72 QVariant m_def; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
73 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
74 // TRUE means always take the default. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
75 bool m_ignore; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
76 }; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
77 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
78 // FIXME: Is there a better/more modern way to manage this data than to |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
79 // have this style of singleton class? |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
80 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
81 // Allow lookup of gui_pref objects when we don't know the name at |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
82 // compile time. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
83 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
84 class all_gui_preferences |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
85 { |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
86 public: |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
87 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
88 all_gui_preferences () = default; |
27559
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
89 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
90 OCTAVE_DISABLE_COPY_MOVE (all_gui_preferences) |
27559
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
91 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
92 ~all_gui_preferences () = default; |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
93 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
94 static void insert (const QString& settings_key, const gui_pref& pref); |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
95 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
96 static const gui_pref value (const QString& settings_key); |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
97 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
98 static QStringList keys (); |
27559
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
99 |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
100 private: |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
101 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
102 // Map from shortcut identifier (settings key) to gui_pref object. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
103 QHash <QString, gui_pref> m_hash; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
104 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
105 void do_insert (const QString& settings_key, const gui_pref& pref); |
27559
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
106 |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
107 const gui_pref do_value (const QString& settings_key) const; |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
108 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
109 QStringList do_keys () const; |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
110 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
111 static void ensure_instance (); |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
112 |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
113 // Map from shortcut identifier (settings key) to sc_pref object. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
114 static all_gui_preferences *s_instance; |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
115 }; |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
116 |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
117 // The version for shortcuts, where the default value is stored as a |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
118 // combination of Qt:Keys (resutling in an unsigend int, when added) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
119 // or as one of the predefined standard key sequences. |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
120 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
121 class sc_pref |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
122 { |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
123 public: |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
124 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
125 // Default constructed sc_pref objects are invalid, but we need this |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
126 // to create QHash objects that contain sc_pref objects. No invalid |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
127 // sc_pref objects should acutally be used. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
128 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
129 sc_pref () = default; |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
130 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
131 sc_pref (const QString& description, const QString& settings_key, |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
132 Qt::Key def); |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
133 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
134 sc_pref (const QString& description_arg, const QString& settings_key, |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
135 unsigned int def); |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
136 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
137 sc_pref (const QString& description_arg, const QString& settings_key, |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
138 QKeySequence::StandardKey def_std); |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
139 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
140 sc_pref (const sc_pref&) = default; |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
141 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
142 sc_pref& operator = (const sc_pref&) = default; |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
143 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
144 ~sc_pref () = default; |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
145 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
146 QString description () const { return m_description; } |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
147 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
148 QString settings_key () const { return m_settings_key; } |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
149 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
150 unsigned int def () const { return m_def; } |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
151 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
152 QKeySequence::StandardKey def_std () const { return m_def_std; } |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
153 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
154 QKeySequence def_value () const; |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
155 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
156 QString def_text () const; |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
157 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
158 private: |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
159 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
160 // Description of the shortcut. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
161 QString m_description; |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
162 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
163 // The settings key name. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
164 QString m_settings_key; |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
165 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
166 // The default as key. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
167 unsigned int m_def; |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
168 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
169 // The default as standard key. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
170 QKeySequence::StandardKey m_def_std; |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
171 }; |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
172 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
173 // FIXME: Is there a better/more modern way to manage this data than to |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
174 // have this style of singleton class? |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
175 |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
176 // Allow lookup of sc_pref objects when we don't know the name at |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
177 // compile time. |
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31696
diff
changeset
|
178 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
179 class all_shortcut_preferences |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
180 { |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
181 public: |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
182 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
183 all_shortcut_preferences () = default; |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
184 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
185 OCTAVE_DISABLE_COPY_MOVE (all_shortcut_preferences) |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
186 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
187 ~all_shortcut_preferences () = default; |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
188 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
189 static void insert (const QString& settings_key, const sc_pref& scpref); |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
190 |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
191 static const sc_pref value (const QString& settings_key); |
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
192 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
193 static QStringList keys (); |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
194 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
195 private: |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
196 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
197 // Map from shortcut identifier (settings key) to sc_pref object. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
198 QHash <QString, sc_pref> m_hash; |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
199 |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
200 void do_insert (const QString& settings_key, const sc_pref& scpref); |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
201 |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
202 const sc_pref do_value (const QString& settings_key) const; |
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
203 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
204 QStringList do_keys () const; |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31695
diff
changeset
|
205 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
206 static void ensure_instance (); |
31695
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
207 |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
208 // Map from shortcut identifier (settings key) to sc_pref object. |
5749674b826e
store constant shortcut data in global QHash object
John W. Eaton <jwe@octave.org>
parents:
31640
diff
changeset
|
209 static all_shortcut_preferences *s_instance; |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
210 }; |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
211 |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
212 #endif |