Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgtk3json_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QGTK3JSON_P_H
4#define QGTK3JSON_P_H
5
6#include <QtCore/QCache>
7#include <QtCore/QJsonArray>
8#include <QtCore/QJsonDocument>
9#include <QtCore/QJsonObject>
10#include <QtCore/QMap>
11#include <QtCore/QString>
12#include <QtGui/QGuiApplication>
13#include <QtGui/QPalette>
14
15#include <qpa/qplatformtheme.h>
16#include "qgtk3interface_p.h"
17#include "qgtk3storage_p.h"
18
19#undef signals // Collides with GTK symbols
20#include <gtk/gtk.h>
21#include <gdk/gdk.h>
22#include <glib.h>
23
24//
25// W A R N I N G
26// -------------
27//
28// This file is not part of the Qt API. It exists purely as an
29// implementation detail. This header file may change from version to
30// version without notice, or even be removed.
31//
32// We mean it.
33//
34
36
38{
40private:
41 QGtk3Json(){};
42
43public:
44 // Convert enums to strings
46 static QLatin1String fromGtkState(GtkStateFlags type);
47 static QLatin1String fromColor(const QColor &Color);
54
55 // Convert strings to enums
57 static GtkStateFlags toGtkState(const QString &type);
58 static QColor toColor(const QString &Color);
59 static QPalette::ColorRole toColorRole(const QString &role);
62 static QGtk3Storage::SourceType toSourceType(const QString &sourceType);
63 static QGtk3Interface::QGtkWidget toWidgetType(const QString &widgetType);
64 static Qt::ColorScheme toColorScheme(const QString &colorScheme);
65
66 // Json keys
67 static constexpr QLatin1StringView cePalettes = "QtGtk3Palettes"_L1;
68 static constexpr QLatin1StringView cePalette = "PaletteType"_L1;
69 static constexpr QLatin1StringView ceGtkState = "GtkStateType"_L1;
70 static constexpr QLatin1StringView ceGtkWidget = "GtkWidgetType"_L1;
71 static constexpr QLatin1StringView ceColor = "Color"_L1;
72 static constexpr QLatin1StringView ceColorRole = "ColorRole"_L1;
73 static constexpr QLatin1StringView ceColorGroup = "ColorGroup"_L1;
74 static constexpr QLatin1StringView ceGdkSource = "GdkSource"_L1;
75 static constexpr QLatin1StringView ceSourceType = "SourceType"_L1;
76 static constexpr QLatin1StringView ceLighter = "Lighter"_L1;
77 static constexpr QLatin1StringView ceRed = "DeltaRed"_L1;
78 static constexpr QLatin1StringView ceGreen = "DeltaGreen"_L1;
79 static constexpr QLatin1StringView ceBlue = "DeltaBlue"_L1;
80 static constexpr QLatin1StringView ceWidth = "Width"_L1;
81 static constexpr QLatin1StringView ceHeight = "Height"_L1;
82 static constexpr QLatin1StringView ceBrush = "FixedBrush"_L1;
83 static constexpr QLatin1StringView ceData = "SourceData"_L1;
84 static constexpr QLatin1StringView ceBrushes = "Brushes"_L1;
85 static constexpr QLatin1StringView ceColorScheme = "ColorScheme"_L1;
86
87 // Save to a file
88 static bool save(const QGtk3Storage::PaletteMap &map, const QString &fileName,
90
91 // Save to a Json document
93
94 // Load from a file
95 static bool load(QGtk3Storage::PaletteMap &map, const QString &fileName);
96
97 // Load from a Json document
98 static bool load(QGtk3Storage::PaletteMap &map, const QJsonDocument &doc);
99};
100
102#endif // QGTK3JSON_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
static QLatin1String fromColorGroup(QPalette::ColorGroup group)
Definition qgtk3json.cpp:41
static QLatin1String fromWidgetType(QGtk3Interface::QGtkWidget widgetType)
Definition qgtk3json.cpp:51
static QLatin1String fromColorRole(QPalette::ColorRole role)
Definition qgtk3json.cpp:36
static constexpr QLatin1StringView cePalette
Definition qgtk3json_p.h:68
static constexpr QLatin1StringView ceColorGroup
Definition qgtk3json_p.h:73
static constexpr QLatin1StringView ceGreen
Definition qgtk3json_p.h:78
static constexpr QLatin1StringView ceBrush
Definition qgtk3json_p.h:82
static constexpr QLatin1StringView ceWidth
Definition qgtk3json_p.h:80
static GtkStateFlags toGtkState(const QString &type)
Definition qgtk3json.cpp:76
static QPalette::ColorRole toColorRole(const QString &role)
Definition qgtk3json.cpp:89
static constexpr QLatin1StringView ceBlue
Definition qgtk3json_p.h:79
static QPalette::ColorGroup toColorGroup(const QString &group)
Definition qgtk3json.cpp:94
static constexpr QLatin1StringView ceHeight
Definition qgtk3json_p.h:81
static constexpr QLatin1StringView ceColorScheme
Definition qgtk3json_p.h:85
static bool save(const QGtk3Storage::PaletteMap &map, const QString &fileName, QJsonDocument::JsonFormat format=QJsonDocument::Indented)
static constexpr QLatin1StringView ceColor
Definition qgtk3json_p.h:71
static constexpr QLatin1StringView ceGtkWidget
Definition qgtk3json_p.h:70
static constexpr QLatin1StringView ceLighter
Definition qgtk3json_p.h:76
static constexpr QLatin1StringView ceSourceType
Definition qgtk3json_p.h:75
static bool load(QGtk3Storage::PaletteMap &map, const QString &fileName)
static constexpr QLatin1StringView ceData
Definition qgtk3json_p.h:83
static QLatin1String fromGdkSource(QGtk3Interface::QGtkColorSource source)
Definition qgtk3json.cpp:46
static QGtk3Interface::QGtkColorSource toGdkSource(const QString &source)
Definition qgtk3json.cpp:99
static constexpr QLatin1StringView cePalettes
Definition qgtk3json_p.h:67
static QLatin1String fromSourceType(QGtk3Storage::SourceType sourceType)
static QLatin1String fromPalette(QPlatformTheme::Palette palette)
Definition qgtk3json.cpp:21
static constexpr QLatin1StringView ceRed
Definition qgtk3json_p.h:77
static QGtk3Storage::SourceType toSourceType(const QString &sourceType)
static constexpr QLatin1StringView ceColorRole
Definition qgtk3json_p.h:72
static QPlatformTheme::Palette toPalette(const QString &palette)
Definition qgtk3json.cpp:71
static QColor toColor(const QString &Color)
static QGtk3Interface::QGtkWidget toWidgetType(const QString &widgetType)
static Qt::ColorScheme toColorScheme(const QString &colorScheme)
Definition qgtk3json.cpp:66
static constexpr QLatin1StringView ceBrushes
Definition qgtk3json_p.h:84
static QLatin1String fromColorScheme(Qt::ColorScheme colorScheme)
Definition qgtk3json.cpp:56
static QLatin1String fromGtkState(GtkStateFlags type)
Definition qgtk3json.cpp:26
static constexpr QLatin1StringView ceGdkSource
Definition qgtk3json_p.h:74
static constexpr QLatin1StringView ceGtkState
Definition qgtk3json_p.h:69
static QLatin1String fromColor(const QColor &Color)
SourceType
This enum represents the type of a color source.
\inmodule QtCore\reentrant
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
Definition qpalette.h:49
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
ColorScheme
Definition qnamespace.h:50
GLenum type
GLboolean GLuint group
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
#define Q_GADGET