Krita Source Code Documentation
Loading...
Searching...
No Matches
DlgColorManagementInfo.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#include <QStandardPaths>
9
10#include <KisMainWindow.h>
11
12#include <KoPluginLoader.h>
13#include <kpluginfactory.h>
16
17
19 : DlgBugInfo(parent)
20{
21 initialize();
22
23 KPluginFactory *factory = KoPluginLoader::instance()->loadSinglePlugin(
24 std::make_pair("X-Krita-PlatformId", QGuiApplication::platformName()),
25 "Krita/PlatformPlugin");
26
27 if (factory) {
29 factory->create<KisOutputColorInfoInterface>(nullptr));
30
34
36 this, [this] () {
37 if (m_outputColorInfoInterface->isReady()) {
38 initializeText();
39 }
40 });
41 }
42
44 factory->create<KisSurfaceColorManagementInfo>(nullptr));
45
47 auto future = m_surfaceColorManagementInfo->debugReport();
48 future.then([this] (const QString &report) {
51 });
52 }
53 }
54}
55
57{
58 return "";
59}
60
62{
63 return "KritaColorManagementInformation.txt";
64}
65
67{
68 return i18nc("Caption of the dialog with color management information for bug reports", "Krita Color Management Information: please paste this information to the bug report");
69}
70
72{
73 qFatal("not used");
74 return "";
75}
76
77#include <QWindow>
78
79#include <KisViewManager.h>
80#include <KisDocument.h>
81#include <kis_canvas2.h>
83
84QString DlgColorManagementInfo::infoText(QSettings& kritarc)
85{
86 Q_UNUSED(kritarc)
87
88 QString report;
89 QDebug s(&report);
90
91 s << "Main Window" << Qt::endl;
92 s << "===" << Qt::endl;
93 s << Qt::endl;
94
95 KisMainWindow *mainWindow = qobject_cast<KisMainWindow*>(parent());
96
97 s << "Native window handle:" << mainWindow->windowHandle() << Qt::endl;
98 s << Qt::endl;
99
100 s.noquote().nospace() << KisPlatformPluginInterfaceFactory::instance()->colorManagementReport(mainWindow);
101 s.space().quote();
102 s << Qt::endl;
103
104 if (mainWindow->viewManager()->document()) {
105 auto *doc = mainWindow->viewManager()->document();
106 auto *canvas = mainWindow->viewManager()->canvasBase();
107
108 s << "Document:" << doc->objectName() << "path:" << doc->localFilePath() << Qt::endl;
109 s << "===" << Qt::endl;
110 s << Qt::endl;
111
112 s << "Native window handle:" << canvas->canvasWidget()->windowHandle() << Qt::endl;
113
114
115 if (KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS() &&
116 canvas->canvasWidget()->windowHandle() == mainWindow->windowHandle()) {
117
118 s << "WARNING: the canvas shares the surface with the main window on a platform with managed surface color space!";
119 }
120 s << Qt::endl;
121
122 s.noquote().nospace() << canvas->colorManagementReport();
123 s.space().quote();
124
125 Q_FOREACH (QScreen *screen, qApp->screens()) {
126 s << Qt::endl;
127 s << "Screen:" << screen->name() << screen->manufacturer() << screen->model();
128 if (screen == mainWindow->screen()) {
129 s << "[CURRENT]";
130 }
131 s << Qt::endl;
132 s << "===" << Qt::endl;
133 s << Qt::endl;
134
135 std::optional<KisSurfaceColorimetry::SurfaceDescription> desc;
136
138 desc = m_outputColorInfoInterface->outputDescription(screen);
139 }
140
141 if (desc) {
142 s.noquote().nospace() << desc->makeTextReport();
143 s.space().quote();
144 } else {
145 s << "<no information available>";
146 }
147 s << Qt::endl;
148 }
149 }
150
151 s << "Color management plugin report" << Qt::endl;
152 s << "===" << Qt::endl;
153 s << Qt::endl;
154
155 s.noquote().nospace() << (m_surfaceManagementReport.isEmpty() ? "<no information available>" : m_surfaceManagementReport);
156 s.space().quote();
157 s << Qt::endl;
158
159 return report;
160}
161
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void initialize()
void initializeText()
QString replacementWarningText() override
DlgColorManagementInfo(QWidget *parent=0)
QScopedPointer< KisOutputColorInfoInterface > m_outputColorInfoInterface
QString originalFileName() override
QString infoText(QSettings &kritarc) override
QScopedPointer< KisSurfaceColorManagementInfo > m_surfaceColorManagementInfo
QString defaultNewFileName() override
KisAbstractCanvasWidget * canvasWidget
Main window for Krita.
KisViewManager * viewManager
void sigOutputDescriptionChanged(QScreen *screen, const KisSurfaceColorimetry::SurfaceDescription &desc)
void sigReadyChanged(bool isReady)
static KisPlatformPluginInterfaceFactory * instance()
KisDocument * document() const
KisCanvas2 * canvasBase() const
Return the canvas base class.
static KoPluginLoader * instance()
KPluginFactory * loadSinglePlugin(const std::vector< std::pair< QString, QString > > &predicates, const QString &serviceType)