Perceptual Color

perceptualsettings.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef PERCEPTUALSETTINGS_H
5#define PERCEPTUALSETTINGS_H
6
7#include "setting.h"
8#include "settings.h"
9#include <qcolor.h>
10#include <qglobal.h>
11#include <qlist.h>
12#include <qmetatype.h>
13#include <qstring.h>
14
15#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
16#include <qtmetamacros.h>
17#else
18#include <qobjectdefs.h>
19#endif
20
21namespace PerceptualColor
22{
23
24/** @internal
25 *
26 * @brief Settings for @ref PerceptualColor.
27 *
28 * @warning This object is not thread-safe.
29 * It must only be used in the main (widget) thread! */
30class PerceptualSettings : public Settings
31{
33
34public:
35 /** @brief Data type for color lists.
36 *
37 * Has serialization support as required by <tt>QSettings</tt>. */
38 using ColorList = QList<QColor>;
39
40 virtual ~PerceptualSettings() override;
41 // Prevent copy and assignment operations to force that only references
42 // to the instance are possible.
43 PerceptualSettings(const PerceptualSettings &) = delete;
44 PerceptualSettings &operator=(const PerceptualSettings &) = delete;
45
46 static PerceptualSettings &instance();
47
48 /** @brief Custom colors of @ref ColorDialog. */
49 Setting<ColorList> customColors;
50
51 /** @brief History of actually selected (confirmed by Okay button
52 * respectively Enter key) colors of @ref ColorDialog. */
53 Setting<ColorList> history;
54
55 /** @brief The currently visible tab of @ref ColorDialog with
56 * @ref ColorDialog::DialogLayoutDimensions::Collapsed. */
57 Setting<QString> tab;
58
59 /** @brief The currently visible tab of @ref ColorDialog with
60 * @ref ColorDialog::DialogLayoutDimensions::Expanded. */
61 Setting<QString> tabExpanded;
62
63private:
64 PerceptualSettings();
65
66 /** @internal @brief Only for unit tests. */
67 friend class TestPerceptualSettings;
68};
69
70} // namespace PerceptualColor
71
73
74#endif // PERCEPTUALSETTINGS_H
The namespace of this library.
Q_OBJECTQ_OBJECT
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.