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>
140#if defined(Q_OS_ANDROID) && KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
145const QTime appStartTime(QTime::currentTime());
149struct AppRecursionInfo {
150 ~AppRecursionInfo() {
155 int eventRecursionCount {0};
156 std::queue<KisSynchronizedConnectionEvent> postponedSynchronizationEvents;
159struct AppRecursionGuard {
160 AppRecursionGuard(AppRecursionInfo *info)
163 m_info->eventRecursionCount++;
168 m_info->eventRecursionCount--;
171 AppRecursionInfo *m_info {0};
192 bool batchRun {
false};
198#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
233 qputenv(
"QT_QUICK_BACKEND",
"software");
239 QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
245 if (qgetenv(
"KRITA_NO_STYLE_OVERRIDE").isEmpty()) {
247#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
252 if (!styles.contains(style()->objectName().toLower())) {
253 Q_FOREACH (
const QString & style, styles) {
254 if (!setStyle(style)) {
255 qDebug() <<
"No" << style <<
"available.";
258 qDebug() <<
"Set style" << style;
267 if(widgetStyleFromConfig !=
"") {
268 qApp->setStyle(widgetStyleFromConfig);
269#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
270 }
else if (style()->objectName().toLower() ==
"macintosh") {
272 qApp->setStyle(
"fusion");
275 }
else if (style()->objectName().toLower() ==
"macos") {
277 qApp->setStyle(
"fusion");
283 qDebug() <<
"Style override disabled, using" << style()->objectName();
298#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
304 struct PlatformWindowCreationFilter : QObject
306 using QObject::QObject;
308 bool eventFilter(QObject *watched, QEvent *event)
override {
309 if (event->type() == QEvent::PlatformSurface) {
310 QWidget *widget = qobject_cast<QWidget*>(watched);
311 if (!widget)
return false;
317 if (watched->property(
"krita_skip_srgb_surface_manager_assignment").toBool()) {
321 QPlatformSurfaceEvent *surfaceEvent =
static_cast<QPlatformSurfaceEvent*
>(event);
322 if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
323 QWindow *nativeWindow = widget->windowHandle();
336 this->installEventFilter(
new PlatformWindowCreationFilter(
this));
340#if defined(Q_OS_WIN) && defined(ENV32BIT)
341typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
343LPFN_ISWOW64PROCESS fnIsWow64Process;
347 BOOL bIsWow64 = FALSE;
353 fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
354 GetModuleHandle(TEXT(
"kernel32")),
"IsWow64Process");
356 if(0 != fnIsWow64Process)
358 if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
391#if defined HAVE_SEEXPR
411 if (
event->type() == QEvent::FileOpen) {
412 QFileOpenEvent *openEvent =
static_cast<QFileOpenEvent *
>(
event);
417 return QApplication::event(
event);
426 QStringList() <<
"application/x-krita-paintoppreset"));
454#if defined HAVE_SEEXPR
460 i18nc(
"Resource type name",
"Layer styles"),
461 QStringList() <<
"application/x-photoshop-style"));
472 QString databaseLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
476 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"), i18n(
"%1\n\nKrita will quit now.",
KisResourceCacheDb::lastError()));
482 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Fatal error"),
KisResourceLocator::instance()->errorMessages().join(
'\n') + i18n(
"\n\nKrita will quit now."));
515 if (isWow64() && !cfg.
readEntry(
"WarnedAbout32Bits",
false)) {
516 QMessageBox::information(qApp->activeWindow(),
517 i18nc(
"@title:window",
"Krita: Warning"),
518 i18n(
"You are running a 32 bits build on a 64 bits Windows.\n"
519 "This is not recommended.\n"
520 "Please download and install the x64 build instead."));
528 if (opengl ==
"OPENGL_NOT_TRIED" ) {
531 else if (opengl !=
"OPENGL_SUCCESS" && opengl !=
"TRY_OPENGL") {
539#if defined(Q_OS_ANDROID) && KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
545 const bool exportAs = args.
exportAs();
549 d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
550 const bool needsMainWindow = (!exportAs && !exportSequence);
552 bool showmainWindow = (!exportAs && !exportSequence);
555 const bool showSplashScreen = !
d->batchRun && qEnvironmentVariableIsEmpty(
"NOSPLASH");
556 if (showSplashScreen &&
d->splashScreen) {
557 d->splashScreen->show();
558 d->splashScreen->repaint();
563 KConfigGroup group(KSharedConfig::openConfig(),
"theme");
570 Q_UNUSED(resetStarting);
590 if (needsMainWindow) {
596 bool sessionNeeded =
true;
599 if (!args.
session().isEmpty()) {
602 showmainWindow =
false;
603 sessionNeeded =
false;
606 KConfigGroup sessionCfg = KSharedConfig::openConfig()->group(
"session");
607 const QString &sessionName = sessionCfg.readEntry(
"previousSession");
620 windowLayout->applyLayout();
626 if (showmainWindow) {
633 d->mainWindow->restoreWorkspace(workspace);
638 d->mainWindow->viewManager()->switchCanvasOnly(
true);
642 d->mainWindow->showFullScreen();
673#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
674 auto setPageUpDownMouseButtonEmulationWorkaround = [](
bool enabled) {
675 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN, enabled);
678 &KisConfigNotifier::sigUsePageUpDownMouseButtonEmulationWorkaroundChanged,
680 setPageUpDownMouseButtonEmulationWorkaround);
681 setPageUpDownMouseButtonEmulationWorkaround(cfg.usePageUpDownMouseButtonEmulationWorkaround());
690#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
691 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS,
true);
692 auto setHighFunctionKeyMouseButtonEmulationWorkaround = [](
bool enabled) {
696 &KisConfigNotifier::sigUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged,
698 setHighFunctionKeyMouseButtonEmulationWorkaround);
699 setHighFunctionKeyMouseButtonEmulationWorkaround(cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
706#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
707 auto setIgnoreHistoricTabletEventsWorkaround = [](
bool enabled) {
708 QCoreApplication::setKritaAttribute(KRITA_QATTRIBUTE_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS, enabled);
711 &KisConfigNotifier::sigUseIgnoreHistoricTabletEventsWorkaroundChanged,
713 setIgnoreHistoricTabletEventsWorkaround);
714 setIgnoreHistoricTabletEventsWorkaround(cfg.useIgnoreHistoricTabletEventsWorkaround());
722 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
727 int argsCount = args.
filenames().count();
730 for (
int argNumber = 0; argNumber < argsCount; argNumber++) {
731 QString fileName = args.
filenames().at(argNumber);
744 if (outputMimetype ==
"application/octetstream") {
745 dbgKrita << i18n(
"Mimetype not found, try using the -mimetype option") << Qt::endl;
751 bool result = doc->
openPath(fileName);
755 QTimer::singleShot(0,
this, SLOT(quit()));
759 if (exportFileName.isEmpty()) {
760 errKrita <<
"Export destination is not specified for" << fileName <<
"Please specify export destination with --export-filename option";
761 QTimer::singleShot(0,
this, SLOT(quit()));
765 qApp->processEvents();
771 errKrita <<
"Could not export " << fileName <<
"to" << exportFileName <<
":" << doc->
errorMessage();
773 QTimer::singleShot(0,
this, SLOT(quit()));
776 else if (exportSequence) {
780 qApp->processEvents();
783 errKrita <<
"This file has no animation." << Qt::endl;
784 QTimer::singleShot(0,
this, SLOT(quit()));
789 int sequenceStart = 0;
792 qDebug() <<
ppVar(exportFileName);
803 qDebug() <<
ppVar(result);
806 errKrita << i18n(
"Failed to render animation frames!") << Qt::endl;
809 QTimer::singleShot(0,
this, SLOT(quit()));
812 else if (
d->mainWindow) {
813 if (QFileInfo(fileName).fileName().endsWith(
".bundle", Qt::CaseInsensitive)) {
814 d->mainWindow->installBundle(fileName);
819 d->mainWindow->openDocument(fileName, flags);
828 if (
d->mainWindow->viewManager()->image()){
831 d->mainWindow->viewManager()->image()->nextLayerName(i18n(
"File layer")),
OPACITY_OPAQUE_U8);
832 QFileInfo fi(fileLayer->
path());
835 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
836 d->mainWindow->viewManager()->activeNode());
839 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
840 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
844 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita:Warning"),
845 i18n(
"Cannot add the file layer: no document is open.\n\n"
846"You can create a new document using the --new-image option, or you can open an existing file.\n\n"
847"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)."));
850 QMessageBox::warning(qApp->activeWindow(), i18nc(
"@title:window",
"Krita: Warning"),
851 i18n(
"Cannot add the file layer: no document is open.\n"
852 "You can either create a new file using the --new-image option, or you can open an existing file."));
858 if (
d->splashScreen) {
859 d->splashScreen->displayLinks(
true);
860 d->splashScreen->displayRecentFiles(
true);
863 Q_FOREACH(
const QByteArray &message,
d->earlyRemoteArguments) {
870 if (!
d->earlyFileOpenEvents.isEmpty()) {
872 Q_FOREACH(QString fileName,
d->earlyFileOpenEvents) {
873 d->mainWindow->openDocument(fileName, QFlags<KisMainWindow::OpenFlag>());
893 d->splashScreen = qobject_cast<KisSplashScreen*>(splashScreen);
898 if (
d->splashScreen) {
899 d->splashScreen->setLoadingText(textToLoad);
900 d->splashScreen->repaint();
912 if (
d->splashScreen) {
914 d->splashScreen->hide();
929 AppRecursionInfo &info = s_recursionInfo->localData();
933 AppRecursionGuard guard(&info);
937 if (info.eventRecursionCount > 1) {
943 result = QApplication::notify(receiver,
event);
946 result = QApplication::notify(receiver,
event);
950 if (!info.eventRecursionCount) {
957 }
catch (std::exception &e) {
958 qWarning(
"Error %s sending event %i to object %s",
959 e.what(),
event->type(), qPrintable(receiver->objectName()));
961 qWarning(
"Error <unknown> sending event %i to object %s",
962 event->type(), qPrintable(receiver->objectName()));
969 AppRecursionInfo &info = s_recursionInfo->localData();
971 while (!info.postponedSynchronizationEvents.empty()) {
973 AppRecursionGuard guard(&info);
978 info.postponedSynchronizationEvents.pop();
981 qWarning() <<
"WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery";
985 QApplication::notify(typedEvent.
destination, &typedEvent);
991 if (qEnvironmentVariableIsSet(
"STEAMAPPID") || qEnvironmentVariableIsSet(
"SteamAppId")) {
995 if (applicationDirPath().toLower().contains(
"steam")) {
1024#if !defined(HIDE_SAFE_ASSERTS) || defined(CRASH_ON_SAFE_ASSERTS)
1026 auto verifyTypeRegistered = [] (
const char *type) {
1027 const int typeId = QMetaType::type(type);
1030 qFatal(
"ERROR: type-id for metatype %s is not found", type);
1033 if (!QMetaType::isRegistered(typeId)) {
1034 qFatal(
"ERROR: metatype %s is not registered", type);
1038 verifyTypeRegistered(
"KisBrushSP");
1039 verifyTypeRegistered(
"KoSvgText::AutoValue");
1040 verifyTypeRegistered(
"KoSvgText::BackgroundProperty");
1041 verifyTypeRegistered(
"KoSvgText::StrokeProperty");
1042 verifyTypeRegistered(
"KoSvgText::TextTransformInfo");
1043 verifyTypeRegistered(
"KoSvgText::TextIndentInfo");
1044 verifyTypeRegistered(
"KoSvgText::TabSizeInfo");
1045 verifyTypeRegistered(
"KoSvgText::LineHeightInfo");
1046 verifyTypeRegistered(
"KisPaintopLodLimitations");
1047 verifyTypeRegistered(
"KisImageSP");
1048 verifyTypeRegistered(
"KisImageSignalType");
1049 verifyTypeRegistered(
"KisNodeSP");
1050 verifyTypeRegistered(
"KisNodeList");
1051 verifyTypeRegistered(
"KisPaintDeviceSP");
1052 verifyTypeRegistered(
"KisTimeSpan");
1053 verifyTypeRegistered(
"KoColor");
1054 verifyTypeRegistered(
"KoResourceSP");
1055 verifyTypeRegistered(
"KoResourceCacheInterfaceSP");
1056 verifyTypeRegistered(
"KisAsyncAnimationRendererBase::CancelReason");
1057 verifyTypeRegistered(
"KisGridConfig");
1058 verifyTypeRegistered(
"KisGuidesConfig");
1059 verifyTypeRegistered(
"KisUpdateInfoSP");
1060 verifyTypeRegistered(
"KisToolChangesTrackerDataSP");
1061 verifyTypeRegistered(
"QVector<QImage>");
1062 verifyTypeRegistered(
"SnapshotDirInfoList");
1063 verifyTypeRegistered(
"TransformTransactionProperties");
1064 verifyTypeRegistered(
"ToolTransformArgs");
1065 verifyTypeRegistered(
"QPainterPath");
1074 const int argsCount = args.
filenames().count();
1075 bool documentCreated =
false;
1082 d->mainWindow->addViewAndNotifyLoadingCompleted(doc);
1085 if (argsCount > 0) {
1087 for (
int argNumber = 0; argNumber < argsCount; ++argNumber) {
1088 QString filename = args.
filenames().at(argNumber);
1093 else if (QFile(filename).exists()) {
1095 documentCreated |= mainWindow->
openDocument(filename, flags);
1102 if (argsCount > 0 && !documentCreated){
1104 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1105 i18n(
"Couldn't open file %1",args.
filenames().at(argsCount - 1)));
1111 QFileInfo fi(fileLayer->
path());
1114 adapter.
addNode(fileLayer,
d->mainWindow->viewManager()->activeNode()->
parent(),
1115 d->mainWindow->viewManager()->activeNode());
1118 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1119 i18n(
"Cannot add %1 as a file layer: the file does not exist.", fileLayer->
path()));
1123 QMessageBox::warning(mainWindow, i18nc(
"@title:window",
"Krita:Warning"),
1124 i18n(
"Cannot add the file layer: no document is open."));
1133 KisMainWindow *mw = qobject_cast<KisMainWindow*>(qApp->activeWindow());
1139 const QByteArray unpackedMessage =
1140 QByteArray::fromBase64(message.toLatin1());
1143 d->earlyRemoteArguments << unpackedMessage;
1151 if (!
d->mainWindow) {
1152 d->earlyFileOpenEvents.append(url);
1157 d->mainWindow->openDocument(url, flags);
1163 if (enabled && !
d->longPressEventFilter) {
1165 installEventFilter(
d->longPressEventFilter);
1166 }
else if (!enabled &&
d->longPressEventFilter) {
1167 removeEventFilter(
d->longPressEventFilter);
1168 d->longPressEventFilter->deleteLater();
1169 d->longPressEventFilter =
nullptr;
1175 if (
d->batchRun)
return;
1186 QStringList autosaveFiles = dir.entryList(filters, QDir::Files | QDir::Hidden);
1189 filters =
QStringList() << QString(
"krita-*-*-autosave.kra");
1190 autosaveFiles += dir.entryList(filters, QDir::Files);
1193 if (autosaveFiles.size() > 0) {
1194 if (
d->splashScreen) {
1199 QDialog::DialogCode result = (QDialog::DialogCode)
d->autosaveDialog->exec();
1201 if (result == QDialog::Accepted) {
1202 QStringList filesToRecover =
d->autosaveDialog->recoverableFiles();
1203 Q_FOREACH (
const QString &autosaveFile, autosaveFiles) {
1204 if (!filesToRecover.contains(autosaveFile)) {
1205 KisUsageLogger::log(QString(
"Removing autosave file %1").arg(dir.absolutePath() +
"/" + autosaveFile));
1206 QFile::remove(dir.absolutePath() +
"/" + autosaveFile);
1209 autosaveFiles = filesToRecover;
1211 autosaveFiles.clear();
1214 if (autosaveFiles.size() > 0) {
1216 Q_FOREACH (
const QString &autoSaveFile, autosaveFiles) {
1217 const QString path = dir.absolutePath() + QLatin1Char(
'/') + autoSaveFile;
1218 autosavePaths << path;
1220 if (
d->mainWindow) {
1221 Q_FOREACH (
const QString &path, autosavePaths) {
1228 delete d->autosaveDialog;
1229 d->autosaveDialog =
nullptr;
1235 QString templatePath;
1237 if (QFile::exists(fileName)) {
1238 templatePath = fileName;
1239 dbgUI <<
"using full path...";
1242 QString desktopName(fileName);
1243 const QString templatesResourcePath = QStringLiteral(
"templates/");
1246 if (paths.isEmpty()) {
1250 if (paths.isEmpty()) {
1251 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1252 i18n(
"No template found for: %1", desktopName));
1253 }
else if (paths.count() > 1) {
1254 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1255 i18n(
"Too many templates found for: %1", desktopName));
1257 templatePath = paths.at(0);
1261 if (!templatePath.isEmpty()) {
1262 KDesktopFile templateInfo(templatePath);
1266 dbgUI <<
"Template loaded...";
1270 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"),
1271 i18n(
"Template %1 failed to load.", fileName));
1282 KSharedConfigPtr config = KSharedConfig::openConfig();
1283 config->markAsClean();
1286 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1287 QString kritarcPath = configPath + QStringLiteral(
"/kritarc");
1289 QFile kritarcFile(kritarcPath);
1291 if (kritarcFile.exists()) {
1292 if (kritarcFile.open(QFile::ReadWrite)) {
1293 QString backupKritarcPath = kritarcPath + QStringLiteral(
".backup");
1295 QFile backupKritarcFile(backupKritarcPath);
1297 if (backupKritarcFile.exists()) {
1298 backupKritarcFile.remove();
1301 QMessageBox::information(qApp->activeWindow(),
1302 i18nc(
"@title:window",
"Krita"),
1303 i18n(
"Krita configurations reset!\n\n"
1304 "Backup file was created at: %1\n\n"
1305 "Restart Krita for changes to take effect.",
1307 QMessageBox::Ok, QMessageBox::Ok);
1310 kritarcFile.rename(backupKritarcPath);
1312 kritarcFile.close();
1315 QMessageBox::warning(qApp->activeWindow(),
1316 i18nc(
"@title:window",
"Krita"),
1317 i18n(
"Failed to clear %1\n\n"
1318 "Please make sure no other program is using the file and try again.",
1320 QMessageBox::Ok, QMessageBox::Ok);
1326 config->reparseConfiguration();
1330 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"MainWindow");
1332 QString currentWorkspace = cfg.readEntry<QString>(
"CurrentWorkspace",
"Default");
1337 d->mainWindow->restoreWorkspace(workspace);
1343 bool ok = QMessageBox::question(qApp->activeWindow(),
1344 i18nc(
"@title:window",
"Krita"),
1345 i18n(
"Do you want to clear the settings file?"),
1346 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes;
1354 return d->extendedModifiersPluginInterface.data();
1360 if (!
d->androidDonations) {
1362 d->androidDonations->syncState();
1364 return d->androidDonations;
1369#if KRITA_QT_HAS_ANDROID_QPLATFORMSCREEN_DENSITY_ADJUSTMENT
1372 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
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()