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>
47#include <kaboutdata.h>
120#include <QThreadStorage>
125#include <config-seexpr.h>
126#include <config-safe-asserts.h>
131#include <config-qt-patches-present.h>
132#include <config-use-surface-color-management-api.h>
134#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
137#include <QPlatformSurfaceEvent>
143const QTime appStartTime(QTime::currentTime());
147struct AppRecursionInfo {
148 ~AppRecursionInfo() {
153 int eventRecursionCount {0};
154 std::queue<KisSynchronizedConnectionEvent> postponedSynchronizationEvents;
157struct AppRecursionGuard {
158 AppRecursionGuard(AppRecursionInfo *info)
161 m_info->eventRecursionCount++;
166 m_info->eventRecursionCount--;
169 AppRecursionInfo *m_info {0};
190 bool batchRun {
false};
228 qputenv(
"QT_QUICK_BACKEND",
"software");
234 QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
240 KAboutData aboutData(
"krita",
243 i18nc(
"@title",
"Krita is the full-featured digital art studio"),
245 i18nc(
"@info:credit",
"© 1999–2026 The Krita Developers"));
246 aboutData.setHomepage(QStringLiteral(
"https://krita.org"));
247 aboutData.setOrganizationDomain(
"krita.org");
250 KAboutData::setApplicationData(aboutData);
255 this->setOrganizationName(
"");
263 if (qgetenv(
"KRITA_NO_STYLE_OVERRIDE").isEmpty()) {
265#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
270 if (!styles.contains(style()->objectName().toLower())) {
271 Q_FOREACH (
const QString & style, styles) {
272 if (!setStyle(style)) {
273 qDebug() <<
"No" << style <<
"available.";
276 qDebug() <<
"Set style" << style;
285 if(widgetStyleFromConfig !=
"") {
286 qApp->setStyle(widgetStyleFromConfig);
287#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
288 }
else if (style()->objectName().toLower() ==
"macintosh") {
290 qApp->setStyle(
"fusion");
293 }
else if (style()->objectName().toLower() ==
"macos") {
295 qApp->setStyle(
"fusion");
301 qDebug() <<
"Style override disabled, using" << style()->objectName();
316#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
322 struct PlatformWindowCreationFilter : QObject
324 using QObject::QObject;
326 bool eventFilter(QObject *watched, QEvent *event)
override {
327 if (event->type() == QEvent::PlatformSurface) {
328 QWidget *widget = qobject_cast<QWidget*>(watched);
329 if (!widget)
return false;
335 if (watched->property(
"krita_skip_srgb_surface_manager_assignment").toBool()) {
339 QPlatformSurfaceEvent *surfaceEvent =
static_cast<QPlatformSurfaceEvent*
>(event);
340 if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
341 QWindow *nativeWindow = widget->windowHandle();
354 this->installEventFilter(
new PlatformWindowCreationFilter(
this));
358#if defined(Q_OS_WIN) && defined(ENV32BIT)
359typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
361LPFN_ISWOW64PROCESS fnIsWow64Process;
365 BOOL bIsWow64 = FALSE;
371 fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
372 GetModuleHandle(TEXT(
"kernel32")),
"IsWow64Process");
374 if(0 != fnIsWow64Process)
376 if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
409#if defined HAVE_SEEXPR
429 if (
event->type() == QEvent::FileOpen) {
430 QFileOpenEvent *openEvent =
static_cast<QFileOpenEvent *
>(
event);
435 return QApplication::event(
event);
444 QStringList() <<
"application/x-krita-paintoppreset"));
472#if defined HAVE_SEEXPR
478 i18nc(
"Resource type name",
"Layer styles"),
479 QStringList() <<
"application/x-photoshop-style"));
490 QString databaseLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
494 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"), i18n(
"%1\n\nKrita will quit now.",
KisResourceCacheDb::lastError()));
500 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"),
KisResourceLocator::instance()->errorMessages().join(
'\n') + i18n(
"\n\nKrita will quit now."));
529 if (isWow64() && !cfg.
readEntry(
"WarnedAbout32Bits",
false)) {
530 QMessageBox::information(qApp->activeWindow(),
531 i18nc(
"@title:window",
"Krita: Warning"),
532 i18n(
"You are running a 32 bits build on a 64 bits Windows.\n"
533 "This is not recommended.\n"
534 "Please download and install the x64 build instead."));
542 if (opengl ==
"OPENGL_NOT_TRIED" ) {
545 else if (opengl !=
"OPENGL_SUCCESS" && opengl !=
"TRY_OPENGL") {
555 const bool exportAs = args.
exportAs();
559 d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
560 const bool needsMainWindow = (!exportAs && !exportSequence);
562 bool showmainWindow = (!exportAs && !exportSequence);
564 const bool showSplashScreen = !
d->batchRun && qEnvironmentVariableIsEmpty(
"NOSPLASH");
565 if (showSplashScreen &&
d->splashScreen) {
566 d->splashScreen->show();
567 d->splashScreen->repaint();
571 KConfigGroup group(KSharedConfig::openConfig(),
"theme");
578 Q_UNUSED(resetStarting);
598 if (needsMainWindow) {
604 bool sessionNeeded =
true;
607 if (!args.
session().isEmpty()) {
610 showmainWindow =
false;
611 sessionNeeded =
false;
614 KConfigGroup sessionCfg = KSharedConfig::openConfig()->group(
"session");
615 const QString &sessionName = sessionCfg.readEntry(
"previousSession");
628 windowLayout->applyLayout();
634 if (showmainWindow) {
641 d->mainWindow->restoreWorkspace(workspace);
646 d->mainWindow->viewManager()->switchCanvasOnly(
true);
650 d->mainWindow->showFullScreen();
656 short int numberOfOpenDocuments = 0;
679#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
680 auto setPageUpDownMouseButtonEmulationWorkaround = [](
bool enabled) {
681 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN, enabled);
684 &KisConfigNotifier::sigUsePageUpDownMouseButtonEmulationWorkaroundChanged,
686 setPageUpDownMouseButtonEmulationWorkaround);
687 setPageUpDownMouseButtonEmulationWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
694#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
695 auto setIgnoreHistoricTabletEventsWorkaround = [](
bool enabled) {
696 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS, enabled);
699 &KisConfigNotifier::sigUseIgnoreHistoricTabletEventsWorkaroundChanged,
701 setIgnoreHistoricTabletEventsWorkaround);
702 setIgnoreHistoricTabletEventsWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
710 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
715 int argsCount = args.
filenames().count();
718 for (
int argNumber = 0; argNumber < argsCount; argNumber++) {
719 QString fileName = args.
filenames().at(argNumber);
727 ++numberOfOpenDocuments;
734 if (outputMimetype ==
"application/octetstream") {
735 dbgKrita << i18n(
"Mimetype not found, try using the -mimetype option") << Qt::endl;
741 bool result = doc->
openPath(fileName);
745 QTimer::singleShot(0,
this, SLOT(quit()));
749 if (exportFileName.isEmpty()) {
750 errKrita <<
"Export destination is not specified for" << fileName <<
"Please specify export destination with --export-filename option";
751 QTimer::singleShot(0,
this, SLOT(quit()));
755 qApp->processEvents();
761 errKrita <<
"Could not export " << fileName <<
"to" << exportFileName <<
":" << doc->
errorMessage();
763 QTimer::singleShot(0,
this, SLOT(quit()));
766 else if (exportSequence) {
770 qApp->processEvents();
773 errKrita <<
"This file has no animation." << Qt::endl;
774 QTimer::singleShot(0,
this, SLOT(quit()));
779 int sequenceStart = 0;
782 qDebug() <<
ppVar(exportFileName);
793 qDebug() <<
ppVar(result);
796 errKrita << i18n(
"Failed to render animation frames!") << Qt::endl;
799 QTimer::singleShot(0,
this, SLOT(quit()));
802 else if (
d->mainWindow) {
803 if (QFileInfo(fileName).fileName().endsWith(
".bundle", Qt::CaseInsensitive)) {
804 d->mainWindow->installBundle(fileName);
809 if (
d->mainWindow->openDocument(fileName, flags)) {
811 numberOfOpenDocuments++;
821 if (
d->mainWindow->viewManager()->image()){
824 d->mainWindow->viewManager()->image()->nextLayerName(i18n(
"File layer")),
OPACITY_OPAQUE_U8);
825 QFileInfo fi(fileLayer->
path());
828 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
829 d->mainWindow->viewManager()->activeNode());
832 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
833 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
837 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
838 i18n(
"Cannot add the file layer: no document is open.\n\n"
839"You can create a new document using the --new-image option, or you can open an existing file.\n\n"
840"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)."));
843 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Warning"),
844 i18n(
"Cannot add the file layer: no document is open.\n"
845 "You can either create a new file using the --new-image option, or you can open an existing file."));
851 if (
d->splashScreen) {
852 d->splashScreen->displayLinks(
true);
853 d->splashScreen->displayRecentFiles(
true);
856 Q_FOREACH(
const QByteArray &message,
d->earlyRemoteArguments) {
863 if (!
d->earlyFileOpenEvents.isEmpty()) {
865 Q_FOREACH(QString fileName,
d->earlyFileOpenEvents) {
866 d->mainWindow->openDocument(fileName, QFlags<KisMainWindow::OpenFlag>());
886 d->splashScreen = qobject_cast<KisSplashScreen*>(splashScreen);
891 if (
d->splashScreen) {
892 d->splashScreen->setLoadingText(textToLoad);
893 d->splashScreen->repaint();
899 if (
d->splashScreen) {
901 d->splashScreen->hide();
916 AppRecursionInfo &info = s_recursionInfo->localData();
920 AppRecursionGuard guard(&info);
924 if (info.eventRecursionCount > 1) {
930 result = QApplication::notify(receiver,
event);
933 result = QApplication::notify(receiver,
event);
937 if (!info.eventRecursionCount) {
944 }
catch (std::exception &e) {
945 qWarning(
"Error %s sending event %i to object %s",
946 e.what(),
event->type(), qPrintable(receiver->objectName()));
948 qWarning(
"Error <unknown> sending event %i to object %s",
949 event->type(), qPrintable(receiver->objectName()));
956 AppRecursionInfo &info = s_recursionInfo->localData();
958 while (!info.postponedSynchronizationEvents.empty()) {
960 AppRecursionGuard guard(&info);
965 info.postponedSynchronizationEvents.pop();
968 qWarning() <<
"WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery";
972 QApplication::notify(typedEvent.
destination, &typedEvent);
978 if (qEnvironmentVariableIsSet(
"STEAMAPPID") || qEnvironmentVariableIsSet(
"SteamAppId")) {
982 if (applicationDirPath().toLower().contains(
"steam")) {
1011#if !defined(HIDE_SAFE_ASSERTS) || defined(CRASH_ON_SAFE_ASSERTS)
1013 auto verifyTypeRegistered = [] (
const char *type) {
1014 const int typeId = QMetaType::type(type);
1017 qFatal(
"ERROR: type-id for metatype %s is not found", type);
1020 if (!QMetaType::isRegistered(typeId)) {
1021 qFatal(
"ERROR: metatype %s is not registered", type);
1025 verifyTypeRegistered(
"KisBrushSP");
1026 verifyTypeRegistered(
"KoSvgText::AutoValue");
1027 verifyTypeRegistered(
"KoSvgText::BackgroundProperty");
1028 verifyTypeRegistered(
"KoSvgText::StrokeProperty");
1029 verifyTypeRegistered(
"KoSvgText::TextTransformInfo");
1030 verifyTypeRegistered(
"KoSvgText::TextIndentInfo");
1031 verifyTypeRegistered(
"KoSvgText::TabSizeInfo");
1032 verifyTypeRegistered(
"KoSvgText::LineHeightInfo");
1033 verifyTypeRegistered(
"KisPaintopLodLimitations");
1034 verifyTypeRegistered(
"KisImageSP");
1035 verifyTypeRegistered(
"KisImageSignalType");
1036 verifyTypeRegistered(
"KisNodeSP");
1037 verifyTypeRegistered(
"KisNodeList");
1038 verifyTypeRegistered(
"KisPaintDeviceSP");
1039 verifyTypeRegistered(
"KisTimeSpan");
1040 verifyTypeRegistered(
"KoColor");
1041 verifyTypeRegistered(
"KoResourceSP");
1042 verifyTypeRegistered(
"KoResourceCacheInterfaceSP");
1043 verifyTypeRegistered(
"KisAsyncAnimationRendererBase::CancelReason");
1044 verifyTypeRegistered(
"KisGridConfig");
1045 verifyTypeRegistered(
"KisGuidesConfig");
1046 verifyTypeRegistered(
"KisUpdateInfoSP");
1047 verifyTypeRegistered(
"KisToolChangesTrackerDataSP");
1048 verifyTypeRegistered(
"QVector<QImage>");
1049 verifyTypeRegistered(
"SnapshotDirInfoList");
1050 verifyTypeRegistered(
"TransformTransactionProperties");
1051 verifyTypeRegistered(
"ToolTransformArgs");
1052 verifyTypeRegistered(
"QPainterPath");
1061 const int argsCount = args.
filenames().count();
1062 bool documentCreated =
false;
1069 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
1072 if (argsCount > 0) {
1074 for (
int argNumber = 0; argNumber < argsCount; ++argNumber) {
1075 QString filename = args.
filenames().at(argNumber);
1080 else if (QFile(filename).exists()) {
1082 documentCreated |= mainWindow->
openDocument(filename, flags);
1089 if (argsCount > 0 && !documentCreated){
1091 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1092 i18n(
"Couldn't open file %1",args.
filenames().at(argsCount - 1)));
1098 QFileInfo fi(fileLayer->
path());
1101 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
1102 d->mainWindow->viewManager()->activeNode());
1105 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1106 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
1110 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1111 i18n(
"Cannot add the file layer: no document is open."));
1120 KisMainWindow *mw = qobject_cast<KisMainWindow*>(qApp->activeWindow());
1126 const QByteArray unpackedMessage =
1127 QByteArray::fromBase64(message.toLatin1());
1130 d->earlyRemoteArguments << unpackedMessage;
1138 if (!
d->mainWindow) {
1139 d->earlyFileOpenEvents.append(url);
1144 d->mainWindow->openDocument(url, flags);
1150 if (enabled && !
d->longPressEventFilter) {
1152 installEventFilter(
d->longPressEventFilter);
1153 }
else if (!enabled &&
d->longPressEventFilter) {
1154 removeEventFilter(
d->longPressEventFilter);
1155 d->longPressEventFilter->deleteLater();
1156 d->longPressEventFilter =
nullptr;
1162 if (
d->batchRun)
return;
1173 QStringList autosaveFiles = dir.entryList(filters, QDir::Files | QDir::Hidden);
1176 filters =
QStringList() << QString(
"krita-*-*-autosave.kra");
1177 autosaveFiles += dir.entryList(filters, QDir::Files);
1180 if (autosaveFiles.size() > 0) {
1181 if (
d->splashScreen) {
1183 d->splashScreen->hide();
1186 QDialog::DialogCode result = (QDialog::DialogCode)
d->autosaveDialog->exec();
1188 if (result == QDialog::Accepted) {
1189 QStringList filesToRecover =
d->autosaveDialog->recoverableFiles();
1190 Q_FOREACH (
const QString &autosaveFile, autosaveFiles) {
1191 if (!filesToRecover.contains(autosaveFile)) {
1192 KisUsageLogger::log(QString(
"Removing autosave file %1").arg(dir.absolutePath() +
"/" + autosaveFile));
1193 QFile::remove(dir.absolutePath() +
"/" + autosaveFile);
1196 autosaveFiles = filesToRecover;
1198 autosaveFiles.clear();
1201 if (autosaveFiles.size() > 0) {
1203 Q_FOREACH (
const QString &autoSaveFile, autosaveFiles) {
1204 const QString path = dir.absolutePath() + QLatin1Char(
'/') + autoSaveFile;
1205 autosavePaths << path;
1207 if (
d->mainWindow) {
1208 Q_FOREACH (
const QString &path, autosavePaths) {
1215 delete d->autosaveDialog;
1216 d->autosaveDialog =
nullptr;
1222 QString templatePath;
1224 if (QFile::exists(fileName)) {
1225 templatePath = fileName;
1226 dbgUI <<
"using full path...";
1229 QString desktopName(fileName);
1230 const QString templatesResourcePath = QStringLiteral(
"templates/");
1233 if (paths.isEmpty()) {
1237 if (paths.isEmpty()) {
1238 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1239 i18n(
"No template found for: %1", desktopName));
1240 }
else if (paths.count() > 1) {
1241 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1242 i18n(
"Too many templates found for: %1", desktopName));
1244 templatePath = paths.at(0);
1248 if (!templatePath.isEmpty()) {
1249 KDesktopFile templateInfo(templatePath);
1253 dbgUI <<
"Template loaded...";
1257 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1258 i18n(
"Template %1 failed to load.", fileName));
1269 KSharedConfigPtr config = KSharedConfig::openConfig();
1270 config->markAsClean();
1273 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1274 QString kritarcPath = configPath + QStringLiteral(
"/kritarc");
1276 QFile kritarcFile(kritarcPath);
1278 if (kritarcFile.exists()) {
1279 if (kritarcFile.open(QFile::ReadWrite)) {
1280 QString backupKritarcPath = kritarcPath + QStringLiteral(
".backup");
1282 QFile backupKritarcFile(backupKritarcPath);
1284 if (backupKritarcFile.exists()) {
1285 backupKritarcFile.remove();
1288 QMessageBox::information(qApp->activeWindow(),
1289 i18nc(
"@title:window",
"Krita"),
1290 i18n(
"Krita configurations reset!\n\n"
1291 "Backup file was created at: %1\n\n"
1292 "Restart Krita for changes to take effect.",
1294 QMessageBox::Ok, QMessageBox::Ok);
1297 kritarcFile.rename(backupKritarcPath);
1299 kritarcFile.close();
1302 QMessageBox::warning(qApp->activeWindow(),
1303 i18nc(
"@title:window",
"Krita"),
1304 i18n(
"Failed to clear %1\n\n"
1305 "Please make sure no other program is using the file and try again.",
1307 QMessageBox::Ok, QMessageBox::Ok);
1313 config->reparseConfiguration();
1317 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"MainWindow");
1319 QString currentWorkspace = cfg.readEntry<QString>(
"CurrentWorkspace",
"Default");
1324 d->mainWindow->restoreWorkspace(workspace);
1330 bool ok = QMessageBox::question(qApp->activeWindow(),
1331 i18nc(
"@title:window",
"Krita"),
1332 i18n(
"Do you want to clear the settings file?"),
1333 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes;
1341 return d->extendedModifiersPluginInterface.data();
1347 if (!
d->androidDonations) {
1349 d->androidDonations->syncState();
1351 return d->androidDonations;
QList< QString > QStringList
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
const quint8 OPACITY_OPAQUE_U8
void setCurrentTheme(const QString &name)
static KisActionRegistry * instance()
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
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(cond)
#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
QIcon loadIcon(const QString &name)
bool isRunningInPackage()
KRITAVERSION_EXPORT QString versionString(bool checkGit=false)
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()