Perceptual Color

settingbase.cpp
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4// Own headers
5// First the interface, which forces the header to be self-contained.
6#include "settingbase.h"
7
8#include "settings.h"
9
10class QSettings;
11
12namespace PerceptualColor
13{
14
15// // Example stream operator
16// QDataStream& operator<<(QDataStream& out, const Settings::ColorList& colorList)
17// {
18// out << static_cast<qint32>(colorList.size());
19// for (const QColor& color : colorList) {
20// out << color;
21// }
22// return out;
23// }
24//
25// // Example stream operator
26// QDataStream& operator>>(QDataStream& in, Settings::ColorList& colorList)
27// {
28// colorList.clear();
29// qint32 size;
30// in >> size;
31// for (int i = 0; i < size; ++i) {
32// QColor color;
33// in >> color;
34// colorList.append(color);
35// }
36// return in;
37// }
38
39/** @brief Constructor.
40 *
41 * @param key <tt>QSettings</tt> key for the value.
42 * For maximum portability:
43 * - No upper case should ever be used.
44 * (Some systems, like the INI that we are using, are case-insensitive.
45 * And even if we always use INI, having both capital and small letters
46 * is error-prone because typos are not checked by the compiler.)
47 * - Only the letters a-z should be used.
48 * (Also, some characters like the backslash are not allowed on some
49 * platforms.)
50 * - “group/key”: Each key has exactly one group. Don't use subgroups.
51 * Use the class name as group name.
52 * (This makes the settings file well readable for humans. Missing
53 * groups are confusing because the system generates a “General”
54 * group which is not easy to understand. And using class identifiers
55 * helps to understand the structure of the settings file.)
56 * - In C++, use “const” variables to define key strings, instead of
57 * manually typing the key strings.
58 * (This avoids typing errors.)
59 * @param settings Corresponding @ref Settings object.
60 * @param parent The parent object (if any). */
61SettingBase::SettingBase(const QString &key, Settings *settings, QObject *parent)
62 : QObject(parent)
63 , m_key(key)
64 , m_settings(settings)
65{
66}
67
68/** @brief Destructor. */
69SettingBase::~SettingBase()
70{
71}
72
73/** @brief The underlying <tt>QSettings</tt> object of @ref m_settings.
74 *
75 * @returns the underlying <tt>QSettings</tt> object of @ref m_settings. */
76QSettings *SettingBase::underlyingQSettings()
77{
78 return &(m_settings->m_qSettings);
79}
80
81} // namespace PerceptualColor
The namespace of this library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:48:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.