26#include <QStandardPaths>
32#include <QProcessEnvironment>
35#include <QStyleFactory>
39#include <QImageReader>
40#include <QImageWriter>
43#include <klocalizedstring.h>
44#include <kdesktopfile.h>
46#include <kconfiggroup.h>
119#include <QThreadStorage>
124#include <config-seexpr.h>
125#include <config-safe-asserts.h>
130#include <config-qt-patches-present.h>
131#include <config-use-surface-color-management-api.h>
133#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
136#include <QPlatformSurfaceEvent>
141#if defined(Q_OS_ANDROID) && KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
146const QTime appStartTime(QTime::currentTime());
150struct AppRecursionInfo {
151 ~AppRecursionInfo() {
156 int eventRecursionCount {0};
157 std::queue<KisSynchronizedConnectionEvent> postponedSynchronizationEvents;
160struct AppRecursionGuard {
161 AppRecursionGuard(AppRecursionInfo *info)
164 m_info->eventRecursionCount++;
169 m_info->eventRecursionCount--;
172 AppRecursionInfo *m_info {0};
193 bool batchRun {
false};
199#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
234 qputenv(
"QT_QUICK_BACKEND",
"software");
240 QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
250 if (!widgetStyleFromConfig.isEmpty()) {
251 qApp->setStyle(widgetStyleFromConfig);
253#if defined Q_OS_WIN || defined Q_OS_MACOS || defined Q_OS_ANDROID
256 qApp->setStyle(
"fusion");
272#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
278 struct PlatformWindowCreationFilter : QObject
280 using QObject::QObject;
282 bool eventFilter(QObject *watched, QEvent *event)
override {
283 if (event->type() == QEvent::PlatformSurface) {
284 QWidget *widget = qobject_cast<QWidget*>(watched);
285 if (!widget)
return false;
291 if (watched->property(
"krita_skip_srgb_surface_manager_assignment").toBool()) {
295 QPlatformSurfaceEvent *surfaceEvent =
static_cast<QPlatformSurfaceEvent*
>(event);
296 if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
297 QWindow *nativeWindow = widget->windowHandle();
310 this->installEventFilter(
new PlatformWindowCreationFilter(
this));
314#if defined(Q_OS_WIN) && defined(ENV32BIT)
315typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
317LPFN_ISWOW64PROCESS fnIsWow64Process;
321 BOOL bIsWow64 = FALSE;
327 fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
328 GetModuleHandle(TEXT(
"kernel32")),
"IsWow64Process");
330 if(0 != fnIsWow64Process)
332 if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
367#if defined HAVE_SEEXPR
387 if (
event->type() == QEvent::FileOpen) {
388 QFileOpenEvent *openEvent =
static_cast<QFileOpenEvent *
>(
event);
393 return QApplication::event(
event);
404 QStringList() <<
"application/x-krita-paintoppreset"));
432#if defined HAVE_SEEXPR
438 i18nc(
"Resource type name",
"Layer styles"),
439 QStringList() <<
"application/x-photoshop-style"));
450 QString databaseLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
454 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"), i18n(
"%1\n\nKrita will quit now.",
KisResourceCacheDb::lastError()));
460 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"),
KisResourceLocator::instance()->errorMessages().join(
'\n') + i18n(
"\n\nKrita will quit now."));
493 QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus,
false);
495 QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus,
true);
501 if (isWow64() && !cfg.
readEntry(
"WarnedAbout32Bits",
false)) {
502 QMessageBox::information(qApp->activeWindow(),
503 i18nc(
"@title:window",
"Krita: Warning"),
504 i18n(
"You are running a 32 bits build on a 64 bits Windows.\n"
505 "This is not recommended.\n"
506 "Please download and install the x64 build instead."));
514 if (opengl ==
"OPENGL_NOT_TRIED" ) {
517 else if (opengl !=
"OPENGL_SUCCESS" && opengl !=
"TRY_OPENGL") {
525#if defined(Q_OS_ANDROID) && KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
531 const bool exportAs = args.
exportAs();
535 d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
536 const bool needsMainWindow = (!exportAs && !exportSequence);
538 bool showmainWindow = (!exportAs && !exportSequence);
541 const bool showSplashScreen = !
d->batchRun && qEnvironmentVariableIsEmpty(
"NOSPLASH");
542 if (showSplashScreen &&
d->splashScreen) {
543 d->splashScreen->show();
544 d->splashScreen->repaint();
549 KConfigGroup group(KSharedConfig::openConfig(),
"theme");
556 Q_UNUSED(resetStarting);
576 if (needsMainWindow) {
582 bool sessionNeeded =
true;
585 if (!args.
session().isEmpty()) {
588 showmainWindow =
false;
589 sessionNeeded =
false;
592 KConfigGroup sessionCfg = KSharedConfig::openConfig()->group(
"session");
593 const QString &sessionName = sessionCfg.readEntry(
"previousSession");
606 windowLayout->applyLayout();
612 if (showmainWindow) {
619 d->mainWindow->restoreWorkspace(workspace);
624 d->mainWindow->viewManager()->switchCanvasOnly(
true);
628 d->mainWindow->showFullScreen();
659#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
660 auto setPageUpDownMouseButtonEmulationWorkaround = [](
bool enabled) {
661 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN, enabled);
664 &KisConfigNotifier::sigUsePageUpDownMouseButtonEmulationWorkaroundChanged,
666 setPageUpDownMouseButtonEmulationWorkaround);
667 setPageUpDownMouseButtonEmulationWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
676#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
677 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS,
true);
678 auto setHighFunctionKeyMouseButtonEmulationWorkaround = [](
bool enabled) {
682 &KisConfigNotifier::sigUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged,
684 setHighFunctionKeyMouseButtonEmulationWorkaround);
685 setHighFunctionKeyMouseButtonEmulationWorkaround(cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
692#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
693 auto setIgnoreHistoricTabletEventsWorkaround = [](
bool enabled) {
694 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS, enabled);
697 &KisConfigNotifier::sigUseIgnoreHistoricTabletEventsWorkaroundChanged,
699 setIgnoreHistoricTabletEventsWorkaround);
700 setIgnoreHistoricTabletEventsWorkaround(cfg.useIgnoreHistoricTabletEventsWorkaround());
708 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
713 int argsCount = args.
filenames().count();
716 for (
int argNumber = 0; argNumber < argsCount; argNumber++) {
717 QString fileName = args.
filenames().at(argNumber);
730 if (outputMimetype ==
"application/octetstream") {
731 dbgKrita << i18n(
"Mimetype not found, try using the -mimetype option") << Qt::endl;
737 bool result = doc->
openPath(fileName);
741 QTimer::singleShot(0,
this, SLOT(quit()));
745 if (exportFileName.isEmpty()) {
746 errKrita <<
"Export destination is not specified for" << fileName <<
"Please specify export destination with --export-filename option";
747 QTimer::singleShot(0,
this, SLOT(quit()));
751 qApp->processEvents();
757 errKrita <<
"Could not export " << fileName <<
"to" << exportFileName <<
":" << doc->
errorMessage();
759 QTimer::singleShot(0,
this, SLOT(quit()));
762 else if (exportSequence) {
766 qApp->processEvents();
769 errKrita <<
"This file has no animation." << Qt::endl;
770 QTimer::singleShot(0,
this, SLOT(quit()));
775 int sequenceStart = 0;
778 qDebug() <<
ppVar(exportFileName);
789 qDebug() <<
ppVar(result);
792 errKrita << i18n(
"Failed to render animation frames!") << Qt::endl;
795 QTimer::singleShot(0,
this, SLOT(quit()));
798 else if (
d->mainWindow) {
799 if (QFileInfo(fileName).fileName().endsWith(
".bundle", Qt::CaseInsensitive)) {
800 d->mainWindow->installBundle(fileName);
805 d->mainWindow->openDocument(fileName, flags);
814 if (
d->mainWindow->viewManager()->image()){
817 d->mainWindow->viewManager()->image()->nextLayerName(i18n(
"File layer")),
OPACITY_OPAQUE_U8);
818 QFileInfo fi(fileLayer->
path());
821 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
822 d->mainWindow->viewManager()->activeNode());
825 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
826 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
830 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
831 i18n(
"Cannot add the file layer: no document is open.\n\n"
832"You can create a new document using the --new-image option, or you can open an existing file.\n\n"
833"If you instead want to add the file layer to a document in an already running instance of Krita, check the \"Allow only one instance of Krita\" checkbox in the settings (Settings -> General -> Window)."));
836 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Warning"),
837 i18n(
"Cannot add the file layer: no document is open.\n"
838 "You can either create a new file using the --new-image option, or you can open an existing file."));
842 Q_FOREACH(
const QByteArray &message,
d->earlyRemoteArguments) {
849 if (!
d->earlyFileOpenEvents.isEmpty()) {
851 Q_FOREACH(QString fileName,
d->earlyFileOpenEvents) {
852 d->mainWindow->openDocument(fileName, QFlags<KisMainWindow::OpenFlag>());
872 d->splashScreen = qobject_cast<KisSplashScreen*>(splashScreen);
877 if (
d->splashScreen) {
878 d->splashScreen->setLoadingText(textToLoad);
879 d->splashScreen->repaint();
891 if (
d->splashScreen) {
893 d->splashScreen->hide();
908 AppRecursionInfo &info = s_recursionInfo->localData();
912 AppRecursionGuard guard(&info);
916 if (info.eventRecursionCount > 1) {
922 result = QApplication::notify(receiver,
event);
925 result = QApplication::notify(receiver,
event);
929 if (!info.eventRecursionCount) {
936 }
catch (std::exception &e) {
937 qWarning(
"Error %s sending event %i to object %s",
938 e.what(),
event->type(), qPrintable(receiver->objectName()));
940 qWarning(
"Error <unknown> sending event %i to object %s",
941 event->type(), qPrintable(receiver->objectName()));
948 AppRecursionInfo &info = s_recursionInfo->localData();
950 while (!info.postponedSynchronizationEvents.empty()) {
952 AppRecursionGuard guard(&info);
957 info.postponedSynchronizationEvents.pop();
960 qWarning() <<
"WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery";
964 QApplication::notify(typedEvent.
destination, &typedEvent);
970 if (qEnvironmentVariableIsSet(
"STEAMAPPID") || qEnvironmentVariableIsSet(
"SteamAppId")) {
974 if (applicationDirPath().toLower().contains(
"steam")) {
1003#if !defined(HIDE_SAFE_ASSERTS) || defined(CRASH_ON_SAFE_ASSERTS)
1005 auto verifyTypeRegistered = [] (
const char *type) {
1006 const int typeId = QMetaType::type(type);
1009 qFatal(
"ERROR: type-id for metatype %s is not found", type);
1012 if (!QMetaType::isRegistered(typeId)) {
1013 qFatal(
"ERROR: metatype %s is not registered", type);
1017 verifyTypeRegistered(
"KisBrushSP");
1018 verifyTypeRegistered(
"KoSvgText::AutoValue");
1019 verifyTypeRegistered(
"KoSvgText::BackgroundProperty");
1020 verifyTypeRegistered(
"KoSvgText::StrokeProperty");
1021 verifyTypeRegistered(
"KoSvgText::TextTransformInfo");
1022 verifyTypeRegistered(
"KoSvgText::TextIndentInfo");
1023 verifyTypeRegistered(
"KoSvgText::TabSizeInfo");
1024 verifyTypeRegistered(
"KoSvgText::LineHeightInfo");
1025 verifyTypeRegistered(
"KisPaintopLodLimitations");
1026 verifyTypeRegistered(
"KisImageSP");
1027 verifyTypeRegistered(
"KisImageSignalType");
1028 verifyTypeRegistered(
"KisNodeSP");
1029 verifyTypeRegistered(
"KisNodeList");
1030 verifyTypeRegistered(
"KisPaintDeviceSP");
1031 verifyTypeRegistered(
"KisTimeSpan");
1032 verifyTypeRegistered(
"KoColor");
1033 verifyTypeRegistered(
"KoResourceSP");
1034 verifyTypeRegistered(
"KoResourceCacheInterfaceSP");
1035 verifyTypeRegistered(
"KisAsyncAnimationRendererBase::CancelReason");
1036 verifyTypeRegistered(
"KisGridConfig");
1037 verifyTypeRegistered(
"KisGuidesConfig");
1038 verifyTypeRegistered(
"KisUpdateInfoSP");
1039 verifyTypeRegistered(
"KisToolChangesTrackerDataSP");
1040 verifyTypeRegistered(
"QVector<QImage>");
1041 verifyTypeRegistered(
"SnapshotDirInfoList");
1042 verifyTypeRegistered(
"TransformTransactionProperties");
1043 verifyTypeRegistered(
"ToolTransformArgs");
1044 verifyTypeRegistered(
"QPainterPath");
1053 const int argsCount = args.
filenames().count();
1054 bool documentCreated =
false;
1061 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
1064 if (argsCount > 0) {
1066 for (
int argNumber = 0; argNumber < argsCount; ++argNumber) {
1067 QString filename = args.
filenames().at(argNumber);
1072 else if (QFile(filename).exists()) {
1074 documentCreated |= mainWindow->
openDocument(filename, flags);
1081 if (argsCount > 0 && !documentCreated){
1083 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1084 i18n(
"Couldn't open file %1",args.
filenames().at(argsCount - 1)));
1090 QFileInfo fi(fileLayer->
path());
1093 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
1094 d->mainWindow->viewManager()->activeNode());
1097 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1098 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
1102 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1103 i18n(
"Cannot add the file layer: no document is open."));
1112 KisMainWindow *mw = qobject_cast<KisMainWindow*>(qApp->activeWindow());
1118 const QByteArray unpackedMessage =
1119 QByteArray::fromBase64(message.toLatin1());
1122 d->earlyRemoteArguments << unpackedMessage;
1130 if (!
d->mainWindow) {
1131 d->earlyFileOpenEvents.append(url);
1136 d->mainWindow->openDocument(url, flags);
1142 if (enabled && !
d->longPressEventFilter) {
1144 installEventFilter(
d->longPressEventFilter);
1145 }
else if (!enabled &&
d->longPressEventFilter) {
1146 removeEventFilter(
d->longPressEventFilter);
1147 d->longPressEventFilter->deleteLater();
1148 d->longPressEventFilter =
nullptr;
1154 if (
d->batchRun)
return;
1165 QStringList autosaveFiles = dir.entryList(filters, QDir::Files | QDir::Hidden);
1168 filters =
QStringList() << QString(
"krita-*-*-autosave.kra");
1169 autosaveFiles += dir.entryList(filters, QDir::Files);
1172 if (autosaveFiles.size() > 0) {
1173 if (
d->splashScreen) {
1178 QDialog::DialogCode result = (QDialog::DialogCode)
d->autosaveDialog->exec();
1180 if (result == QDialog::Accepted) {
1181 QStringList filesToRecover =
d->autosaveDialog->recoverableFiles();
1182 Q_FOREACH (
const QString &autosaveFile, autosaveFiles) {
1183 if (!filesToRecover.contains(autosaveFile)) {
1184 KisUsageLogger::log(QString(
"Removing autosave file %1").arg(dir.absolutePath() +
"/" + autosaveFile));
1185 QFile::remove(dir.absolutePath() +
"/" + autosaveFile);
1188 autosaveFiles = filesToRecover;
1190 autosaveFiles.clear();
1193 if (autosaveFiles.size() > 0) {
1195 Q_FOREACH (
const QString &autoSaveFile, autosaveFiles) {
1196 const QString path = dir.absolutePath() + QLatin1Char(
'/') + autoSaveFile;
1197 autosavePaths << path;
1199 if (
d->mainWindow) {
1200 Q_FOREACH (
const QString &path, autosavePaths) {
1207 delete d->autosaveDialog;
1208 d->autosaveDialog =
nullptr;
1214 QString templatePath;
1216 if (QFile::exists(fileName)) {
1217 templatePath = fileName;
1218 dbgUI <<
"using full path...";
1221 QString desktopName(fileName);
1222 const QString templatesResourcePath = QStringLiteral(
"templates/");
1225 if (paths.isEmpty()) {
1229 if (paths.isEmpty()) {
1230 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1231 i18n(
"No template found for: %1", desktopName));
1232 }
else if (paths.count() > 1) {
1233 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1234 i18n(
"Too many templates found for: %1", desktopName));
1236 templatePath = paths.at(0);
1240 if (!templatePath.isEmpty()) {
1241 KDesktopFile templateInfo(templatePath);
1245 dbgUI <<
"Template loaded...";
1249 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1250 i18n(
"Template %1 failed to load.", fileName));
1261 KSharedConfigPtr config = KSharedConfig::openConfig();
1262 config->markAsClean();
1265 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1266 QString kritarcPath = configPath + QStringLiteral(
"/kritarc");
1268 QFile kritarcFile(kritarcPath);
1270 if (kritarcFile.exists()) {
1271 if (kritarcFile.open(QFile::ReadWrite)) {
1272 QString backupKritarcPath = kritarcPath + QStringLiteral(
".backup");
1274 QFile backupKritarcFile(backupKritarcPath);
1276 if (backupKritarcFile.exists()) {
1277 backupKritarcFile.remove();
1280 QMessageBox::information(qApp->activeWindow(),
1281 i18nc(
"@title:window",
"Krita"),
1282 i18n(
"Krita configurations reset!\n\n"
1283 "Backup file was created at: %1\n\n"
1284 "Restart Krita for changes to take effect.",
1286 QMessageBox::Ok, QMessageBox::Ok);
1289 kritarcFile.rename(backupKritarcPath);
1291 kritarcFile.close();
1294 QMessageBox::warning(qApp->activeWindow(),
1295 i18nc(
"@title:window",
"Krita"),
1296 i18n(
"Failed to clear %1\n\n"
1297 "Please make sure no other program is using the file and try again.",
1299 QMessageBox::Ok, QMessageBox::Ok);
1305 config->reparseConfiguration();
1309 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"MainWindow");
1311 QString currentWorkspace = cfg.readEntry<QString>(
"CurrentWorkspace",
"Default");
1316 d->mainWindow->restoreWorkspace(workspace);
1322 bool ok = QMessageBox::question(qApp->activeWindow(),
1323 i18nc(
"@title:window",
"Krita"),
1324 i18n(
"Do you want to clear the settings file?"),
1325 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes;
1333 return d->extendedModifiersPluginInterface.data();
1339 if (!
d->androidDonations) {
1341 d->androidDonations->syncState();
1343 return d->androidDonations;
1348#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
1351 return d->androidScaling;
QList< QString > QStringList
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
const quint8 OPACITY_OPAQUE_U8
void setCurrentTheme(const QString &name)
static KisActionRegistry * instance()
static void setLoaded(bool loaded)
static void showDonationDialog(bool splash)
static void setLoadingText(const QString &text)
QVector< QByteArray > earlyRemoteArguments
QPointer< KisSplashScreen > splashScreen
QScopedPointer< KisExtendedModifiersMapperPluginInterface > extendedModifiersPluginInterface
QPointer< KisMainWindow > mainWindow
QVector< QString > earlyFileOpenEvents
ResetStarting(KisSplashScreen *splash, int fileCount)
QPointer< KisSplashScreen > m_splash
Base class for the Krita app.
bool notify(QObject *receiver, QEvent *event) override
Overridden to handle exceptions from event handlers.
void setSplashScreenLoadingText(const QString &)
bool event(QEvent *event) override
virtual bool start(const KisApplicationArguments &args)
void remoteArguments(const QString &message)
void executeRemoteArguments(QByteArray message, KisMainWindow *mainWindow)
KisApplication(const QString &key, int &argc, char **argv)
KisExtendedModifiersMapperPluginInterface * extendedModifiersPluginInterface()
void slotSetLongPress(bool enabled)
void setSplashScreen(QWidget *splash)
void fileOpenRequested(const QString &url)
QScopedPointer< Private > d
~KisApplication() override
void initializeGlobals(const KisApplicationArguments &args)
void checkAutosaveFiles()
bool createNewDocFromTemplate(const QString &fileName, KisMainWindow *m_mainWindow)
bool isStoreApplication()
static void verifyMetatypeRegistration()
void processPostponedSynchronizationEvents()
Result regenerateRange(KisViewManager *viewManager) override
start generation of frames and (if not in batch mode) show the dialog
void setBatchMode(bool value)
setting batch mode to true will prevent any dialogs or message boxes from showing on screen....
static QString autoSaveLocation()
void sigLongPressChanged(bool enabled)
static KisConfigNotifier * instance()
QString widgetStyle(bool defaultValue=false)
void setCanvasState(const QString &state) const
void writeEntry(const QString &name, const T &value)
SessionOnStartup sessionOnStartup(bool defaultValue=false) const
IconsInMenu iconsInMenu(bool defaultValue=false) const
bool longPressEnabled(bool defaultValue=false) const
T readEntry(const QString &name, const T &defaultValue=T())
QString canvasState(bool defaultValue=false) const
void setFileBatchMode(const bool batchMode)
QString errorMessage() const
bool exportDocumentSync(const QString &path, const QByteArray &mimeType, KisPropertiesConfigurationSP exportConfiguration=0)
bool openPath(const QString &path, OpenFlags flags=None)
openPath Open a Path
The KisFileLayer class loads a particular file as a layer into the layer stack.
static KisFilterRegistry * instance()
static KisGeneratorRegistry * instance()
const KisTimeSpan & documentPlaybackRange() const
documentPlaybackRange
bool hasAnimation() const
KisImageAnimationInterface * animationInterface() const
QString nextLayerName(const QString &baseName="") const
bool openDocument(const QString &path, OpenFlags flags)
KisViewManager * viewManager
static QString mimeTypeForFile(const QString &file, bool checkExistingFiles=true)
Find the mimetype for the given filename. The filename must include a suffix.
static QString mimeTypeForSuffix(const QString &suffix)
Find the mimetype for a given extension. The extension may have the form "*.xxx" or "xxx".
void addNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis, KisImageLayerAddCommand::Flags flags=KisImageLayerAddCommand::DoRedoUpdates|KisImageLayerAddCommand::DoUndoUpdates)
static KisPaintOpRegistry * instance()
QList< QPointer< KisMainWindow > > mainWindows
static KisPart * instance()
bool restoreSession(const QString &sessionName)
void addDocument(KisDocument *document, bool notify=true)
KisMainWindow * currentMainwindow() const
KisDocument * createDocument() const
void showSessionManager()
KisMainWindow * createMainWindow(QUuid id=QUuid())
static void performHouseKeepingOnExit()
perform optimize and vacuum when necessary
static void deleteTemporaryResources()
Delete all storages that are Unknown or Memory and all resources that are marked temporary or belong ...
static bool initialize(const QString &location)
initializes the database and updates the scheme if necessary. Does not actually fill the database wit...
static QString lastError()
lastError returns the last SQL error.
The KisResourceLoaderRegistry class manages the loader plugins for resources. Every resource can be l...
static KisResourceLoaderRegistry * instance()
void registerFixup(int priority, ResourceCacheFixup *fixup)
LocatorError initialize(const QString &installationResourcesLocation)
initialize Setup the resource locator for use.
static KisResourceLocator * instance()
static KisResourceServerProvider * instance()
KoResourceServer< KisWorkspaceResource > * workspaceServer()
KoResourceServer< KisWindowLayoutResource > * windowLayoutServer()
static KisSRGBSurfaceColorSpaceManager * tryCreateForCurrentPlatform(QWidget *widget)
static void clearUnitManagerBuilder()
static void setDefaultUnitManagerBuilder(KisSpinBoxUnitManagerBuilder *pBuilder)
set a builder the factory can use. The factory should take on the lifecycle of the builder,...
static void registerSynchronizedEventBarrier(std::function< void()> callback)
static void log(const QString &message)
Logs with date/time.
static QString screenInformation()
Returns information about all available screens.
static void writeSysInfo(const QString &message)
Writes to the system information file and Krita log.
KisImageWSP image() const
Return the image this view is displaying.
static KoDockRegistry * instance()
static QString getAppDataLocation()
static void addAssetType(const QString &type, const char *basetype, const QString &relativeName, bool priority=true)
static QString getApplicationRoot()
static QStringList findAllAssets(const QString &type, const QString &filter=QString(), SearchOptions options=NoSearchOptions)
static QString saveLocation(const QString &type, const QString &suffix=QString(), bool create=true)
QSharedPointer< T > resource(const QString &md5, const QString &fileName, const QString &name)
resource retrieves a resource. If the md5sum is not empty, the resource will only be retrieved if a r...
static KoShapeRegistry * instance()
The QtSingleApplication class provides an API to detect and communicate with running instances of an ...
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
constexpr const char * currentUnderlyingStyleNameProperty
static QVariantHash defaultStyle
QIcon loadIcon(const QString &name)
bool isRunningInPackage()
const QString StopGradients
const QString KritaPaintOpPresets
const QString SegmentedGradients
const QString FontFamilies
const QString LayerStyles
const QString SeExprScripts
const QString WindowLayouts
const QString PaintOpPresets
void setMouseCoalescingEnabled(bool enabled)
static KisApplicationArguments deserialize(QByteArray &serialized)
KisDocument * createDocumentFromArguments() const
Event type used for synchronizing connection in KisSynchronizedConnection.
const QPointer< QObject > destination
static KoColorSpaceRegistry * instance()