Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWaylandDebugInfoFetcher.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include <QScreen>
10#include <QTimer>
11#include <QPointer>
12
13#include <qpa/qplatformnativeinterface.h>
14
17
18 #include <QtAssert>
19 #include <kis_debug.h>
20
29
33
35{
36 return m_isReady;
37}
38
40{
41 return m_report;
42}
43
45{
46 if (m_waylandManager->isReady()) {
48 m_isReady = true;
50 } else {
51 m_isReady = false;
52 m_report = "";
53 }
54}
55
57{
58 QString report;
59
60 QDebug s(&report);
61
62 s << "Wayland color management plugin report" << Qt::endl;
63 s << Qt::endl;
64
65 if (!m_waylandManager) {
66 s << "Wayland manager is not initialized." << Qt::endl;
67 return report;
68 }
69
70 s << "Supported Features:" << Qt::endl;
71 const std::map<QtWayland::wp_color_manager_v1::feature, QString> featureNames = {
72 {QtWayland::wp_color_manager_v1::feature_icc_v2_v4, "feature_icc_v2_v4"},
73 {QtWayland::wp_color_manager_v1::feature_parametric, "feature_parametric"},
74 {QtWayland::wp_color_manager_v1::feature_set_primaries, "feature_set_primaries"},
75 {QtWayland::wp_color_manager_v1::feature_set_tf_power, "feature_set_tf_power"},
76 {QtWayland::wp_color_manager_v1::feature_set_luminances, "feature_set_luminances"},
77 {QtWayland::wp_color_manager_v1::feature_set_mastering_display_primaries, "feature_set_mastering_display_primaries"},
78 {QtWayland::wp_color_manager_v1::feature_extended_target_volume, "feature_extended_target_volume"},
79 {QtWayland::wp_color_manager_v1::feature_windows_scrgb, "feature_windows_scrgb"}
80 };
81 for (const auto &[feature, name] : featureNames) {
82 s.noquote().nospace() << " " << name << ": " << (m_waylandManager->isFeatureSupported(feature) ? "yes" : "no") << Qt::endl;
83 }
84
85 s << Qt::endl;
86 s << "Supported Render Intents:" << Qt::endl;
87 const std::map<QtWayland::wp_color_manager_v1::render_intent, QString> intentNames = {
88 {QtWayland::wp_color_manager_v1::render_intent_perceptual, "render_intent_perceptual"},
89 {QtWayland::wp_color_manager_v1::render_intent_relative, "render_intent_relative"},
90 {QtWayland::wp_color_manager_v1::render_intent_saturation, "render_intent_saturation"},
91 {QtWayland::wp_color_manager_v1::render_intent_absolute, "render_intent_absolute"},
92 {QtWayland::wp_color_manager_v1::render_intent_relative_bpc, "render_intent_relative_bpc"}
93 };
94 for (const auto &[intent, name] : intentNames) {
95 s.noquote().nospace() << " " << name << ": " << (m_waylandManager->isIntentSupported(intent) ? "yes" : "no") << Qt::endl;
96 }
97
98 s << Qt::endl;
99 s << "Supported Transfer Functions:" << Qt::endl;
100 const std::map<QtWayland::wp_color_manager_v1::transfer_function, QString> tfNames = {
101 {QtWayland::wp_color_manager_v1::transfer_function_bt1886, "transfer_function_bt1886"},
102 {QtWayland::wp_color_manager_v1::transfer_function_gamma22, "transfer_function_gamma22"},
103 {QtWayland::wp_color_manager_v1::transfer_function_gamma28, "transfer_function_gamma28"},
104 {QtWayland::wp_color_manager_v1::transfer_function_st240, "transfer_function_st240"},
105 {QtWayland::wp_color_manager_v1::transfer_function_ext_linear, "transfer_function_ext_linear"},
106 {QtWayland::wp_color_manager_v1::transfer_function_log_100, "transfer_function_log_100"},
107 {QtWayland::wp_color_manager_v1::transfer_function_log_316, "transfer_function_log_316"},
108 {QtWayland::wp_color_manager_v1::transfer_function_xvycc, "transfer_function_xvycc"},
109 {QtWayland::wp_color_manager_v1::transfer_function_srgb, "transfer_function_srgb"},
110 {QtWayland::wp_color_manager_v1::transfer_function_ext_srgb, "transfer_function_ext_srgb"},
111 {QtWayland::wp_color_manager_v1::transfer_function_st2084_pq, "transfer_function_st2084_pq"},
112 {QtWayland::wp_color_manager_v1::transfer_function_st428, "transfer_function_st428"},
113 {QtWayland::wp_color_manager_v1::transfer_function_hlg, "transfer_function_hlg"}
114 };
115 for (const auto &[tf, name] : tfNames) {
116 s.noquote().nospace() << " " << name << ": " << (m_waylandManager->isTransferFunctionNamedSupported(tf) ? "yes" : "no") << Qt::endl;
117 }
118
119 s << Qt::endl;
120 s << "Supported Primaries:" << Qt::endl;
121 const std::map<QtWayland::wp_color_manager_v1::primaries, QString> primaryNames = {
122 {QtWayland::wp_color_manager_v1::primaries_srgb, "primaries_srgb"},
123 {QtWayland::wp_color_manager_v1::primaries_pal_m, "primaries_pal_m"},
124 {QtWayland::wp_color_manager_v1::primaries_pal, "primaries_pal"},
125 {QtWayland::wp_color_manager_v1::primaries_ntsc, "primaries_ntsc"},
126 {QtWayland::wp_color_manager_v1::primaries_generic_film, "primaries_generic_film"},
127 {QtWayland::wp_color_manager_v1::primaries_bt2020, "primaries_bt2020"},
128 {QtWayland::wp_color_manager_v1::primaries_cie1931_xyz, "primaries_cie1931_xyz"},
129 {QtWayland::wp_color_manager_v1::primaries_dci_p3, "primaries_dci_p3"},
130 {QtWayland::wp_color_manager_v1::primaries_display_p3, "primaries_display_p3"},
131 {QtWayland::wp_color_manager_v1::primaries_adobe_rgb, "primaries_adobe_rgb"}
132 };
133 for (const auto &[primary, name] : primaryNames) {
134 s.noquote().nospace() << " " << name << ": " << (m_waylandManager->isPrimariesNamedSupported(primary) ? "yes" : "no") << Qt::endl;
135 }
136
137 return report;
138}
139
140#include <moc_KisWaylandDebugInfoFetcher.cpp>
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigReadyChanged(bool value)
KisWaylandDebugInfoFetcher(QObject *parent=nullptr)
void sigDebugInfoReady(const QString &report)
std::shared_ptr< KisWaylandAPIColorManager > m_waylandManager
static std::shared_ptr< KisWaylandAPIColorManager > getOrCreateGlobalWaylandManager()