45#include <klocalizedstring.h>
50#include <kdesktopfile.h>
51#include <kconfiggroup.h>
55#include <QTextBrowser>
56#include <QApplication>
58#include <QStandardPaths>
60#include <QDomDocument>
68#include <QScopedPointer>
69#include <QScopedValueRollback>
76#include <QFutureWatcher>
134#define STORE_PROTOCOL "tar"
136#define INTERNAL_PROTOCOL "intern"
137#define INTERNAL_PREFIX "intern:/"
149constexpr int errorMessageTimeout = 5000;
150constexpr int successMessageTimeout = 1000;
163 static int s_docIFNumber = 0;
164 QString name; name.setNum(s_docIFNumber++); name.prepend(
"document_");
193 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
211 Q_ASSERT(currentImage);
303 , autoSaveTimer(new QTimer(_q))
305 , m_bAutoDetectedMime(false)
308 , autoSaveActive(true)
309 , firstMod(QDateTime::currentDateTime())
312 , imageIdleWatcher(2000 )
313 , globalAssistantsColor(
KisConfig(true).defaultAssistantsColor())
316 if (QLocale().measurementSystem() == QLocale::ImperialSystem) {
321 connect(&imageIdleWatcher, SIGNAL(startedIdleMode()), q, SLOT(slotPerformIdleRoutines()));
328 , autoSaveTimer(new QTimer(_q))
331 , preActivatedNode(0)
332 , imageIdleWatcher(2000 )
333 , colorHistoryModel(rhs.colorHistoryModel)
335 copyFromImpl(rhs, _q, CONSTRUCT);
336 connect(&imageIdleWatcher, SIGNAL(startedIdleMode()), q, SLOT(slotPerformIdleRoutines()));
358 int autoSaveDelay = 300;
359 bool modifiedAfterAutosave =
false;
360 bool isAutosaving =
false;
361 bool disregardAutosaveFailure =
false;
362 int autoSaveFailureCount = 0;
369 bool m_bAutoDetectedMime =
false;
375 bool modified =
false;
376 bool readwrite =
false;
377 bool autoSaveActive =
true;
399 qreal audioLevel = 1.0;
406 bool imageModifiedWithoutUndo =
false;
407 bool modifiedWhileSaving =
false;
415 bool isRecovered =
false;
417 bool batchMode {
false };
418 bool decorationsSyncingDisabled =
false;
419 bool wasStorageAdded =
false;
420 bool documentIsClosing =
false;
448 class StrippedSafeSavingLocker;
452void KisDocument::Private::syncDecorationsWrapperLayerState()
454 if (!this->image || this->decorationsSyncingDisabled)
return;
458 KisLayerUtils::findNodeByType<KisDecorationsWrapperLayer>(image->
root());
460 const bool needsDecorationsWrapper =
461 gridConfig.showGrid() || (guidesConfig.showGuides() && guidesConfig.hasGuides()) || !assistants.isEmpty();
464 SyncDecorationsWrapperStroke(
KisDocument *document,
bool needsDecorationsWrapper)
467 m_document(document),
468 m_needsDecorationsWrapper(needsDecorationsWrapper)
477 KisLayerUtils::findNodeByType<KisDecorationsWrapperLayer>(m_document->image()->root());
479 if (m_needsDecorationsWrapper && !decorationsLayer) {
481 }
else if (!m_needsDecorationsWrapper && decorationsLayer) {
482 m_document->image()->removeNode(decorationsLayer);
488 bool m_needsDecorationsWrapper =
false;
502 if (policy == REPLACE) {
507 mimeType = rhs.mimeType;
508 outputMimeType = rhs.outputMimeType;
510 if (policy == REPLACE) {
520 colorHistoryModel.setColorList(rhs.colorHistoryModel.colorList());
524 guidesConfig = rhs.guidesConfig;
525 mirrorAxisConfig = rhs.mirrorAxisConfig;
526 modified = rhs.modified;
529 m_storyboardCommentList = rhs.m_storyboardCommentList;
530 audioTracks = rhs.audioTracks;
531 audioLevel = rhs.audioLevel;
532 gridConfig = rhs.gridConfig;
534 imageModifiedWithoutUndo = rhs.imageModifiedWithoutUndo;
535 m_bAutoDetectedMime = rhs.m_bAutoDetectedMime;
538 readwrite = rhs.readwrite;
539 autoSaveActive = rhs.autoSaveActive;
540 firstMod = rhs.firstMod;
541 lastMod = rhs.lastMod;
543 globalAssistantsColor = rhs.globalAssistantsColor;
544 batchMode = rhs.batchMode;
547 if (rhs.linkedResourceStorage) {
548 linkedResourceStorage = rhs.linkedResourceStorage->clone();
551 if (rhs.embeddedResourceStorage) {
552 embeddedResourceStorage = rhs.embeddedResourceStorage->clone();
579 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
602 QMutex *m_savingLock;
603 KisImageReadOnlyBarrierLock m_imageLock;
610 connect(d->undoStack, SIGNAL(cleanChanged(
bool)),
this, SLOT(slotUndoStackCleanChanged(
bool)));
611 connect(d->autoSaveTimer, SIGNAL(timeout()),
this, SLOT(slotAutoSave()));
612 setObjectName(newObjectName());
617 connect(
this, SIGNAL(sigSavingFinished(
const QString&)), bookmarkmngr, SLOT(slotCreateBookmark(
const QString&)));
623 d->linkedResourcesStorageID = QUuid::createUuid().toString();
627 d->embeddedResourcesStorageID = QUuid::createUuid().toString();
628 d->embeddedResourceStorage.reset(
new KisResourceStorage(d->embeddedResourcesStorageID));
631 d->wasStorageAdded =
true;
652 d->wasStorageAdded =
true;
658 d->documentIsClosing =
true;
662 d->imageIdleWatcher.setTrackedImage(0);
670 d->autoSaveTimer->disconnect(
this);
671 d->autoSaveTimer->stop();
673 delete d->importExportManager;
676 delete d->shapeController;
678 delete d->koShapeController;
681 d->image->animationInterface()->blockBackgroundFrameGeneration();
683 d->image->notifyAboutToBeDeleted();
697 d->image->requestStrokeCancellation();
698 d->image->waitForDone();
701 d->undoStack->clear();
702 d->image->waitForDone();
705 Q_UNUSED(sanityCheckPointer);
714 if (
d->wasStorageAdded) {
728 return d->embeddedResourcesStorageID;
733 return d->linkedResourcesStorageID;
784 QFileInfo filePathInfo(job.
filePath);
785 bool fileExists = filePathInfo.exists();
788 fileExists = filePathInfo.size() > 0;
791 if (fileExists && !filePathInfo.isWritable()) {
793 i18n(
"%1 cannot be written to. Please save under a different name.", job.
filePath),
804 switch(cfg.
readEntry<
int>(
"backupfilelocation", 0)) {
806 backupDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
809 backupDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
815 QDir().mkpath(backupDir);
823 QUrl fileUrl = QUrl::fromLocalFile(job.
filePath);
825 backupDir = QDir::tempPath();
834 int numOfBackupsKept = cfg.
readEntry<
int>(
"numberofbackupfiles", 1);
835 QString suffix = cfg.
readEntry<QString>(
"backupfilesuffix",
"~");
837 if (numOfBackupsKept == 1) {
839 qWarning() <<
"Failed to create simple backup file!" << job.
filePath << backupDir << suffix;
841 .arg(job.
filePath, backupDir.isEmpty()
842 ?
"the same location as the file"
849 .arg(job.
filePath, backupDir.isEmpty()
850 ?
"the same location as the file"
854 else if (numOfBackupsKept > 1) {
856 qWarning() <<
"Failed to create numbered backup file!" << job.
filePath << backupDir << suffix;
858 .arg(job.
filePath, backupDir.isEmpty()
859 ?
"the same location as the file"
866 .arg(job.
filePath, backupDir.isEmpty()
867 ?
"the same location as the file"
881 const QString actionName =
883 i18n(
"Exporting Document...") :
884 i18n(
"Saving Document...");
889 job, exportConfiguration, isAdvancedExporting);
892 QString errorShortLog;
898 errorShortLog =
"another save operation is in progress";
899 errorMessage = i18n(
"Could not start saving %1. Wait until the current save operation has finished.", job.
filePath);
903 errorShortLog =
"failed to lock and clone the image";
908 errorShortLog =
"failed to start background saving";
935 SaveFlags flags = SaveIsExporting;
937 flags |= SaveShowWarnings;
940 KisUsageLogger::log(QString(
"Exporting Document: %1 as %2. %3 * %4 pixels, %5 layers, %6 frames, %7 "
941 "framerate. Export configuration: %8")
942 .arg(path, QString::fromLatin1(
mimeType), QString::number(
d->image->width()),
943 QString::number(
d->image->height()), QString::number(
d->image->nlayers()),
944 QString::number(
d->image->animationInterface()->totalLength()),
945 QString::number(
d->image->animationInterface()->framerate()),
946 (exportConfiguration ? exportConfiguration->toXML() :
"No configuration")));
951 exportConfiguration, isAdvancedExporting);
958 KisUsageLogger::log(QString(
"Saving Document %9 as %1 (mime: %2). %3 * %4 pixels, %5 layers. %6 frames, "
959 "%7 framerate. Export configuration: %8")
960 .arg(_path, QString::fromLatin1(
mimeType), QString::number(
d->image->width()),
961 QString::number(
d->image->height()), QString::number(
d->image->nlayers()),
962 QString::number(
d->image->animationInterface()->totalLength()),
963 QString::number(
d->image->animationInterface()->framerate()),
964 (exportConfiguration ? exportConfiguration->toXML() :
"No configuration"),
974 showWarnings ? SaveShowWarnings : SaveNone),
975 exportConfiguration);
988 filter->setBatchMode(
true);
991 Private::StrippedSafeSavingLocker locker(&
d->savingMutex,
d->image);
992 if (!locker.successfullyLocked()) {
993 return buffer.data();
998 QScopedValueRollback<KisImageSP> rollback(
d->savingImage,
d->image);
1000 if (!filter->convert(
this, &buffer).isOk()) {
1001 qWarning() <<
"serializeToByteArray():: Could not export to our native format";
1004 return buffer.data();
1011 const QString &message,
1013 const QString &details = {})
1014 : QMessageBox(QMessageBox::Warning, title, message, QMessageBox::Ok, qApp->activeWindow())
1016 if (!details.isEmpty()) {
1017 setInformativeText(details);
1019 if (!warnings.isEmpty()) {
1027 QMessageBox::setDetailedText(text.first());
1029 QTextEdit *messageBox = findChild<QTextEdit *>();
1032 messageBox->setAcceptRichText(
true);
1034 QString warning =
"<html><body><ul>";
1035 Q_FOREACH (
const QString &i, text) {
1036 warning +=
"\n<li>" + i +
"</li>";
1038 warning +=
"</ul></body></html>";
1040 messageBox->setText(warning);
1050 const QString fileName = QFileInfo(job.
filePath).fileName();
1052 if (!status.
isOk()) {
1053 Q_EMIT
statusBarMessage(i18nc(
"%1 --- failing file name, %2 --- error message",
1054 "Error during saving %1: %2",
1061 i18n(
"Could not save %1.", job.
filePath),
1075 i18nc(
"@title:window",
"Krita"),
1076 i18nc(
"dialog box shown to the user if there were warnings while saving the document, "
1077 "%1 is the file path",
1078 "%1 has been saved but is incomplete.",
1083 : i18nc(
"dialog box shown to the user if there were warnings while saving the document",
1084 "Some problems were encountered when saving."));
1101 Q_EMIT
statusBarMessage(i18n(
"Finished saving %1", fileName), successMessageTimeout);
1105void KisDocument::Private::updateDocumentMetadataOnSaving(
const QString &filePath,
const QByteArray &mimeType)
1117 QFileInfo fi(filePath);
1121 if (!modifiedWhileSaving) {
1128 if (undoStack->isClean()) {
1131 imageModifiedWithoutUndo =
false;
1132 undoStack->setClean();
1150 return d->batchMode;
1158void KisDocument::Private::uploadLinkedResourcesFromLayersToStorage()
1169 if (KisNodeFilterInterface *layer = dynamic_cast<KisNodeFilterInterface*>(node.data())) {
1170 KisFilterConfigurationSP filterConfig = layer->filter();
1171 if (!filterConfig) return;
1173 QList<KoResourceLoadResult> linkedResources = filterConfig->linkedResources(KisGlobalResourcesInterface::instance());
1175 Q_FOREACH (const KoResourceLoadResult &result, linkedResources) {
1176 KIS_SAFE_ASSERT_RECOVER(result.type() != KoResourceLoadResult::EmbeddedResource) { continue; }
1178 KoResourceSP resource = result.resource();
1181 qWarning() <<
"WARNING: KisDocument::lockAndCloneForSaving failed to fetch a resource" << result.signature();
1186 buf.open(QBuffer::WriteOnly);
1188 KisResourceModel model(resource->resourceType().first);
1189 bool res = model.exportResource(resource, &buf);
1194 qWarning() <<
"WARNING: KisDocument::lockAndCloneForSaving failed to export resource" << result.signature();
1198 buf.open(QBuffer::ReadOnly);
1200 res = doc->d->linkedResourceStorage->importResource(resource->resourceType().first +
"/" + resource->filename(), &buf);
1205 qWarning() <<
"WARNING: KisDocument::lockAndCloneForSaving failed to import resource" << result.signature();
1214KisDocument *KisDocument::Private::lockAndCloneImpl(
bool fetchResourcesFromLayers)
1217 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1229 Private::StrippedSafeSavingLocker locker(&savingMutex, image);
1230 if (!locker.successfullyLocked()) {
1236 if (fetchResourcesFromLayers) {
1237 doc->
d->uploadLinkedResourcesFromLayersToStorage();
1245 return d->lockAndCloneImpl(
true);
1250 return d->lockAndCloneImpl(
false);
1261 d->decorationsSyncingDisabled =
true;
1262 d->copyFrom(*(rhs.
d),
this);
1263 d->decorationsSyncingDisabled =
false;
1265 d->undoStack->clear();
1270 connect(
d->autoSaveTimer, SIGNAL(timeout()),
this, SLOT(
slotAutoSave()));
1276 setObjectName(rhs.objectName());
1282 d->image->barrierLock(
false);
1283 rhs.
d->image->barrierLock(
true);
1284 d->image->copyFromImage(*(rhs.
d->image));
1286 rhs.
d->image->unlock();
1297 d->syncDecorationsWrapperLayerState();
1300 if (rhs.
d->preActivatedNode) {
1301 QQueue<KisNodeSP> linearizedNodes;
1304 linearizedNodes.enqueue(node);
1307 [&linearizedNodes, &rhs,
this](
KisNodeSP node) {
1308 KisNodeSP refNode = linearizedNodes.dequeue();
1309 if (rhs.d->preActivatedNode.data() == refNode.data()) {
1310 d->preActivatedNode = node;
1317 if (referencesLayer) {
1318 d->referenceLayerConnections.clear();
1319 d->referenceLayerConnections.addConnection(
1320 referencesLayer, SIGNAL(sigUpdateCanvas(QRectF)),
1321 this, SIGNAL(sigReferenceImagesChanged()));
1323 Q_EMIT sigReferenceImagesLayerChanged(referencesLayer);
1324 Q_EMIT sigReferenceImagesChanged();
1328 KisLayerUtils::findNodeByType<KisDecorationsWrapperLayer>(
d->image->root());
1329 if (decorationsLayer) {
1330 decorationsLayer->setDocument(
this);
1334 if (policy == REPLACE) {
1348 Private::StrippedSafeSavingLocker locker(&
d->savingMutex,
d->image);
1349 if (!locker.successfullyLocked()) {
1354 d->savingImage =
d->image;
1357 d->importExportManager->
1362 return status.
isOk();
1367 const QObject *receiverObject,
const char *receiverMethod,
1372 job, exportConfiguration, std::unique_ptr<KisDocument>(), isAdvancedExporting);
1376 const QObject *receiverObject,
const char *receiverMethod,
1379 std::unique_ptr<KisDocument> &&optionalClonedDocument,
bool isAdvancedExporting)
1383 std::unique_ptr<KisDocument> clonedDocument;
1385 if (!optionalClonedDocument) {
1388 clonedDocument.reset(optionalClonedDocument.release());
1391 if (!
d->savingMutex.tryLock()){
1399 std::unique_lock<QMutex> savingMutexLock(
d->savingMutex, std::adopt_lock);
1401 if (!clonedDocument) {
1418 waitForImage(clonedDocument->image());
1422 if (clonedDocument->image()->hasOverlaySelectionMask()) {
1423 clonedDocument->image()->setOverlaySelectionMask(0);
1424 waitForImage(clonedDocument->image());
1429 clonedDocument->image()->cropImage(clonedDocument->image()->bounds());
1430 clonedDocument->image()->purgeUnusedData(
false);
1431 waitForImage(clonedDocument->image());
1435 waitForImage(clonedDocument->image());
1450 savingMutexLock.release();
1452 d->backgroundSaveDocument.reset(clonedDocument.release());
1453 d->backgroundSaveJob = job;
1454 d->modifiedWhileSaving =
false;
1457 d->backgroundSaveDocument->d->isAutosaving =
true;
1460 connect(
d->backgroundSaveDocument.get(),
1466 if (
d->completeSavingConnection) {
1467 disconnect(
d->completeSavingConnection);
1469 d->completeSavingConnection = connect(
1471 receiverObject, receiverMethod);
1474 d->backgroundSaveDocument->startExportInBackground(actionName,
1479 exportConfiguration, isAdvancedExporting);
1480 if (!error.
isOk()) {
1483 d->backgroundSaveDocument.release()->deleteLater();
1484 d->savingMutex.unlock();
1506 std::unique_lock<QMutex> savingMutexLock(
d->savingMutex, std::adopt_lock);
1511 d->backgroundSaveDocument->d->isAutosaving =
false;
1514 d->backgroundSaveDocument.release()->deleteLater();
1522 savingMutexLock.unlock();
1525 KisUsageLogger::log(QString(
"Completed saving %1 (mime: %2). Result: %3. Warning: %4. Size: %5")
1528 QString::number(fi.size())));
1533 disconnect(
d->completeSavingConnection);
1534 d->completeSavingConnection = {};
1539 if (!
d->modified || !
d->modifiedAfterAutosave)
return;
1542 Q_EMIT
statusBarMessage(i18n(
"Autosaving... %1", autoSaveFileName), successMessageTimeout);
1546 const bool hadClonedDocument = bool(optionalClonedDocument);
1549 if (
d->image->isIdle() || hadClonedDocument) {
1554 std::move(optionalClonedDocument));
1556 Q_EMIT
statusBarMessage(i18n(
"Autosaving postponed: document is busy..."), errorMessageTimeout);
1561 connect(stroke, SIGNAL(sigDocumentCloned(
KisDocument*)),
1563 Qt::BlockingQueuedConnection);
1564 connect(stroke, SIGNAL(sigCloningCancelled()),
1566 Qt::BlockingQueuedConnection);
1569 d->image->endStroke(strokeId);
1576 d->modifiedAfterAutosave =
false;
1584 QStringList pathParts = QFileInfo(path).absolutePath().split(
'/');
1585 if (pathParts.size() > 0) {
1586 QString resourceType = pathParts.last();
1592 QString tempFileName = QDir::tempPath() +
"/" + QFileInfo(path).fileName();
1594 if (QFileInfo(path).exists()) {
1603 d->modifiedWhileSaving =
false;
1605 if (!exportConfiguration) {
1606 QScopedPointer<KisImportExportFilter> filter(
1613 if (exportConfiguration) {
1615 exportConfiguration->setProperty(
"name", res->name());
1619 QFile f2(tempFileName);
1622 QByteArray ba = f2.readAll();
1625 buf.open(QBuffer::ReadOnly);
1631 const QString filePath =
1634 d->updateDocumentMetadataOnSaving(filePath,
mimeType);
1643 d->modifiedWhileSaving =
false;
1647 const QString filePath =
1650 d->updateDocumentMetadataOnSaving(filePath,
mimeType);
1679 d->image->explicitRegenerateLevelOfDetail();
1694 const QString fileName = QFileInfo(job.
filePath).fileName();
1696 if (!status.
isOk()) {
1698 Q_EMIT
statusBarMessage(i18nc(
"%1 --- failing file name, %2 --- error message",
1699 "Error during autosaving %1: %2",
1706 if (!
d->modifiedWhileSaving) {
1707 d->autoSaveTimer->stop();
1708 d->autoSaveFailureCount = 0;
1713 Q_EMIT
statusBarMessage(i18n(
"Finished autosaving %1", fileName), successMessageTimeout);
1718 const QString &location,
1719 const QString &realLocation,
1720 const QByteArray &mimeType,
1724 d->savingImage =
d->image;
1730 d->importExportManager->setUpdater(
d->savingUpdater);
1735 d->childSavingFuture =
1736 d->importExportManager->exportDocumentAsync(location,
1739 initializationStatus,
1741 exportConfiguration,
1742 isAdvancedExporting);
1744 if (!initializationStatus.
isOk()) {
1745 if (
d->savingUpdater) {
1746 d->savingUpdater->cancel();
1748 d->savingImage.clear();
1750 return initializationStatus;
1753 typedef QFutureWatcher<KisImportExportErrorCode> StatusWatcher;
1754 StatusWatcher *watcher =
new StatusWatcher();
1755 watcher->setFuture(
d->childSavingFuture);
1758 connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater()));
1760 return initializationStatus;
1774 if (!
d->lastErrorMessage.isEmpty()) {
1782 d->savingImage.clear();
1784 d->lastErrorMessage.clear();
1785 d->lastWarningMessage.clear();
1787 if (
d->savingUpdater) {
1788 d->savingUpdater->setProgress(100);
1796 const bool changed =
readwrite !=
d->readwrite;
1818 d->autoSaveTimer->start(delay * 1000);
1820 d->autoSaveTimer->stop();
1827 d->autoSaveFailureCount = 0;
1832 const int emergencyAutoSaveInterval = 10;
1834 d->autoSaveFailureCount++;
1844 return d->autoSaveActive;
1860 if (
d->savingImage)
image =
d->savingImage;
1864 QSize originalSize =
bounds.size();
1866 QSize newSize = originalSize.scaled(size, Qt::KeepAspectRatio).expandedTo({1, 1});
1868 bool pixelArt =
false;
1870 if (originalSize.width() < size.width() && originalSize.height() < size.height()) {
1873 if (newSize.height()%originalSize.height() == 0 && newSize.width()%originalSize.width() == 0) {
1883 QImage scaled = original.scaled(newSize, Qt::KeepAspectRatio, Qt::FastTransformation);
1884 px = QPixmap::fromImage(scaled);
1888 if (px.size() == QSize(0,0)) {
1889 px = QPixmap(newSize);
1892 gc.fillRect(px.rect(), checkBrush);
1897 return QPixmap(size);
1905 const QString extension (
".kra");
1906 QString prefix =
KisConfig(
true).
readEntry<
bool>(
"autosavefileshidden") ? QString(
".") : QString();
1907 QRegularExpression autosavePattern1(
"^\\..+-autosave.kra$");
1908 QRegularExpression autosavePattern2(
"^.+-autosave.kra$");
1911 QString dir = fi.absolutePath();
1915 if (path.startsWith(
"content://")) {
1921 QString filename = fi.fileName();
1923 if (path.isEmpty() || autosavePattern1.match(filename).hasMatch() || autosavePattern2.match(filename).hasMatch() || !fi.isWritable()) {
1925 retval = QString(
"%1%2%3%4-%5-%6-autosave%7")
1930 .arg(qApp->applicationPid())
1936 retval = QString(
"%1%2%3%4-autosave%5").arg(dir).arg(
'/').arg(prefix).arg(filename).arg(extension);
1947 dbgUI <<
"path=" << _path;
1955 dbgUI <<
"success, resetting url";
1965 dbgUI <<
"path=" << _path;
1966 d->lastErrorMessage.clear();
1969 if (_path.isEmpty()) {
1970 d->lastErrorMessage = i18n(
"Malformed Path\n%1", _path);
1974 QString path = _path;
1975 QString original =
"";
1976 bool autosaveOpened =
false;
1978 QString file =
path;
1980 if (QFile::exists(asf)) {
1987 int res = dlg.result();
1993 autosaveOpened =
true;
2027 QFileInfo fi(_path);
2042 QMessageBox::critical(qApp->activeWindow(), i18nc(
"@title:window",
"Krita"), i18n(
"File %1 does not exist.",
localFilePath()));
2049 if (typeName.isEmpty()) {
2054 if (typeName ==
"application/x-trash") {
2055 QString path = filename;
2056 while (path.length() > 0) {
2060 if (!typeName.isEmpty()) {
2072 d->importExportManager->setUpdater(updater);
2077 if (!status.
isOk()) {
2097 i18n(
"There were problems opening %1.",
prettyPath()),
2105 d->syncDecorationsWrapperLayerState();
2115 if (!
d->modified || !
d->modifiedAfterAutosave)
2124 d->modifiedAfterAutosave =
false;
2129 qWarning() <<
"Could not auto-save when paused";
2137 d->outputMimeType =
d->mimeType;
2156 if (
d->isAutosaving ||
d->documentIsClosing)
2162 if (mod && !
d->autoSaveTimer->isActive()) {
2166 d->modifiedAfterAutosave = mod;
2167 d->modifiedWhileSaving = mod;
2170 d->imageModifiedWithoutUndo = mod;
2187 const bool changed =
value !=
d->isRecovered;
2198 return d->isRecovered;
2203 QDateTime now = QDateTime::currentDateTime();
2204 int firstModDelta =
d->firstMod.secsTo(now);
2205 int lastModDelta =
d->lastMod.secsTo(now);
2207 if (lastModDelta > 30) {
2208 d->docInfo->setAboutInfo(
"editing-time", QString::number(
d->docInfo->aboutInfo(
"editing-time").toInt() +
d->firstMod.secsTo(
d->lastMod)));
2210 }
else if (firstModDelta > 60 || forceStoreElapsed) {
2211 d->docInfo->setAboutInfo(
"editing-time", QString::number(
d->docInfo->aboutInfo(
"editing-time").toInt() + firstModDelta));
2220 QString _url(
path());
2222 _url = QDir::toNativeSeparators(_url);
2231 const QString _url(QFileInfo(
path()).fileName());
2234 if (_url.isEmpty()) {
2235 c =
" [" + i18n(
"Not Saved") +
"] ";
2251 QDomImplementation impl;
2252 QString url = QString(
"http://www.calligra.org/DTD/%1-%2.dtd").arg(appName).arg(version);
2253 QDomDocumentType dtype = impl.createDocumentType(tagName,
2254 QString(
"-//KDE//DTD %1 %2//EN").arg(appName).arg(version),
2257 QString namespaceURN = QString(
"http://www.calligra.org/DTD/%1").arg(appName);
2258 QDomDocument doc = impl.createDocument(namespaceURN, tagName, dtype);
2259 doc.insertBefore(doc.createProcessingInstruction(
"xml",
"version=\"1.0\" encoding=\"UTF-8\""), doc.documentElement());
2272 d->lastErrorMessage = errMsg;
2277 return d->lastErrorMessage;
2282 d->lastWarningMessage = warningMsg;
2287 return d->lastWarningMessage;
2295 if (QFile::exists(asf)) {
2301 if (QFile::exists(asf)) {
2308 expressions << QRegularExpression(
"^\\..+-autosave.kra$")
2309 << QRegularExpression(
"^.+-autosave.kra$");
2311 Q_FOREACH(
const QRegularExpression &rex, expressions) {
2313 !autosaveBaseName.isEmpty() &&
2314 rex.match(QFileInfo(autosaveBaseName).fileName()).hasMatch() &&
2315 QFile::exists(autosaveBaseName)) {
2318 QFile::remove(autosaveBaseName);
2330 if (
d->unit !=
unit) {
2338 return d->undoStack;
2343 return d->importExportManager;
2356 if (!
d->undoStack->isClean()) {
2357 d->undoStack->clear();
2373 d->syncDecorationsWrapperLayerState();
2378 d->undoStack->clear();
2383 return d->gridConfig;
2388 if (
d->gridConfig != config) {
2389 d->gridConfig = config;
2390 d->syncDecorationsWrapperLayerState();
2402 if (!
d->linkedResourceStorage) {
2408 while (iter->hasNext()) {
2412 buf.open(QBuffer::WriteOnly);
2413 bool exportSuccessful =
2414 d->linkedResourceStorage->exportResource(iter->url(), &buf);
2416 KoResourceSP resource =
d->linkedResourceStorage->resource(iter->url());
2417 exportSuccessful &= bool(resource);
2419 const QString name = resource ? resource->name() : QString();
2420 const QString fileName = QFileInfo(iter->url()).fileName();
2425 if (exportSuccessful) {
2428 result << signature;
2439 if (
d->linkedResourceStorage) {
2441 while (iter->hasNext()) {
2444 if (resource && resource->valid()) {
2445 oldPaletteList << resource.dynamicCast<
KoColorSet>();
2448 if (oldPaletteList != paletteList) {
2451 if (!paletteList.contains(palette)) {
2456 if (!oldPaletteList.contains(palette)) {
2457 resourceModel.
addResource(palette,
d->linkedResourcesStorageID);
2460 palette->setStorageLocation(
d->linkedResourcesStorageID);
2473 return d->m_storyboardItemList;
2478 d->m_storyboardItemList = storyboardItemList;
2486 return d->m_storyboardCommentList;
2491 d->m_storyboardCommentList = storyboardCommentList;
2498 return d->audioTracks;
2509 d->audioLevel = level;
2515 return d->audioLevel;
2520 return d->guidesConfig;
2525 if (
d->guidesConfig == data)
return;
2527 d->guidesConfig = data;
2528 d->syncDecorationsWrapperLayerState();
2535 return d->mirrorAxisConfig;
2540 if (
d->mirrorAxisConfig == config) {
2544 d->mirrorAxisConfig = config;
2547 d->image->bounds()));
2566 return d->readwrite;
2579 if (view && view->
document() ==
this) {
2588 d->mimeType = QByteArray();
2600 const bool changed = path !=
d->m_path;
2622 if ( path.isEmpty() ) {
2626 if (
d->m_bAutoDetectedMime) {
2627 d->mimeType = QByteArray();
2628 d->m_bAutoDetectedMime =
false;
2642 d->m_file =
d->m_path;
2646 if (
d->mimeType.isEmpty()) {
2650 d->mimeType = mime.toLocal8Bit();
2651 d->m_bAutoDetectedMime =
true;
2667 qint32 width, qint32 height,
2671 const QString &description,
const double imageResolution)
2677 if (!cs)
return false;
2679 KisCursorOverrideLock cursorLock(Qt::BusyCursor);
2700 KoColor strippedAlpha = bgColor;
2709 filter_config->setProperty(
"color", strippedAlpha.
toQColor());
2710 filter_config->createLocalResourcesSnapshot();
2716 if (numberOfLayers > 1) {
2726 Q_CHECK_PTR(bgLayer);
2728 bgLayer->
setDirty(QRect(0, 0, width, height));
2731 d->mirrorAxisConfig.setAxisPosition(QRectF(
image->
bounds()).center());
2734 for(
int i = 1; i < numberOfLayers; ++i) {
2738 layer->
setDirty(QRect(0, 0, width, height));
2752 QString(
"Created image \"%1\", %2 * %3 pixels, %4 dpi. Color model: %6 %5 (%7). Layers: %8")
2753 .arg(name, QString::number(width), QString::number(height),
2756 QString::number(numberOfLayers)));
2763 const bool result =
d->savingMutex.tryLock();
2765 d->savingMutex.unlock();
2773 KisAsyncActionFeedback f(i18nc(
"progress dialog message when the user closes the document that is being saved",
"Waiting for saving to complete..."), 0);
2774 f.waitForMutex(
d->savingMutex);
2780 return d->shapeController;
2785 return d->shapeController->shapeForNode(layer);
2790 return d->assistants;
2795 if (
d->assistants !=
value) {
2797 d->syncDecorationsWrapperLayerState();
2807 KisLayerUtils::findNodeByType<KisReferenceImagesLayer>(
d->image->root());
2809 return referencesLayer;
2818 if (currentReferenceLayer == layer && updateImage) {
2822 d->referenceLayerConnections.clear();
2825 if (currentReferenceLayer) {
2826 d->image->removeNode(currentReferenceLayer);
2830 d->image->addNode(layer);
2834 currentReferenceLayer = layer;
2836 if (currentReferenceLayer) {
2837 d->referenceLayerConnections.addConnection(
2838 currentReferenceLayer, SIGNAL(sigUpdateCanvas(QRectF)),
2848 d->preActivatedNode = activatedNode;
2853 return d->preActivatedNode;
2863 return d->savingImage;
2872 d->image->disconnect(
this);
2873 d->shapeController->setImage(0);
2879 if (
d->linkedResourceStorage){
2883 d->setImageAndInitIdleWatcher(
image);
2888 connect(
d->image, SIGNAL(sigImageModified()),
this, SLOT(
setImageModified()), Qt::UniqueConnection);
2892 if (forceInitialUpdate) {
2893 d->image->initialRefreshGraph();
2904 d->shapeController->setImage(
image);
2910 setModified(
d->imageModifiedWithoutUndo || !
d->undoStack->isClean());
2915 d->imageModifiedWithoutUndo =
true;
2927 return d->isAutosaving;
2937 d->globalAssistantsColor = color;
2942 return d->globalAssistantsColor;
2947 QRectF
bounds =
d->image->bounds();
2951 if (referenceImagesLayer) {
2960 d->colorHistoryModel.setColorList(colors);
2965 return d->colorHistoryModel.colorList();
2970 return &
d->colorHistoryModel;
float value(const T *src, size_t ch)
KisSharedPtr< KisReferenceImagesLayer > KisReferenceImagesLayerSP
const quint8 OPACITY_OPAQUE_U8
void setDetailedText(const QStringList &text)
DlgLoadMessages(const QString &title, const QString &message, const QStringList &warnings={}, const QString &details={})
virtual void setIndex(int idx)
bool setResourceInactive(const QModelIndex &index)
Base class for the Krita app.
static QString autoSaveLocation()
static bool simpleBackupFile(const QString &filename, const QString &backupDir=QString(), const QString &backupExtension=QStringLiteral("~"))
static bool numberedBackupFile(const QString &filename, const QString &backupDir=QString(), const QString &backupExtension=QStringLiteral("~"), const uint maxBackups=10)
QList< KoColor > colorHistoryColors() const
static KisConfigNotifier * instance()
bool backupFile(bool defaultValue=false) const
void setDefaultGridSpacing(QPoint gridSpacing)
bool useCumulativeUndoRedo(bool defaultValue=false) const
KisCumulativeUndoData cumulativeUndoData(bool defaultValue=false) const
bool autoPinLayersToTimeline(bool defaultValue=false) const
bool trimKra(bool defaultValue=false) const
T readEntry(const QString &name, const T &defaultValue=T())
int autoSaveInterval(bool defaultValue=false) const
int undoStackLimit(bool defaultValue=false) const
~StrippedSafeSavingLocker()
StrippedSafeSavingLocker(QMutex *savingMutex, KisImageSP image)
KisImageReadOnlyBarrierLock m_imageLock
bool successfullyLocked() const
QScopedPointer< KisSignalAutoConnection > imageIdleConnection
void slotImageRootChanged()
void setAssistants(const QList< KisPaintingAssistantSP > &value)
@replace the current list of assistants with
void waitForSavingToComplete()
QRectF documentBounds() const
QString warningMessage() const
void copyFrom(const Private &rhs, KisDocument *q)
void removeAutoSaveFiles(const QString &autosaveBaseName, bool wasRecovered)
KisUndoStore * createUndoStore()
void slotInitiateAsyncAutosaving(KisDocument *clonedDocument)
void updateDocumentMetadataOnSaving(const QString &filePath, const QByteArray &mimeType)
void sigStoryboardCommentListChanged()
QFuture< KisImportExportErrorCode > childSavingFuture
void setEmergencyAutoSaveInterval()
void setFileBatchMode(const bool batchMode)
KisMirrorAxisConfig mirrorAxisConfig
KisSharedPtr< KisReferenceImagesLayer > referenceImagesLayer() const
bool exportDocument(const QString &path, const QByteArray &mimeType, bool isAdvancedExporting=false, bool showWarnings=false, KisPropertiesConfigurationSP exportConfiguration=0)
KoDocumentInfo * documentInfo() const
void syncDecorationsWrapperLayerState()
void hackPreliminarySetImage(KisImageSP image)
void sigBackgroundSavingFinished(KisImportExportErrorCode status, const QString &errorMessage, const QString &warningMessage)
QString linkedResourcesStorageId() const
void copyFromImpl(const Private &rhs, KisDocument *q, KisDocument::CopyPolicy policy)
QPixmap generatePreview(const QSize &size)
Generates a preview picture of the document.
KisShapeController * shapeController
static QStringList extraNativeMimeTypes()
KisSignalAutoConnectionsStore referenceLayerConnections
KritaUtils::BackgroudSavingStartResult initiateSavingInBackground(const QString actionName, const QObject *receiverObject, const char *receiverMethod, const KritaUtils::ExportFileJob &job, KisPropertiesConfigurationSP exportConfiguration, std::unique_ptr< KisDocument > &&optionalClonedDocument, bool isAdvancedExporting=false)
bool save(bool showWarnings, KisPropertiesConfigurationSP exportConfiguration)
KisImportExportManager * importExportManager
void statusBarMessage(const QString &text, int timeout=0)
bool isNativeFormat(const QByteArray &mimeType) const
Checks whether a given mimeType can be handled natively.
void setAudioTracks(QVector< QFileInfo > f)
void sigAudioLevelChanged(qreal level)
KisDocument * lockAndCloneImpl(bool fetchResourcesFromLayers)
void uploadLinkedResourcesFromLayersToStorage()
void slotUndoStackCleanChanged(bool value)
QString localFilePath() const
void sigAssistantsChanged()
void setErrorMessage(const QString &errMsg)
void setMirrorAxisConfig(const KisMirrorAxisConfig &config)
QList< KoColor > colorHistoryColors() const
KoDocumentInfoDlg * createDocumentInfoDialog(QWidget *parent, KoDocumentInfo *docInfo) const
void sigStoryboardItemListChanged()
KisImportExportErrorCode startExportInBackground(const QString &actionName, const QString &location, const QString &realLocation, const QByteArray &mimeType, bool showWarnings, KisPropertiesConfigurationSP exportConfiguration, bool isAdvancedExporting=false)
QString exportErrorToUserMessage(KisImportExportErrorCode status, const QString &errorMessage)
void setAssistantsGlobalColor(QColor color)
bool loadNativeFormat(const QString &file)
void updateEditingTime(bool forceStoreElapsed)
void sigPaletteListChanged(const QList< KoColorSetSP > &oldPaletteList, const QList< KoColorSetSP > &newPaletteList)
void setModified(bool _mod)
void setMimeType(const QByteArray &mimeType)
Sets the mime type for the document.
QDomDocument createDomDocument(const QString &tagName, const QString &version) const
void sigLoadingFinished()
KisDocument * lockAndCloneForSaving()
try to clone the image. This method handles all the locking for you. If locking has failed,...
void sigReadWriteChanged(bool value)
void finishExportInBackground()
void copyFromDocument(const KisDocument &rhs)
void slotDocumentCloningCancelled()
void setWarningMessage(const QString &warningMsg)
std::unique_ptr< KisDocument > backgroundSaveDocument
void setUnit(const KoUnit &unit)
void setPath(const QString &path)
bool saveAs(const QString &path, const QByteArray &mimeType, bool showWarnings, KisPropertiesConfigurationSP exportConfiguration=0)
bool newImage(const QString &name, qint32 width, qint32 height, const KoColorSpace *cs, const KoColor &bgColor, KisConfig::BackgroundStyle bgStyle, int numberOfLayers, const QString &imageDescription, const double imageResolution)
void setLocalFilePath(const QString &localFilePath)
QList< KoResourceLoadResult > linkedDocumentResources()
linkedDocumentResources List returns all the resources linked to the document, such as palettes
KisDocument * lockAndCreateSnapshot()
void setAutoSaveDelay(int delay)
void setPreActivatedNode(KisNodeSP activatedNode)
QString lastWarningMessage
void sigGuidesConfigChanged(const KisGuidesConfig &config)
void setRecovered(bool value)
void slotChildCompletedSavingInBackground(KisImportExportErrorCode status, const QString &errorMessage, const QString &warningMessage)
Private(const Private &rhs, KisDocument *_q)
bool importDocument(const QString &path)
QString errorMessage() const
KritaUtils::ExportFileJob backgroundSaveJob
QColor globalAssistantsColor
KisResourceStorageSP embeddedResourceStorage
static QByteArray nativeFormatMimeType()
void sigAudioTracksChanged()
void setReferenceImagesLayer(KisSharedPtr< KisReferenceImagesLayer > layer, bool updateImage)
bool resourceSavingFilter(const QString &path, const QByteArray &mimeType, KisPropertiesConfigurationSP exportConfiguration)
KisDocument(bool addStorage=true)
void canceled(const QString &)
void setReadWrite(bool readwrite=true)
Sets whether the document can be edited or is read only.
void setImageModifiedWithoutUndo()
void setColorHistoryColors(const QList< KoColor > &colors)
void sigGridConfigChanged(const KisGridConfig &config)
QColor assistantsGlobalColor()
QPointer< KoUpdater > savingUpdater
void autoSaveOnPause()
Start saving when android activity is pushed to the background.
StoryboardItemList getStoryboardItemList()
returns the list of pointers to storyboard Items for the document
QString embeddedResourcesStorageId() const
QString linkedResourcesStorageID
void sigSavingFinished(const QString &filePath)
QString generateAutoSaveFileName(const QString &path) const
KisResourceStorageSP linkedResourceStorage
QMetaObject::Connection completeSavingConnection
KisNodeWSP preActivatedNode
void setNormalAutoSaveInterval()
void slotCompleteSavingDocument(const KritaUtils::ExportFileJob &job, KisImportExportErrorCode status, const QString &errorMessage, const QString &warningMessage)
void unitChanged(const KoUnit &unit)
KoShapeLayer * shapeForNode(KisNodeSP layer) const
bool exportDocumentSync(const QString &path, const QByteArray &mimeType, KisPropertiesConfigurationSP exportConfiguration=0)
void setGridConfig(const KisGridConfig &config)
bool closePath(bool promptToSave=true)
void sigPathChanged(const QString &path)
QByteArray serializeToNativeByteArray()
serializeToNativeByteArray daves the document into a .kra file written to a memory-based byte-array
QList< KisPaintingAssistantSP > assistants
void setImageAndInitIdleWatcher(KisImageSP _image)
void setAudioVolume(qreal level)
void setAutoSaveActive(bool autoSaveIsActive)
@ CONSTRUCT
we are copy-constructing a new KisDocument
@ REPLACE
we are replacing the current KisDocument with another
void setGuidesConfig(const KisGuidesConfig &data)
bool openPathInternal(const QString &path)
KisIdleWatcher imageIdleWatcher
bool fileBatchMode() const
QByteArray outputMimeType
QVector< StoryboardComment > getStoryboardCommentsList()
returns the list of comments for the storyboard docker in the document
void setMimeTypeAfterLoading(const QString &mimeType)
void sigCompleteBackgroundSaving(const KritaUtils::ExportFileJob &job, KisImportExportErrorCode status, const QString &errorMessage, const QString &warningMessage)
void copyFromDocumentImpl(const KisDocument &rhs, CopyPolicy policy)
void sigReferenceImagesLayerChanged(KisSharedPtr< KisReferenceImagesLayer > layer)
void slotPerformIdleRoutines()
StoryboardItemList m_storyboardItemList
void slotAutoSaveImpl(std::unique_ptr< KisDocument > &&optionalClonedDocument)
void setCurrentImage(KisImageSP image, bool forceInitialUpdate=true, KisNodeSP preActivatedNode=nullptr)
void sigRecoveredChanged(bool value)
QVector< StoryboardComment > m_storyboardCommentList
QVector< QFileInfo > getAudioTracks() const
KisUniqueColorSet colorHistoryModel
bool exportDocumentImpl(const KritaUtils::ExportFileJob &job, KisPropertiesConfigurationSP exportConfiguration, bool isAdvancedExporting=false)
void setStoryboardCommentList(const QVector< StoryboardComment > &storyboardCommentList, bool emitSignal=false)
sets the list of comments for the storyboard docker in the document, emits empty signal if emitSignal...
void setPaletteList(const QList< KoColorSetSP > &paletteList, bool emitSignal=false)
setPaletteList replaces the palettes in the document's local resource storage with the list of palett...
void slotCompleteAutoSaving(const KritaUtils::ExportFileJob &job, KisImportExportErrorCode status, const QString &errorMessage, const QString &warningMessage)
KisDocument * clone(bool addStorage=false)
creates a clone of the document and returns it. Please make sure that you hold all the necessary lock...
void setInfiniteAutoSaveInterval()
void sigReferenceImagesChanged()
QString embeddedResourcesStorageID
void setStoryboardItemList(const StoryboardItemList &storyboardItemList, bool emitSignal=false)
sets the storyboardItemList in the document, emits empty signal if emitSignal is true.
bool openPath(const QString &path, OpenFlags flags=None)
openPath Open a Path
KisGuidesConfig guidesConfig
QVector< QFileInfo > audioTracks
void sigMirrorAxisConfigChanged()
QString prettyPath() const
The KisDumbUndoStore class doesn't actually save commands, so you cannot undo or redo!
static KisGeneratorRegistry * instance()
static KisResourcesInterfaceSP instance()
void setTrackedImage(KisImageSP image)
QImage convertToQImage(qint32 x1, qint32 y1, qint32 width, qint32 height, const KoColorProfile *profile)
KisGroupLayerSP rootLayer() const
UndoResult tryUndoUnfinishedLod0Stroke()
const KoColorSpace * colorSpace() const
void requestUndoDuringStroke()
QString nextLayerName(const QString &baseName="") const
bool assignImageProfile(const KoColorProfile *profile, bool blockAllUpdates=false)
KisImage * clone(bool exactCopy=false)
void setDefaultProjectionColor(const KoColor &color)
void requestStrokeCancellation()
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override
KisSelectionSP globalSelection() const
QRect bounds() const override
bool tryBarrierLock(bool readOnly=false)
Tries to lock the image without waiting for the jobs to finish.
void endStroke(KisStrokeId id) override
void requestRedoDuringStroke()
void setResolution(double xres, double yres)
QString errorMessage() const
The class managing all the filters.
static KisImportExportFilter * filterForMimeType(const QString &mimetype, Direction direction)
filterForMimeType loads the relevant import/export plugin and returns it. The caller is responsible f...
static KisMacosSecurityBookmarkManager * instance()
bool parentDirHasPermissions(const QString &path)
KisViewManager * viewManager
static QString mimeTypeForFile(const QString &file, bool checkExistingFiles=true)
Find the mimetype for the given filename. The filename must include a suffix.
The KisMirrorAxisConfig class stores configuration for the KisMirrorAxis canvas decoration....
void setDefaultPixel(const KoColor &defPixel)
static MemoryReleaseObject * createMemoryReleaseObject()
static QList< KisPaintingAssistantSP > cloneAssistantList(const QList< KisPaintingAssistantSP > &list)
void addRecentURLToAllMainWindows(QUrl url, QUrl oldUrl=QUrl())
static KisPart * instance()
KisMainWindow * currentMainwindow() const
The KisRecoverNamedAutosaveDialog class is a dialog to recover already existing files from autosave.
QRectF boundingImageRect() const
static bool getResourceIdFromVersionedFilename(QString filename, QString resourceType, QString storageLocation, int &outResourceId)
Note that here you can put even the original filename - any filename from the versioned_resources - a...
static KisResourceLoaderRegistry * instance()
bool removeStorage(const QString &storageLocation)
removeStorage removes the temporary storage from the database
bool addStorage(const QString &storageLocation, KisResourceStorageSP storage)
addStorage Adds a new resource storage to the database. The storage is will be marked as not pre-inst...
QString filePathForResource(KoResourceSP resource)
static KisResourceLocator * instance()
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
KoResourceSP resourceForId(int id) const
KoResourceSP importResourceFile(const QString &filename, const bool allowOverwrite, const QString &storageId=QString("")) override
importResourceFile
bool updateResource(KoResourceSP resource) override
updateResource creates a new version of the resource in the storage and in the database....
bool addResource(KoResourceSP resource, const QString &storageId=QString("")) override
addResource adds the given resource to the database and storage. If the resource already exists in th...
void setResourceFilter(ResourceFilter filter) override
QModelIndex indexForResource(KoResourceSP resource) const override
indexFromResource
static KisResourceServerProvider * instance()
static const QString s_meta_name
void enableJob(JobType type, bool enable=true, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
virtual void initStrokeCallback()
void setClearsRedoOnStart(bool value)
void setRequestsOtherStrokesToEnd(bool value)
static void log(const QString &message)
Logs with date/time.
bool blockUntilOperationsFinished(KisImageSP image)
blockUntilOperationsFinished blocks the GUI of the application until execution of actions on image is...
QPointer< KoUpdater > createThreadedUpdater(const QString &name)
void blockUntilOperationsFinishedForced(KisImageSP image)
blockUntilOperationsFinished blocks the GUI of the application until execution of actions on image is...
QPointer< KoUpdater > createUnthreadedUpdater(const QString &name)
create a new progress updater
KisCanvasResourceProvider * canvasResourceProvider()
QPointer< KisDocument > document
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
virtual const KoColorProfile * profile() const =0
void setOpacity(quint8 alpha)
void toQColor(QColor *c) const
a convenience method for the above.
The dialog that shows information about the document.
The class containing all meta information about a document.
void setAboutInfo(const QString &info, const QString &data)
T get(const QString &id) const
static QString generateHash(const QString &filename)
generateHash reads the given file and generates a hex-encoded md5sum for the file.
A simple wrapper object for the main information about the resource.
static StoryboardItemList cloneStoryboardItemList(const StoryboardItemList &list)
QQueue< PostponedJob > m_postponedJobs
void notifySetIndexChangedOneCommand() override
UndoStack(KisDocument *doc)
void processPostponedJobs()
void setIndex(int idx) override
void setIndexImpl(int idx)
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
KUndo2MagicString kundo2_noi18n(const QString &text)
QPointF absoluteToRelative(const QPointF &pt, const QRectF &rc)
bool hasDelayedNodeWithUpdates(KisNodeSP root)
void recursiveApplyNodes(NodePointer node, Functor func)
void forceAllDelayedNodesUpdate(KisNodeSP root)
BackgroudSavingStartResult
@ AnotherSavingInProgress
void setPinnedToTimeline(bool pinned)
virtual void setUserLocked(bool l)
void setOpacity(quint8 val)
virtual KisPaintDeviceSP paintDevice() const =0
virtual KisFilterConfigurationSP defaultConfiguration(KisResourcesInterfaceSP resourcesInterface) const
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)