annotate libgui/src/gui-settings.h @ 31638:474e184321d3

move some functions from resource_manager to gui_settings * gui-settings.h, gui-settings.cc (gui_settings::get_default_font_family, gui_settings::get_default_font, gui_settings::reload, gui_settings::check): Rename and move here from resource-manager.h and resource-manager.cc. Change all uses. * resource-manager.h, resource-manager.cc (resource_manager::is_first_run): Delete. * gui-preferences-global.h (global_skip_welcome_wizard): New gui_pref object. * main-window.cc (main_window::main_window): Check this setting to determine whether to display welcome wizard.
author John W. Eaton <jwe@octave.org>
date Sun, 04 Dec 2022 22:56:23 -0500
parents 34c3cd39c4b9
children e518e1f7e944
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
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 namespace octave
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 {
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:
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
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 { }
351a4c8e92c3 provide default constructor for gui_settings
John W. Eaton <jwe@octave.org>
parents: 31558
diff changeset
49
27611
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;
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
71
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;
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
75
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 {
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
78 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
79 }
27724
19e80f22aa47 provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
80
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
81 /*!
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
82 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
83 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
84 @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
85 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
86 \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
87 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
88 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
89 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
90 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
91 \f}
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
92
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
93 @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
94 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
95 @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
96
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
97 @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
98 */
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
99 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
100
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
101 /*!
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
102 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
103 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
104 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
105 the lightness (see get_color_value())
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
106
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
107 @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
108 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
109 @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
110
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
111 @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
112 */
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
113 QColor color_value (const gui_pref& pref, int mode = 0) const;
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
114
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 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
117 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
118 extension related to the mode is appended to the settings key string
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
119
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
120 @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
121 @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
122 @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
123
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
124 */
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
125 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
126 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
127
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
128 QString sc_value (const sc_pref& pref) const;
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
129
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27724
diff changeset
130 QKeySequence sc_def_value (const sc_pref& pref) const;
27724
19e80f22aa47 provide structure and settings value method for shortcut key sequences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
131
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
132 // 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
133 // 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
134 // 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
135 // 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
136 // 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
137 // 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
138 // 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
139 // 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
140 // Hmm.
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
141
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
142 void config_icon_theme (void);
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
143
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31612
diff changeset
144 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
145 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
146
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
147 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
148
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
149 QStringList get_default_font (void);
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
150
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
151 void reload (void);
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
152
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
153 private:
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
154
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31637
diff changeset
155 void check (void);
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 };
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29358
diff changeset
157
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 }
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159
31558
69c8979f8b2c fix missing trnaslation for new strings in settings dialog (bug #63404)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31304
diff changeset
160 // 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
161 // 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
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 // 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
164 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
165 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
166 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
167
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 #endif
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169