Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPlatformPluginInterfaceFactory Class Reference

#include <KisPlatformPluginInterfaceFactory.h>

Public Member Functions

QString colorManagementReport (QWidget *widget)
 
KisExtendedModifiersMapperPluginInterfacecreateExtendedModifiersMapper ()
 
 KisPlatformPluginInterfaceFactory ()
 
QString osPreferredColorSpaceReport (QWidget *widget)
 
bool surfaceColorManagedByOS ()
 

Static Public Member Functions

static KisPlatformPluginInterfaceFactoryinstance ()
 

Private Attributes

bool m_surfaceColorManagedByOS {false}
 

Detailed Description

Definition at line 25 of file KisPlatformPluginInterfaceFactory.h.

Constructor & Destructor Documentation

◆ KisPlatformPluginInterfaceFactory()

KisPlatformPluginInterfaceFactory::KisPlatformPluginInterfaceFactory ( )

Definition at line 28 of file KisPlatformPluginInterfaceFactory.cpp.

29{
30#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
31
32 auto fetchSurfaceColorManagedByOS = []() {
33 KPluginFactory *factory = KoPluginLoader::instance()->loadSinglePlugin(
34 std::make_pair("X-Krita-PlatformId", QApplication::platformName()),
35 "Krita/PlatformPlugin");
36
37 if (factory) {
38 QScopedPointer<KisSurfaceColorManagementInfo> interface(factory->create<KisSurfaceColorManagementInfo>());
39 return interface && interface->surfaceColorManagedByOS();
40 }
41
42 return false;
43 };
44
45 m_surfaceColorManagedByOS = fetchSurfaceColorManagedByOS();
46
47#endif /* KRITA_USE_SURFACE_COLOR_MANAGEMENT_API */
48}
static KoPluginLoader * instance()
KPluginFactory * loadSinglePlugin(const std::vector< std::pair< QString, QString > > &predicates, const QString &serviceType)

References KoPluginLoader::instance(), and KoPluginLoader::loadSinglePlugin().

Member Function Documentation

◆ colorManagementReport()

QString KisPlatformPluginInterfaceFactory::colorManagementReport ( QWidget * widget)

Return user-facing information about color management status of the main window surface. The information is intentionally left untranslated, since it is supposed to be used for bugreports.

Definition at line 81 of file KisPlatformPluginInterfaceFactory.cpp.

82{
83#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
85 KisRootSurfaceInfoProxy proxy(widget);
86 KIS_SAFE_ASSERT_RECOVER_NOOP(proxy.isReady());
87 return proxy.colorManagementReport();
88 } else {
89 return "Surface color management is not supported on this platform\n";
90 }
91#else
92 return "Surface color management is disabled\n";
93#endif
94}
static KisPlatformPluginInterfaceFactory * instance()
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130

References KisRootSurfaceInfoProxy::colorManagementReport(), instance(), KisRootSurfaceInfoProxy::isReady(), KIS_SAFE_ASSERT_RECOVER_NOOP, and surfaceColorManagedByOS().

◆ createExtendedModifiersMapper()

KisExtendedModifiersMapperPluginInterface * KisPlatformPluginInterfaceFactory::createExtendedModifiersMapper ( )

Creates an instance of the extended modifiers interface using the platform plugin

If the current platform plugin doesn't profide this interface, returns nullptr

Definition at line 112 of file KisPlatformPluginInterfaceFactory.cpp.

113{
114 KPluginFactory *factory = KoPluginLoader::instance()->loadSinglePlugin(
115 std::make_pair("X-Krita-PlatformId", QApplication::platformName()),
116 "Krita/PlatformPlugin");
117
118 if (factory) {
119 return factory->create<KisExtendedModifiersMapperPluginInterface>();
120 }
121
122 return nullptr;
123}

References KoPluginLoader::instance(), and KoPluginLoader::loadSinglePlugin().

◆ instance()

KisPlatformPluginInterfaceFactory * KisPlatformPluginInterfaceFactory::instance ( )
static

Definition at line 50 of file KisPlatformPluginInterfaceFactory.cpp.

51{
52 return s_instance;
53}

◆ osPreferredColorSpaceReport()

QString KisPlatformPluginInterfaceFactory::osPreferredColorSpaceReport ( QWidget * widget)

Return user-facing information about the preferred color space of the operating system. This information is supposed to be used in the preferences dialog, so it is supposed to be translated.

Definition at line 96 of file KisPlatformPluginInterfaceFactory.cpp.

97{
98#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
100 KisRootSurfaceInfoProxy proxy(widget);
101 KIS_SAFE_ASSERT_RECOVER_NOOP(proxy.isReady());
102 return proxy.osPreferredColorSpaceReport();
103 } else {
104 return "Surface color management is not supported on this platform\n";
105 }
106#else
107 return "Surface color management is disabled\n";
108#endif
109}

References instance(), KisRootSurfaceInfoProxy::isReady(), KIS_SAFE_ASSERT_RECOVER_NOOP, KisRootSurfaceInfoProxy::osPreferredColorSpaceReport(), and surfaceColorManagedByOS().

◆ surfaceColorManagedByOS()

bool KisPlatformPluginInterfaceFactory::surfaceColorManagedByOS ( )

Returns true if Krita is running on a system that manages the color space of the underlying surface. If it is true, the canvas should use KisCanvasSurfaceColorSpaceManager and all other windows should use KisSRGBSurfaceColorSpaceManager to set up the color space properly.

Definition at line 76 of file KisPlatformPluginInterfaceFactory.cpp.

77{
79}

References m_surfaceColorManagedByOS.

Member Data Documentation

◆ m_surfaceColorManagedByOS

bool KisPlatformPluginInterfaceFactory::m_surfaceColorManagedByOS {false}
private

Definition at line 70 of file KisPlatformPluginInterfaceFactory.h.

70{false};

The documentation for this class was generated from the following files: