Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Merge Wayland HDR support branch

Dmitry Kazakovd5143427b612
diff --cc libs/ui/KisMainWindow.cpp
index 7c28e4230c,fb2ce907b8..3ce1fc5985
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@@ -3235,72 -3191,4 +3207,41 @@@ bool KisMainWindow::checkPaintOpAvailab
return (rserver->resourceCount() > 0);
}
- const KoColorProfile* KisMainWindow::managedSurfaceProfile() const
- {
- #if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
- return d->surfaceColorSpaceManager ? KoColorSpaceRegistry::instance()->p709SRGBProfile() : nullptr;
- #else
- return nullptr;
- #endif
- }
-
- QString KisMainWindow::colorManagementReport() const
- {
- #if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
- return d->surfaceColorSpaceManager ?
- d->surfaceColorSpaceManager->colorManagementReport() :
- QString("Surface color management is not supported on this platform\n");
- #else
- return "Surface color management is disabled\n";
- #endif
- }
-
- QString KisMainWindow::osPreferredColorSpaceReport() const
- {
- #if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
- return d->surfaceColorSpaceManager ?
- d->surfaceColorSpaceManager->osPreferredColorSpaceReport() :
- QString("Surface color management is not supported on this platform\n");
- #else
- return "Surface color management is disabled\n";
- #endif
- }
-
+// One action has only one icon override, local XML contains ActionIconOverrides like so:
+// <ActionIconOverrides>
+// <Action name="erase_action" icon="wheel-sectors"/>
+// <Action name="about_krita" icon="application-exit"/>
+// </ActionIconOverrides>
+// This function will rerender the actions with icons in UI (toolbars, shortcuts options etc.)
+void KisMainWindow::applyActionIconOverridesFromLocalXML()
+{
+ QString xmlPath = KoResourcePaths::locateLocal("data", "krita5.xmlgui");
+ QFile file(xmlPath);
+ if (!file.exists()) {
+ return;
+ }
+
+ QDomDocument doc;
+ if (!file.open(QIODevice::ReadOnly) || !doc.setContent(&file)) {
+ return;
+ }
+
+ QDomNodeList overridesList = doc.elementsByTagName(QStringLiteral("ActionIconOverrides"));
+ if (!overridesList.isEmpty()) {
+ QDomElement overridesElement = overridesList.at(0).toElement();
+ QDomNodeList actions = overridesElement.elementsByTagName(QStringLiteral("Action"));
+ for (int i = 0; i < actions.count(); ++i) {
+ QDomElement actionElement = actions.at(i).toElement();
+ QString name = actionElement.attribute(QStringLiteral("name"));
+ QString icon = actionElement.attribute(QStringLiteral("icon"));
+ if (!name.isEmpty() && !icon.isEmpty()) {
+ QAction *qa = actionCollection()->action(name);
+ if (qa) {
+ qa->setIcon(KisIconUtils::loadIcon(icon));
+ }
+ }
+ }
+ }
+}
+
- #include <moc_KisMainWindow.cpp>
+ #include <moc_KisMainWindow.cpp>