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>
143#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
149const QTime appStartTime(QTime::currentTime());
153struct AppRecursionInfo {
154 ~AppRecursionInfo() {
159 int eventRecursionCount {0};
160 std::queue<KisSynchronizedConnectionEvent> postponedSynchronizationEvents;
163struct AppRecursionGuard {
164 AppRecursionGuard(AppRecursionInfo *info)
167 m_info->eventRecursionCount++;
172 m_info->eventRecursionCount--;
175 AppRecursionInfo *m_info {0};
196 bool batchRun {
false};
202#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
237 qputenv(
"QT_QUICK_BACKEND",
"software");
243 QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
253 if (!widgetStyleFromConfig.isEmpty()) {
254 qApp->setStyle(widgetStyleFromConfig);
256#if defined Q_OS_WIN || defined Q_OS_MACOS || defined Q_OS_ANDROID
259 qApp->setStyle(
"fusion");
275#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
281 struct PlatformWindowCreationFilter : QObject
283 using QObject::QObject;
285 bool eventFilter(QObject *watched, QEvent *event)
override {
286 if (event->type() == QEvent::PlatformSurface) {
287 QWidget *widget = qobject_cast<QWidget*>(watched);
288 if (!widget)
return false;
294 if (watched->property(
"krita_skip_srgb_surface_manager_assignment").toBool()) {
298 QPlatformSurfaceEvent *surfaceEvent =
static_cast<QPlatformSurfaceEvent*
>(event);
299 if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
300 QWindow *nativeWindow = widget->windowHandle();
313 this->installEventFilter(
new PlatformWindowCreationFilter(
this));
317#if defined(Q_OS_WIN) && defined(ENV32BIT)
318typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
320LPFN_ISWOW64PROCESS fnIsWow64Process;
324 BOOL bIsWow64 = FALSE;
330 fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
331 GetModuleHandle(TEXT(
"kernel32")),
"IsWow64Process");
333 if(0 != fnIsWow64Process)
335 if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
370#if defined HAVE_SEEXPR
390 if (
event->type() == QEvent::FileOpen) {
391 QFileOpenEvent *openEvent =
static_cast<QFileOpenEvent *
>(
event);
396 return QApplication::event(
event);
407 QStringList() <<
"application/x-krita-paintoppreset"));
435#if defined HAVE_SEEXPR
441 i18nc(
"Resource type name",
"Layer styles"),
442 QStringList() <<
"application/x-photoshop-style"));
453 QString databaseLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
457 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"), i18n(
"%1\n\nKrita will quit now.",
KisResourceCacheDb::lastError()));
463 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"),
KisResourceLocator::instance()->errorMessages().join(
'\n') + i18n(
"\n\nKrita will quit now."));
496 QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus,
false);
498 QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus,
true);
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") {
528#if defined(Q_OS_ANDROID) && KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
534 const bool exportAs = args.
exportAs();
538 d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
539 const bool needsMainWindow = (!exportAs && !exportSequence);
541 bool showmainWindow = (!exportAs && !exportSequence);
544 const bool showSplashScreen = !
d->batchRun && qEnvironmentVariableIsEmpty(
"NOSPLASH");
545 if (showSplashScreen &&
d->splashScreen) {
546 d->splashScreen->show();
547 d->splashScreen->repaint();
552 KConfigGroup group(KSharedConfig::openConfig(),
"theme");
559 Q_UNUSED(resetStarting);
579 if (needsMainWindow) {
585 bool sessionNeeded =
true;
588 if (!args.
session().isEmpty()) {
591 showmainWindow =
false;
592 sessionNeeded =
false;
595 KConfigGroup sessionCfg = KSharedConfig::openConfig()->group(
"session");
596 const QString &sessionName = sessionCfg.readEntry(
"previousSession");
609 windowLayout->applyLayout();
615 if (showmainWindow) {
622 d->mainWindow->restoreWorkspace(workspace);
627 d->mainWindow->viewManager()->switchCanvasOnly(
true);
631 d->mainWindow->showFullScreen();
662#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
663 auto setPageUpDownMouseButtonEmulationWorkaround = [](
bool enabled) {
664 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN, enabled);
667 &KisConfigNotifier::sigUsePageUpDownMouseButtonEmulationWorkaroundChanged,
669 setPageUpDownMouseButtonEmulationWorkaround);
670 setPageUpDownMouseButtonEmulationWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
679#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
680 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS,
true);
681 auto setHighFunctionKeyMouseButtonEmulationWorkaround = [](
bool enabled) {
685 &KisConfigNotifier::sigUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged,
687 setHighFunctionKeyMouseButtonEmulationWorkaround);
688 setHighFunctionKeyMouseButtonEmulationWorkaround(cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
695#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
696 auto setIgnoreHistoricTabletEventsWorkaround = [](
bool enabled) {
697 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS, enabled);
700 &KisConfigNotifier::sigUseIgnoreHistoricTabletEventsWorkaroundChanged,
702 setIgnoreHistoricTabletEventsWorkaround);
703 setIgnoreHistoricTabletEventsWorkaround(cfg.useIgnoreHistoricTabletEventsWorkaround());
711 auto setHideTouchAndStylusCursorsWorkaround = [](
bool enabled) {
715 &KisConfigNotifier::sigHideTouchAndStylusCursorsWorkaroundChanged,
717 setHideTouchAndStylusCursorsWorkaround);
718 setHideTouchAndStylusCursorsWorkaround(cfg.hideTouchAndStylusCursorsWorkaround());
727 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
732 int argsCount = args.
filenames().count();
735 for (
int argNumber = 0; argNumber < argsCount; argNumber++) {
736 QString fileName = args.
filenames().at(argNumber);
749 if (outputMimetype ==
"application/octetstream") {
750 dbgKrita << i18n(
"Mimetype not found, try using the -mimetype option") << Qt::endl;
756 bool result = doc->
openPath(fileName);
760 QTimer::singleShot(0,
this, SLOT(quit()));
764 if (exportFileName.isEmpty()) {
765 errKrita <<
"Export destination is not specified for" << fileName <<
"Please specify export destination with --export-filename option";
766 QTimer::singleShot(0,
this, SLOT(quit()));
770 qApp->processEvents();
776 errKrita <<
"Could not export " << fileName <<
"to" << exportFileName <<
":" << doc->
errorMessage();
778 QTimer::singleShot(0,
this, SLOT(quit()));
781 else if (exportSequence) {
785 qApp->processEvents();
788 errKrita <<
"This file has no animation." << Qt::endl;
789 QTimer::singleShot(0,
this, SLOT(quit()));
794 int sequenceStart = 0;
797 qDebug() <<
ppVar(exportFileName);
808 qDebug() <<
ppVar(result);
811 errKrita << i18n(
"Failed to render animation frames!") << Qt::endl;
814 QTimer::singleShot(0,
this, SLOT(quit()));
817 else if (
d->mainWindow) {
818 if (QFileInfo(fileName).fileName().endsWith(
".bundle", Qt::CaseInsensitive)) {
819 d->mainWindow->installBundle(fileName);
824 d->mainWindow->openDocument(fileName, flags);
833 if (
d->mainWindow->viewManager()->image()){
836 d->mainWindow->viewManager()->image()->nextLayerName(i18n(
"File layer")),
OPACITY_OPAQUE_U8);
837 QFileInfo fi(fileLayer->
path());
840 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
841 d->mainWindow->viewManager()->activeNode());
844 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
845 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
849 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
850 i18n(
"Cannot add the file layer: no document is open.\n\n"
851"You can create a new document using the --new-image option, or you can open an existing file.\n\n"
852"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)."));
855 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Warning"),
856 i18n(
"Cannot add the file layer: no document is open.\n"
857 "You can either create a new file using the --new-image option, or you can open an existing file."));
861 Q_FOREACH(
const QByteArray &message,
d->earlyRemoteArguments) {
868 if (!
d->earlyFileOpenEvents.isEmpty()) {
870 Q_FOREACH(QString fileName,
d->earlyFileOpenEvents) {
871 d->mainWindow->openDocument(fileName, QFlags<KisMainWindow::OpenFlag>());
891 d->splashScreen = qobject_cast<KisSplashScreen*>(splashScreen);
896 if (
d->splashScreen) {
897 d->splashScreen->setLoadingText(textToLoad);
898 d->splashScreen->repaint();
910 if (
d->splashScreen) {
912 d->splashScreen->hide();
927 AppRecursionInfo &info = s_recursionInfo->localData();
931 AppRecursionGuard guard(&info);
935 if (info.eventRecursionCount > 1) {
941 result = QApplication::notify(receiver,
event);
944 result = QApplication::notify(receiver,
event);
948 if (!info.eventRecursionCount) {
955 }
catch (std::exception &e) {
956 qWarning(
"Error %s sending event %i to object %s",
957 e.what(),
event->type(), qPrintable(receiver->objectName()));
959 qWarning(
"Error <unknown> sending event %i to object %s",
960 event->type(), qPrintable(receiver->objectName()));
967 AppRecursionInfo &info = s_recursionInfo->localData();
969 while (!info.postponedSynchronizationEvents.empty()) {
971 AppRecursionGuard guard(&info);
976 info.postponedSynchronizationEvents.pop();
979 qWarning() <<
"WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery";
983 QApplication::notify(typedEvent.
destination, &typedEvent);
990 if (qEnvironmentVariableIsSet(
"STEAMAPPID") || qEnvironmentVariableIsSet(
"SteamAppId")
991 || qEnvironmentVariableIsSet(
"STEAMGAMEID") || qEnvironmentVariableIsSet(
"SteamGameId")) {
995 for (
const QString &arg : arguments()) {
996 if (arg.startsWith(
"-epicapp=", Qt::CaseInsensitive) || arg.compare(
"-EpicPortal", Qt::CaseInsensitive) == 0) {
1001 if (QDir(applicationDirPath()).exists(
".egstore")) {
1005 if (QRegularExpression(QStringLiteral(
"[/\\\\](?:steam|steamapps|epic\\s*games)[/\\\\]"),
1006 QRegularExpression::CaseInsensitiveOption)
1007 .match(applicationDirPath())
1037#if !defined(HIDE_SAFE_ASSERTS) || defined(CRASH_ON_SAFE_ASSERTS)
1039 auto verifyTypeRegistered = [] (
const char *type) {
1040 const int typeId = QMetaType::type(type);
1043 qFatal(
"ERROR: type-id for metatype %s is not found", type);
1046 if (!QMetaType::isRegistered(typeId)) {
1047 qFatal(
"ERROR: metatype %s is not registered", type);
1051 verifyTypeRegistered(
"KisBrushSP");
1052 verifyTypeRegistered(
"KoSvgText::AutoValue");
1053 verifyTypeRegistered(
"KoSvgText::BackgroundProperty");
1054 verifyTypeRegistered(
"KoSvgText::StrokeProperty");
1055 verifyTypeRegistered(
"KoSvgText::TextTransformInfo");
1056 verifyTypeRegistered(
"KoSvgText::TextIndentInfo");
1057 verifyTypeRegistered(
"KoSvgText::TabSizeInfo");
1058 verifyTypeRegistered(
"KoSvgText::LineHeightInfo");
1059 verifyTypeRegistered(
"KisPaintopLodLimitations");
1060 verifyTypeRegistered(
"KisImageSP");
1061 verifyTypeRegistered(
"KisImageSignalType");
1062 verifyTypeRegistered(
"KisNodeSP");
1063 verifyTypeRegistered(
"KisNodeList");
1064 verifyTypeRegistered(
"KisPaintDeviceSP");
1065 verifyTypeRegistered(
"KisTimeSpan");
1066 verifyTypeRegistered(
"KoColor");
1067 verifyTypeRegistered(
"KoResourceSP");
1068 verifyTypeRegistered(
"KoResourceCacheInterfaceSP");
1069 verifyTypeRegistered(
"KisAsyncAnimationRendererBase::CancelReason");
1070 verifyTypeRegistered(
"KisGridConfig");
1071 verifyTypeRegistered(
"KisGuidesConfig");
1072 verifyTypeRegistered(
"KisUpdateInfoSP");
1073 verifyTypeRegistered(
"KisToolChangesTrackerDataSP");
1074 verifyTypeRegistered(
"QVector<QImage>");
1075 verifyTypeRegistered(
"SnapshotDirInfoList");
1076 verifyTypeRegistered(
"TransformTransactionProperties");
1077 verifyTypeRegistered(
"ToolTransformArgs");
1078 verifyTypeRegistered(
"QPainterPath");
1087 const int argsCount = args.
filenames().count();
1088 bool documentCreated =
false;
1095 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
1098 if (argsCount > 0) {
1100 for (
int argNumber = 0; argNumber < argsCount; ++argNumber) {
1101 QString filename = args.
filenames().at(argNumber);
1106 else if (QFile(filename).exists()) {
1108 documentCreated |= mainWindow->
openDocument(filename, flags);
1115 if (argsCount > 0 && !documentCreated){
1117 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1118 i18n(
"Couldn't open file %1",args.
filenames().at(argsCount - 1)));
1124 QFileInfo fi(fileLayer->
path());
1127 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
1128 d->mainWindow->viewManager()->activeNode());
1131 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1132 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
1136 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1137 i18n(
"Cannot add the file layer: no document is open."));
1146 KisMainWindow *mw = qobject_cast<KisMainWindow*>(qApp->activeWindow());
1152 const QByteArray unpackedMessage =
1153 QByteArray::fromBase64(message.toLatin1());
1156 d->earlyRemoteArguments << unpackedMessage;
1164 if (!
d->mainWindow) {
1165 d->earlyFileOpenEvents.append(url);
1170 d->mainWindow->openDocument(url, flags);
1176 if (enabled && !
d->longPressEventFilter) {
1178 installEventFilter(
d->longPressEventFilter);
1179 }
else if (!enabled &&
d->longPressEventFilter) {
1180 removeEventFilter(
d->longPressEventFilter);
1181 d->longPressEventFilter->deleteLater();
1182 d->longPressEventFilter =
nullptr;
1188 if (
d->batchRun)
return;
1199 QStringList autosaveFiles = dir.entryList(filters, QDir::Files | QDir::Hidden);
1202 filters =
QStringList() << QString(
"krita-*-*-autosave.kra");
1203 autosaveFiles += dir.entryList(filters, QDir::Files);
1206 if (autosaveFiles.size() > 0) {
1207 if (
d->splashScreen) {
1212 QDialog::DialogCode result = (QDialog::DialogCode)
d->autosaveDialog->exec();
1214 if (result == QDialog::Accepted) {
1215 QStringList filesToRecover =
d->autosaveDialog->recoverableFiles();
1216 Q_FOREACH (
const QString &autosaveFile, autosaveFiles) {
1217 if (!filesToRecover.contains(autosaveFile)) {
1218 KisUsageLogger::log(QString(
"Removing autosave file %1").arg(dir.absolutePath() +
"/" + autosaveFile));
1219 QFile::remove(dir.absolutePath() +
"/" + autosaveFile);
1222 autosaveFiles = filesToRecover;
1224 autosaveFiles.clear();
1227 if (autosaveFiles.size() > 0) {
1229 Q_FOREACH (
const QString &autoSaveFile, autosaveFiles) {
1230 const QString path = dir.absolutePath() + QLatin1Char(
'/') + autoSaveFile;
1231 autosavePaths << path;
1233 if (
d->mainWindow) {
1234 Q_FOREACH (
const QString &path, autosavePaths) {
1241 delete d->autosaveDialog;
1242 d->autosaveDialog =
nullptr;
1248 QString templatePath;
1250 if (QFile::exists(fileName)) {
1251 templatePath = fileName;
1252 dbgUI <<
"using full path...";
1255 QString desktopName(fileName);
1256 const QString templatesResourcePath = QStringLiteral(
"templates/");
1259 if (paths.isEmpty()) {
1263 if (paths.isEmpty()) {
1264 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1265 i18n(
"No template found for: %1", desktopName));
1266 }
else if (paths.count() > 1) {
1267 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1268 i18n(
"Too many templates found for: %1", desktopName));
1270 templatePath = paths.at(0);
1274 if (!templatePath.isEmpty()) {
1275 KDesktopFile templateInfo(templatePath);
1279 dbgUI <<
"Template loaded...";
1283 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1284 i18n(
"Template %1 failed to load.", fileName));
1295 KSharedConfigPtr config = KSharedConfig::openConfig();
1296 config->markAsClean();
1299 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1300 QString kritarcPath = configPath + QStringLiteral(
"/kritarc");
1302 QFile kritarcFile(kritarcPath);
1304 if (kritarcFile.exists()) {
1305 if (kritarcFile.open(QFile::ReadWrite)) {
1306 QString backupKritarcPath = kritarcPath + QStringLiteral(
".backup");
1308 QFile backupKritarcFile(backupKritarcPath);
1310 if (backupKritarcFile.exists()) {
1311 backupKritarcFile.remove();
1314 QMessageBox::information(qApp->activeWindow(),
1315 i18nc(
"@title:window",
"Krita"),
1316 i18n(
"Krita configurations reset!\n\n"
1317 "Backup file was created at: %1\n\n"
1318 "Restart Krita for changes to take effect.",
1320 QMessageBox::Ok, QMessageBox::Ok);
1323 kritarcFile.rename(backupKritarcPath);
1325 kritarcFile.close();
1328 QMessageBox::warning(qApp->activeWindow(),
1329 i18nc(
"@title:window",
"Krita"),
1330 i18n(
"Failed to clear %1\n\n"
1331 "Please make sure no other program is using the file and try again.",
1333 QMessageBox::Ok, QMessageBox::Ok);
1339 config->reparseConfiguration();
1343 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"MainWindow");
1345 QString currentWorkspace = cfg.readEntry<QString>(
"CurrentWorkspace",
"Default");
1350 d->mainWindow->restoreWorkspace(workspace);
1356 bool ok = QMessageBox::question(qApp->activeWindow(),
1357 i18nc(
"@title:window",
"Krita"),
1358 i18n(
"Do you want to clear the settings file?"),
1359 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes;
1367 return d->extendedModifiersPluginInterface.data();
1373 if (!
d->androidDonations) {
1375 d->androidDonations->syncState();
1377 return d->androidDonations;
1382#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
1385 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)
static 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
void setHideTouchAndStylusCursors(bool hide)
bool canHideTouchAndStylusCursors()
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()