Mercurial > octave
annotate libgui/src/gui-preferences.h @ 31640:e518e1f7e944
Backed out changeset 34c3cd39c4b9
Revert change because there is code that uses gui_pref.ignore, but
only on MAC_OS: global_use_native_dialogs in
gui-preferences-global.h. Are there others?
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 05 Dec 2022 10:17:17 -0500 |
parents | 34c3cd39c4b9 |
children | 5749674b826e |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3 // Copyright (C) 2017-2022 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 |
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
29 #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
|
30 #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
|
31 #include <QTabWidget> |
27271
a4416cd6bb4f
Append name of actual encoding used if "SYSTEM" is selected.
Markus Mützel <markus.muetzel@gmx.de>
parents:
27055
diff
changeset
|
32 #include <QTextCodec> |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
33 #include <QVariant> |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
34 |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
35 // 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
|
36 |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
37 struct gui_pref |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
38 { |
31640
e518e1f7e944
Backed out changeset 34c3cd39c4b9
John W. Eaton <jwe@octave.org>
parents:
31637
diff
changeset
|
39 gui_pref (const QString& key_arg, const QVariant& def_arg, |
e518e1f7e944
Backed out changeset 34c3cd39c4b9
John W. Eaton <jwe@octave.org>
parents:
31637
diff
changeset
|
40 const bool ignore_arg = false) |
e518e1f7e944
Backed out changeset 34c3cd39c4b9
John W. Eaton <jwe@octave.org>
parents:
31637
diff
changeset
|
41 : key (key_arg), def (def_arg), ignore (ignore_arg) |
27559
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
42 { } |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
43 |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
44 // No copying! |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
45 |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
46 gui_pref (const gui_pref&) = delete; |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
47 |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
48 gui_pref& operator = (const gui_pref&) = delete; |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
49 |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
50 ~gui_pref (void) = default; |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
51 |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
52 const QString key; // the key name |
cd1c819350aa
declare gui_pref data members const
John W. Eaton <jwe@octave.org>
parents:
27558
diff
changeset
|
53 const QVariant def; // the default value |
31640
e518e1f7e944
Backed out changeset 34c3cd39c4b9
John W. Eaton <jwe@octave.org>
parents:
31637
diff
changeset
|
54 const bool ignore; // when true, ignore, i.e. always take default |
25617
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
55 }; |
44d638d5eea5
reorganize constants for preferences keys and default values
Torsten <mttl@mailbox.org>
parents:
25443
diff
changeset
|
56 |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
57 // 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
|
58 // 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
|
59 // 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
|
60 |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27724
diff
changeset
|
61 const QString sc_group ("shortcuts/"); // group name is handled separately |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27724
diff
changeset
|
62 |
27724
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
63 struct sc_pref |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
64 { |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
65 sc_pref (const QString& key_arg, Qt::Key def_arg) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
66 : key (key_arg), def (static_cast<unsigned int> (def_arg)), |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
67 def_std (QKeySequence::UnknownKey) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
68 { } |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
69 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
70 sc_pref (const QString& key_arg, unsigned int def_arg) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
71 : key (key_arg), def (def_arg), def_std (QKeySequence::UnknownKey) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
72 { } |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
73 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
74 sc_pref (const QString& key_arg, QKeySequence::StandardKey def_std_arg) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
75 : key (key_arg), def (0), def_std (def_std_arg) |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
76 { } |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
77 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
78 // No copying! |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
79 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
80 sc_pref (const sc_pref&) = delete; |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
81 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
82 sc_pref& operator = (const sc_pref&) = delete; |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
83 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
84 ~sc_pref (void) = default; |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
85 |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
86 const QString key; // the key name |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
87 const unsigned int def; // the default as key |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
88 const QKeySequence::StandardKey def_std; // the default as standard key |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
89 }; |
19e80f22aa47
provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27671
diff
changeset
|
90 |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
91 #endif |