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 85 of file KisPlatformPluginInterfaceFactory.cpp.

86{
87#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
89 KisRootSurfaceInfoProxy proxy(widget);
90 KIS_SAFE_ASSERT_RECOVER_NOOP(proxy.isReady());
91 return proxy.colorManagementReport();
92 } else {
93 return "Surface color management is not supported on this platform\n";
94 }
95#else
96 return "Surface color management is disabled\n";
97#endif
98}
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 116 of file KisPlatformPluginInterfaceFactory.cpp.

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

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 100 of file KisPlatformPluginInterfaceFactory.cpp.

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

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 80 of file KisPlatformPluginInterfaceFactory.cpp.

81{
83}

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: