GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gui-preferences.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2017-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_preferences_h)
27 #define octave_gui_preferences_h 1
28 
29 #include <QStringList>
30 #include <QStyle>
31 #include <QTabWidget>
32 #include <QTextCodec>
33 #include <QVariant>
34 
35 // Structure for the definition of pairs: key and default value
36 
37 struct gui_pref
38 {
39  gui_pref (const QString& key_arg, const QVariant& def_arg,
40  const bool ignore_arg = false)
41  : key (key_arg), def (def_arg), ignore (ignore_arg)
42  { }
43 
44  // No copying!
45 
46  gui_pref (const gui_pref&) = delete;
47 
48  gui_pref& operator = (const gui_pref&) = delete;
49 
50  ~gui_pref (void) = default;
51 
52  const QString key; // the key name
53  const QVariant def; // the default value
54  const bool ignore; // when true, ignore, i.e. always take default
55 };
56 
57 // The version for shortcuts, where the default value is stored as a
58 // combination of Qt:Keys (resutling in an unsigend int, when added)
59 // or as one of the predefined standard key sequences.
60 
61 const QString sc_group ("shortcuts/"); // group name is handled separately
62 
63 struct sc_pref
64 {
65  sc_pref (const QString& key_arg, Qt::Key def_arg)
66  : key (key_arg), def (static_cast<unsigned int> (def_arg)),
67  def_std (QKeySequence::UnknownKey)
68  { }
69 
70  sc_pref (const QString& key_arg, unsigned int def_arg)
71  : key (key_arg), def (def_arg), def_std (QKeySequence::UnknownKey)
72  { }
73 
74  sc_pref (const QString& key_arg, QKeySequence::StandardKey def_std_arg)
75  : key (key_arg), def (0), def_std (def_std_arg)
76  { }
77 
78  // No copying!
79 
80  sc_pref (const sc_pref&) = delete;
81 
82  sc_pref& operator = (const sc_pref&) = delete;
83 
84  ~sc_pref (void) = default;
85 
86  const QString key; // the key name
87  const unsigned int def; // the default as key
88  const QKeySequence::StandardKey def_std; // the default as standard key
89 };
90 
91 #endif
const QString sc_group("shortcuts/")
gui_pref(const QString &key_arg, const QVariant &def_arg, const bool ignore_arg=false)
const QString key
const QVariant def
gui_pref(const gui_pref &)=delete
~gui_pref(void)=default
gui_pref & operator=(const gui_pref &)=delete
const bool ignore
sc_pref(const QString &key_arg, QKeySequence::StandardKey def_std_arg)
~sc_pref(void)=default
const QKeySequence::StandardKey def_std
const unsigned int def
sc_pref(const QString &key_arg, unsigned int def_arg)
const QString key
sc_pref(const QString &key_arg, Qt::Key def_arg)
sc_pref(const sc_pref &)=delete
sc_pref & operator=(const sc_pref &)=delete