comparison 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
comparison
equal deleted inserted replaced
31637:34c3cd39c4b9 31638:474e184321d3
38 { 38 {
39 Q_OBJECT 39 Q_OBJECT
40 40
41 public: 41 public:
42 42
43 // Location, name, and format of settings file determined by
44 // settings in qt_application class construtor.
45
43 gui_settings (QObject *parent = nullptr) 46 gui_settings (QObject *parent = nullptr)
44 : QSettings (parent) 47 : QSettings (parent)
45 { } 48 { }
46 49
47 gui_settings (const QString& file_name, QSettings::Format format, 50 gui_settings (const QString& file_name, QSettings::Format format,
61 gui_settings (const gui_settings&) = delete; 64 gui_settings (const gui_settings&) = delete;
62 65
63 gui_settings& operator = (const gui_settings&) = delete; 66 gui_settings& operator = (const gui_settings&) = delete;
64 67
65 ~gui_settings (void) = default; 68 ~gui_settings (void) = default;
69
70 QString file_name (void) const;
71
72 QString directory_name (void) const;
66 73
67 using QSettings::value; 74 using QSettings::value;
68 75
69 QVariant value (const gui_pref& pref) const 76 QVariant value (const gui_pref& pref) const
70 { 77 {
120 127
121 QString sc_value (const sc_pref& pref) const; 128 QString sc_value (const sc_pref& pref) const;
122 129
123 QKeySequence sc_def_value (const sc_pref& pref) const; 130 QKeySequence sc_def_value (const sc_pref& pref) const;
124 131
125 // Both config_icon_theme and icon could be global functions instead 132 // config_icon_theme, icon, get_default_font_family,
126 // of member functions. But at least for the icon function, 133 // get_default_font, and possibly reload and check could be global
127 // defining it as a member function means that we can create a 134 // functions instead of member functions. But at least for the icon
128 // single gui_settings object and access multiple icon objects 135 // function, defining it as a member function means that we can
129 // rather than having to create a separate settings object each time 136 // create a single gui_settings object and access multiple icon
130 // that an icon is needed. OTOH, creating the base QSettings object 137 // objects rather than having to create a separate settings object
131 // is supposed to be fast, so that may not matter. Hmm. 138 // each time that an icon is needed. OTOH, creating the base
139 // QSettings object is supposed to be fast, so that may not matter.
140 // Hmm.
132 141
133 void config_icon_theme (void); 142 void config_icon_theme (void);
134 143
135 QIcon icon (const QString& icon_name, bool octave_only = false, 144 QIcon icon (const QString& icon_name, bool octave_only = false,
136 const QString& icon_alt_name = QString ()); 145 const QString& icon_alt_name = QString ());
146
147 QString get_default_font_family (void);
148
149 QStringList get_default_font (void);
150
151 void reload (void);
152
153 private:
154
155 void check (void);
137 }; 156 };
138 157
139 } 158 }
140 159
141 // Some constants used in the preferences of several widgets and therefore 160 // Some constants used in the preferences of several widgets and therefore