GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gui-settings.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2019-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_gui_settings_h)
27 #define octave_gui_settings_h 1
28 
29 #include <QSettings>
30 
31 #include "gui-preferences.h"
32 
33 namespace octave
34 {
35  class gui_settings : public QSettings
36  {
37  Q_OBJECT
38 
39  public:
40 
41  gui_settings (const QString& file_name, QSettings::Format format,
42  QObject *parent = nullptr)
43  : QSettings (file_name, format, parent)
44  { }
45 
46  gui_settings (QSettings::Format format, QSettings::Scope scope,
47  const QString& organization,
48  const QString& application = QString (),
49  QObject *parent = nullptr)
50  : QSettings (format, scope, organization, application, parent)
51  { }
52 
53  // No copying!
54 
55  gui_settings (const gui_settings&) = delete;
56 
58 
59  ~gui_settings (void) = default;
60 
61  using QSettings::value;
62 
63  QVariant value (const gui_pref& pref) const
64  {
65  if (pref.ignore)
66  return pref.def; // ignore the current pref and always use default
67 
68  return value (pref.key, pref.def);
69  }
70 
71  QString sc_value (const sc_pref& pref) const;
72 
73  QKeySequence sc_def_value (const sc_pref& pref) const;
74 
75  };
76 }
77 
78 #endif
79 
QVariant value(const gui_pref &pref) const
Definition: gui-settings.h:63
QKeySequence sc_def_value(const sc_pref &pref) const
Definition: gui-settings.cc:46
QString sc_value(const sc_pref &pref) const
Definition: gui-settings.cc:37
gui_settings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application=QString(), QObject *parent=nullptr)
Definition: gui-settings.h:46
gui_settings(const QString &file_name, QSettings::Format format, QObject *parent=nullptr)
Definition: gui-settings.h:41
~gui_settings(void)=default
gui_settings(const gui_settings &)=delete
gui_settings & operator=(const gui_settings &)=delete
size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1329
const QString key
const QVariant def
const bool ignore