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>
118#include <QThreadStorage>
123#include <config-seexpr.h>
124#include <config-safe-asserts.h>
129#include <config-qt-patches-present.h>
130#include <config-use-surface-color-management-api.h>
132#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
135#include <QPlatformSurfaceEvent>
141const QTime appStartTime(QTime::currentTime());
145struct AppRecursionInfo {
146 ~AppRecursionInfo() {
151 int eventRecursionCount {0};
152 std::queue<KisSynchronizedConnectionEvent> postponedSynchronizationEvents;
155struct AppRecursionGuard {
156 AppRecursionGuard(AppRecursionInfo *info)
159 m_info->eventRecursionCount++;
164 m_info->eventRecursionCount--;
167 AppRecursionInfo *m_info {0};
188 bool batchRun {
false};
226 qputenv(
"QT_QUICK_BACKEND",
"software");
232 QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
238 if (qgetenv(
"KRITA_NO_STYLE_OVERRIDE").isEmpty()) {
240#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
245 if (!styles.contains(style()->objectName().toLower())) {
246 Q_FOREACH (
const QString & style, styles) {
247 if (!setStyle(style)) {
248 qDebug() <<
"No" << style <<
"available.";
251 qDebug() <<
"Set style" << style;
260 if(widgetStyleFromConfig !=
"") {
261 qApp->setStyle(widgetStyleFromConfig);
262#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
263 }
else if (style()->objectName().toLower() ==
"macintosh") {
265 qApp->setStyle(
"fusion");
268 }
else if (style()->objectName().toLower() ==
"macos") {
270 qApp->setStyle(
"fusion");
276 qDebug() <<
"Style override disabled, using" << style()->objectName();
291#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
297 struct PlatformWindowCreationFilter : QObject
299 using QObject::QObject;
301 bool eventFilter(QObject *watched, QEvent *event)
override {
302 if (event->type() == QEvent::PlatformSurface) {
303 QWidget *widget = qobject_cast<QWidget*>(watched);
304 if (!widget)
return false;
310 if (watched->property(
"krita_skip_srgb_surface_manager_assignment").toBool()) {
314 QPlatformSurfaceEvent *surfaceEvent =
static_cast<QPlatformSurfaceEvent*
>(event);
315 if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
316 QWindow *nativeWindow = widget->windowHandle();
329 this->installEventFilter(
new PlatformWindowCreationFilter(
this));
333#if defined(Q_OS_WIN) && defined(ENV32BIT)
334typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
336LPFN_ISWOW64PROCESS fnIsWow64Process;
340 BOOL bIsWow64 = FALSE;
346 fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
347 GetModuleHandle(TEXT(
"kernel32")),
"IsWow64Process");
349 if(0 != fnIsWow64Process)
351 if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
384#if defined HAVE_SEEXPR
404 if (
event->type() == QEvent::FileOpen) {
405 QFileOpenEvent *openEvent =
static_cast<QFileOpenEvent *
>(
event);
410 return QApplication::event(
event);
419 QStringList() <<
"application/x-krita-paintoppreset"));
447#if defined HAVE_SEEXPR
453 i18nc(
"Resource type name",
"Layer styles"),
454 QStringList() <<
"application/x-photoshop-style"));
465 QString databaseLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
469 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"), i18n(
"%1\n\nKrita will quit now.",
KisResourceCacheDb::lastError()));
475 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"),
KisResourceLocator::instance()->errorMessages().join(
'\n') + i18n(
"\n\nKrita will quit now."));
504 if (isWow64() && !cfg.
readEntry(
"WarnedAbout32Bits",
false)) {
505 QMessageBox::information(qApp->activeWindow(),
506 i18nc(
"@title:window",
"Krita: Warning"),
507 i18n(
"You are running a 32 bits build on a 64 bits Windows.\n"
508 "This is not recommended.\n"
509 "Please download and install the x64 build instead."));
517 if (opengl ==
"OPENGL_NOT_TRIED" ) {
520 else if (opengl !=
"OPENGL_SUCCESS" && opengl !=
"TRY_OPENGL") {
530 const bool exportAs = args.
exportAs();
534 d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
535 const bool needsMainWindow = (!exportAs && !exportSequence);
537 bool showmainWindow = (!exportAs && !exportSequence);
539 const bool showSplashScreen = !
d->batchRun && qEnvironmentVariableIsEmpty(
"NOSPLASH");
540 if (showSplashScreen &&
d->splashScreen) {
541 d->splashScreen->show();
542 d->splashScreen->repaint();
546 KConfigGroup group(KSharedConfig::openConfig(),
"theme");
553 Q_UNUSED(resetStarting);
573 if (needsMainWindow) {
579 bool sessionNeeded =
true;
582 if (!args.
session().isEmpty()) {
585 showmainWindow =
false;
586 sessionNeeded =
false;
589 KConfigGroup sessionCfg = KSharedConfig::openConfig()->group(
"session");
590 const QString &sessionName = sessionCfg.readEntry(
"previousSession");
603 windowLayout->applyLayout();
609 if (showmainWindow) {
616 d->mainWindow->restoreWorkspace(workspace);
621 d->mainWindow->viewManager()->switchCanvasOnly(
true);
625 d->mainWindow->showFullScreen();
653#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
654 auto setPageUpDownMouseButtonEmulationWorkaround = [](
bool enabled) {
655 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN, enabled);
658 &KisConfigNotifier::sigUsePageUpDownMouseButtonEmulationWorkaroundChanged,
660 setPageUpDownMouseButtonEmulationWorkaround);
661 setPageUpDownMouseButtonEmulationWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
670#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
671 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS,
true);
672 auto setHighFunctionKeyMouseButtonEmulationWorkaround = [](
bool enabled) {
676 &KisConfigNotifier::sigUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged,
678 setHighFunctionKeyMouseButtonEmulationWorkaround);
679 setHighFunctionKeyMouseButtonEmulationWorkaround(cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
686#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
687 auto setIgnoreHistoricTabletEventsWorkaround = [](
bool enabled) {
688 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS, enabled);
691 &KisConfigNotifier::sigUseIgnoreHistoricTabletEventsWorkaroundChanged,
693 setIgnoreHistoricTabletEventsWorkaround);
694 setIgnoreHistoricTabletEventsWorkaround(cfg.useIgnoreHistoricTabletEventsWorkaround());
702 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
707 int argsCount = args.
filenames().count();
710 for (
int argNumber = 0; argNumber < argsCount; argNumber++) {
711 QString fileName = args.
filenames().at(argNumber);
724 if (outputMimetype ==
"application/octetstream") {
725 dbgKrita << i18n(
"Mimetype not found, try using the -mimetype option") << Qt::endl;
731 bool result = doc->
openPath(fileName);
735 QTimer::singleShot(0,
this, SLOT(quit()));
739 if (exportFileName.isEmpty()) {
740 errKrita <<
"Export destination is not specified for" << fileName <<
"Please specify export destination with --export-filename option";
741 QTimer::singleShot(0,
this, SLOT(quit()));
745 qApp->processEvents();
751 errKrita <<
"Could not export " << fileName <<
"to" << exportFileName <<
":" << doc->
errorMessage();
753 QTimer::singleShot(0,
this, SLOT(quit()));
756 else if (exportSequence) {
760 qApp->processEvents();
763 errKrita <<
"This file has no animation." << Qt::endl;
764 QTimer::singleShot(0,
this, SLOT(quit()));
769 int sequenceStart = 0;
772 qDebug() <<
ppVar(exportFileName);
783 qDebug() <<
ppVar(result);
786 errKrita << i18n(
"Failed to render animation frames!") << Qt::endl;
789 QTimer::singleShot(0,
this, SLOT(quit()));
792 else if (
d->mainWindow) {
793 if (QFileInfo(fileName).fileName().endsWith(
".bundle", Qt::CaseInsensitive)) {
794 d->mainWindow->installBundle(fileName);
799 d->mainWindow->openDocument(fileName, flags);
808 if (
d->mainWindow->viewManager()->image()){
811 d->mainWindow->viewManager()->image()->nextLayerName(i18n(
"File layer")),
OPACITY_OPAQUE_U8);
812 QFileInfo fi(fileLayer->
path());
815 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
816 d->mainWindow->viewManager()->activeNode());
819 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
820 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
824 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
825 i18n(
"Cannot add the file layer: no document is open.\n\n"
826"You can create a new document using the --new-image option, or you can open an existing file.\n\n"
827"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)."));
830 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Warning"),
831 i18n(
"Cannot add the file layer: no document is open.\n"
832 "You can either create a new file using the --new-image option, or you can open an existing file."));
838 if (
d->splashScreen) {
839 d->splashScreen->displayLinks(
true);
840 d->splashScreen->displayRecentFiles(
true);
843 Q_FOREACH(
const QByteArray &message,
d->earlyRemoteArguments) {
850 if (!
d->earlyFileOpenEvents.isEmpty()) {
852 Q_FOREACH(QString fileName,
d->earlyFileOpenEvents) {
853 d->mainWindow->openDocument(fileName, QFlags<KisMainWindow::OpenFlag>());
873 d->splashScreen = qobject_cast<KisSplashScreen*>(splashScreen);
878 if (
d->splashScreen) {
879 d->splashScreen->setLoadingText(textToLoad);
880 d->splashScreen->repaint();
886 if (
d->splashScreen) {
888 d->splashScreen->hide();
903 AppRecursionInfo &info = s_recursionInfo->localData();
907 AppRecursionGuard guard(&info);
911 if (info.eventRecursionCount > 1) {
917 result = QApplication::notify(receiver,
event);
920 result = QApplication::notify(receiver,
event);
924 if (!info.eventRecursionCount) {
931 }
catch (std::exception &e) {
932 qWarning(
"Error %s sending event %i to object %s",
933 e.what(),
event->type(), qPrintable(receiver->objectName()));
935 qWarning(
"Error <unknown> sending event %i to object %s",
936 event->type(), qPrintable(receiver->objectName()));
943 AppRecursionInfo &info = s_recursionInfo->localData();
945 while (!info.postponedSynchronizationEvents.empty()) {
947 AppRecursionGuard guard(&info);
952 info.postponedSynchronizationEvents.pop();
955 qWarning() <<
"WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery";
959 QApplication::notify(typedEvent.
destination, &typedEvent);
965 if (qEnvironmentVariableIsSet(
"STEAMAPPID") || qEnvironmentVariableIsSet(
"SteamAppId")) {
969 if (applicationDirPath().toLower().contains(
"steam")) {
998#if !defined(HIDE_SAFE_ASSERTS) || defined(CRASH_ON_SAFE_ASSERTS)
1000 auto verifyTypeRegistered = [] (
const char *type) {
1001 const int typeId = QMetaType::type(type);
1004 qFatal(
"ERROR: type-id for metatype %s is not found", type);
1007 if (!QMetaType::isRegistered(typeId)) {
1008 qFatal(
"ERROR: metatype %s is not registered", type);
1012 verifyTypeRegistered(
"KisBrushSP");
1013 verifyTypeRegistered(
"KoSvgText::AutoValue");
1014 verifyTypeRegistered(
"KoSvgText::BackgroundProperty");
1015 verifyTypeRegistered(
"KoSvgText::StrokeProperty");
1016 verifyTypeRegistered(
"KoSvgText::TextTransformInfo");
1017 verifyTypeRegistered(
"KoSvgText::TextIndentInfo");
1018 verifyTypeRegistered(
"KoSvgText::TabSizeInfo");
1019 verifyTypeRegistered(
"KoSvgText::LineHeightInfo");
1020 verifyTypeRegistered(
"KisPaintopLodLimitations");
1021 verifyTypeRegistered(
"KisImageSP");
1022 verifyTypeRegistered(
"KisImageSignalType");
1023 verifyTypeRegistered(
"KisNodeSP");
1024 verifyTypeRegistered(
"KisNodeList");
1025 verifyTypeRegistered(
"KisPaintDeviceSP");
1026 verifyTypeRegistered(
"KisTimeSpan");
1027 verifyTypeRegistered(
"KoColor");
1028 verifyTypeRegistered(
"KoResourceSP");
1029 verifyTypeRegistered(
"KoResourceCacheInterfaceSP");
1030 verifyTypeRegistered(
"KisAsyncAnimationRendererBase::CancelReason");
1031 verifyTypeRegistered(
"KisGridConfig");
1032 verifyTypeRegistered(
"KisGuidesConfig");
1033 verifyTypeRegistered(
"KisUpdateInfoSP");
1034 verifyTypeRegistered(
"KisToolChangesTrackerDataSP");
1035 verifyTypeRegistered(
"QVector<QImage>");
1036 verifyTypeRegistered(
"SnapshotDirInfoList");
1037 verifyTypeRegistered(
"TransformTransactionProperties");
1038 verifyTypeRegistered(
"ToolTransformArgs");
1039 verifyTypeRegistered(
"QPainterPath");
1048 const int argsCount = args.
filenames().count();
1049 bool documentCreated =
false;
1056 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
1059 if (argsCount > 0) {
1061 for (
int argNumber = 0; argNumber < argsCount; ++argNumber) {
1062 QString filename = args.
filenames().at(argNumber);
1067 else if (QFile(filename).exists()) {
1069 documentCreated |= mainWindow->
openDocument(filename, flags);
1076 if (argsCount > 0 && !documentCreated){
1078 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1079 i18n(
"Couldn't open file %1",args.
filenames().at(argsCount - 1)));
1085 QFileInfo fi(fileLayer->
path());
1088 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
1089 d->mainWindow->viewManager()->activeNode());
1092 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1093 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
1097 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1098 i18n(
"Cannot add the file layer: no document is open."));
1107 KisMainWindow *mw = qobject_cast<KisMainWindow*>(qApp->activeWindow());
1113 const QByteArray unpackedMessage =
1114 QByteArray::fromBase64(message.toLatin1());
1117 d->earlyRemoteArguments << unpackedMessage;
1125 if (!
d->mainWindow) {
1126 d->earlyFileOpenEvents.append(url);
1131 d->mainWindow->openDocument(url, flags);
1137 if (enabled && !
d->longPressEventFilter) {
1139 installEventFilter(
d->longPressEventFilter);
1140 }
else if (!enabled &&
d->longPressEventFilter) {
1141 removeEventFilter(
d->longPressEventFilter);
1142 d->longPressEventFilter->deleteLater();
1143 d->longPressEventFilter =
nullptr;
1149 if (
d->batchRun)
return;
1160 QStringList autosaveFiles = dir.entryList(filters, QDir::Files | QDir::Hidden);
1163 filters =
QStringList() << QString(
"krita-*-*-autosave.kra");
1164 autosaveFiles += dir.entryList(filters, QDir::Files);
1167 if (autosaveFiles.size() > 0) {
1168 if (
d->splashScreen) {
1170 d->splashScreen->hide();
1173 QDialog::DialogCode result = (QDialog::DialogCode)
d->autosaveDialog->exec();
1175 if (result == QDialog::Accepted) {
1176 QStringList filesToRecover =
d->autosaveDialog->recoverableFiles();
1177 Q_FOREACH (
const QString &autosaveFile, autosaveFiles) {
1178 if (!filesToRecover.contains(autosaveFile)) {
1179 KisUsageLogger::log(QString(
"Removing autosave file %1").arg(dir.absolutePath() +
"/" + autosaveFile));
1180 QFile::remove(dir.absolutePath() +
"/" + autosaveFile);
1183 autosaveFiles = filesToRecover;
1185 autosaveFiles.clear();
1188 if (autosaveFiles.size() > 0) {
1190 Q_FOREACH (
const QString &autoSaveFile, autosaveFiles) {
1191 const QString path = dir.absolutePath() + QLatin1Char(
'/') + autoSaveFile;
1192 autosavePaths << path;
1194 if (
d->mainWindow) {
1195 Q_FOREACH (
const QString &path, autosavePaths) {
1202 delete d->autosaveDialog;
1203 d->autosaveDialog =
nullptr;
1209 QString templatePath;
1211 if (QFile::exists(fileName)) {
1212 templatePath = fileName;
1213 dbgUI <<
"using full path...";
1216 QString desktopName(fileName);
1217 const QString templatesResourcePath = QStringLiteral(
"templates/");
1220 if (paths.isEmpty()) {
1224 if (paths.isEmpty()) {
1225 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1226 i18n(
"No template found for: %1", desktopName));
1227 }
else if (paths.count() > 1) {
1228 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1229 i18n(
"Too many templates found for: %1", desktopName));
1231 templatePath = paths.at(0);
1235 if (!templatePath.isEmpty()) {
1236 KDesktopFile templateInfo(templatePath);
1240 dbgUI <<
"Template loaded...";
1244 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1245 i18n(
"Template %1 failed to load.", fileName));
1256 KSharedConfigPtr config = KSharedConfig::openConfig();
1257 config->markAsClean();
1260 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1261 QString kritarcPath = configPath + QStringLiteral(
"/kritarc");
1263 QFile kritarcFile(kritarcPath);
1265 if (kritarcFile.exists()) {
1266 if (kritarcFile.open(QFile::ReadWrite)) {
1267 QString backupKritarcPath = kritarcPath + QStringLiteral(
".backup");
1269 QFile backupKritarcFile(backupKritarcPath);
1271 if (backupKritarcFile.exists()) {
1272 backupKritarcFile.remove();
1275 QMessageBox::information(qApp->activeWindow(),
1276 i18nc(
"@title:window",
"Krita"),
1277 i18n(
"Krita configurations reset!\n\n"
1278 "Backup file was created at: %1\n\n"
1279 "Restart Krita for changes to take effect.",
1281 QMessageBox::Ok, QMessageBox::Ok);
1284 kritarcFile.rename(backupKritarcPath);
1286 kritarcFile.close();
1289 QMessageBox::warning(qApp->activeWindow(),
1290 i18nc(
"@title:window",
"Krita"),
1291 i18n(
"Failed to clear %1\n\n"
1292 "Please make sure no other program is using the file and try again.",
1294 QMessageBox::Ok, QMessageBox::Ok);
1300 config->reparseConfiguration();
1304 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"MainWindow");
1306 QString currentWorkspace = cfg.readEntry<QString>(
"CurrentWorkspace",
"Default");
1311 d->mainWindow->restoreWorkspace(workspace);
1317 bool ok = QMessageBox::question(qApp->activeWindow(),
1318 i18nc(
"@title:window",
"Krita"),
1319 i18n(
"Do you want to clear the settings file?"),
1320 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes;
1328 return d->extendedModifiersPluginInterface.data();
1334 if (!
d->androidDonations) {
1336 d->androidDonations->syncState();
1338 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_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()
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()