annotate libgui/src/gui-settings.h @ 31649:deb553ac2c54

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Dec 2022 15:45:27 -0500
parents 431f80aba37a 29d734430e5f
children 1a1f47f17ed4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 30398
diff changeset
3 // Copyright (C) 2019-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 ////////////////////////////////////////////////////////////////////////
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_gui_settings_h)
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_gui_settings_h 1
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
29 #include <QIcon>
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
30 #include <QString>
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <QSettings>
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
33 #include "gui-preferences.h"
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
34
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
35 OCTAVE_BEGIN_NAMESPACE(octave)
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
36
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 class gui_settings : public QSettings
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 {
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
39 Q_OBJECT
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
40
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 public:
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
42
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
43 // Location, name, and format of settings file determined by
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
44 // settings in qt_application class construtor.
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
45
31612
351a4c8e92c3 provide default constructor for gui_settings
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
46 gui_settings (QObject *parent = nullptr)
351a4c8e92c3 provide default constructor for gui_settings
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
47 : QSettings (parent)
351a4c8e92c3 provide default constructor for gui_settings
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
48 { }
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 gui_settings (const QString& file_name, QSettings::Format format,
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 QObject *parent = nullptr)
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 : QSettings (file_name, format, parent)
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 { }
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 gui_settings (QSettings::Format format, QSettings::Scope scope,
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 const QString& organization,
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 const QString& application = QString (),
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 QObject *parent = nullptr)
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 : QSettings (format, scope, organization, application, parent)
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 { }
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 // No copying!
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 gui_settings (const gui_settings&) = delete;
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 gui_settings& operator = (const gui_settings&) = delete;
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 ~gui_settings (void) = default;
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
69
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
70 QString file_name (void) const;
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
72 QString directory_name (void) const;
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
73
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
74 using QSettings::value;
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
76 QVariant value (const gui_pref& pref) const
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
77 {
28497
2813ac10ca1e force non-native file dialogs on Mac ignoring current user pref (bug #52840)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
78 if (pref.ignore)
2813ac10ca1e force non-native file dialogs on Mac ignoring current user pref (bug #52840)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
79 return pref.def; // ignore the current pref and always use default
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
80
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
81 return value (pref.key, pref.def);
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
82 }
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
83
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
84 /*!
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
85 Reading a color from the given QVaraitn @p def taking different
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
86 color modes into account. The default value for a second color mode
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
87 @p mode=1 is deterimined from the standard default value @p mode=0
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
88 by inverting the lightness
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
89 \f{eqnarray*}{
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
90 H_1 &=& H_0\\
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
91 S_1 &=& S_0\\
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
92 L_1 &=& 1.0 - 0.85 L_0 L_0 > 0.3
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
93 L_1 &=& 1.0 - 0.70 L_0 L_0 < 0.3
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
94 \f}
27724
19e80f22aa47 provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
95
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
96 @param def Color default value given by a QVariant of QColor
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
97 or QPalette::ColorRole
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
98 @param mode Color mode (currently 0 or 1, default is 0)
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
99
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
100 @return Color as QColor
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
101 */
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
102 QColor get_color_value (const QVariant& def, int mode = 0) const;
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
103
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
104 /*!
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
105 Reading a color from the gui_settings taking possible color modes
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
106 into account. The default value for a second color mode @p mode=1 is
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
107 deterimined from the standard default value @p mode=0 by inverting
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
108 the lightness (see get_color_value())
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
109
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
110 @param pref gui preference (key string, default value); the default
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
111 value can be given by QColor or QPalette::ColorRole
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
112 @param mode Color mode (currently 0 or 1, default is 0)
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
113
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
114 @return Color as QColor
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
115 */
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
116 QColor color_value (const gui_pref& pref, int mode = 0) const;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
117
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
118 /*!
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
119 Writing a color to the gui_settings taking possible color modes
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
120 into account. When @p mode is not zero (standard mode), the
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
121 extension related to the mode is appended to the settings key string
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
122
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
123 @param pref gui preference where the color should be written
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
124 @param color QColor to write to the settings
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
125 @param mode Color mode (currently 0 or 1, default is 0)
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
126
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
127 */
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
128 void set_color_value (const gui_pref& pref, const QColor& color,
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
129 int mode = 0);
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
130
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
131 QString sc_value (const sc_pref& pref) const;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
132
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
133 QKeySequence sc_def_value (const sc_pref& pref) const;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
134
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
135 // config_icon_theme, icon, get_default_font_family,
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
136 // get_default_font, and possibly reload and check could be global
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
137 // functions instead of member functions. But at least for the icon
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
138 // function, defining it as a member function means that we can
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
139 // create a single gui_settings object and access multiple icon
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
140 // objects rather than having to create a separate settings object
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
141 // each time that an icon is needed. OTOH, creating the base
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
142 // QSettings object is supposed to be fast, so that may not matter.
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
143 // Hmm.
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
144
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
145 void config_icon_theme (void);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
146
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
147 QIcon icon (const QString& icon_name, bool octave_only = false,
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
148 const QString& icon_alt_name = QString ());
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
149
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
150 QString get_default_font_family (void);
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
151
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
152 QStringList get_default_font (void);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
153
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
154 void reload (void);
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
155
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
156 private:
27724
19e80f22aa47 provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
157
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
158 void check (void);
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 };
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
160
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
161 OCTAVE_END_NAMESPACE(octave)
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
31558
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
163 // Some constants used in the preferences of several widgets and therefore
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
164 // defined globally here
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
165
31558
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
166 // Constants for handling different color schemes
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
167 const QColor settings_color_no_change (255, 0, 255);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
168 const QStringList settings_color_modes_ext (QStringList () << "" << "_2");
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
169 const int settings_reload_default_colors_flag = -1;
31558
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
170
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 #endif
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172