"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libs/ui/KisDocument.cpp" between
krita-5.1.3.tar.xz and krita-5.1.4.tar.xz

About: Krita is a painting program offering art tools for everyone (concept art, texture and matte painters, illustrations and comics).

KisDocument.cpp  (krita-5.1.3.tar.xz):KisDocument.cpp  (krita-5.1.4.tar.xz)
skipping to change at line 739 skipping to change at line 739
// Do nothing: the empty string is user file location // Do nothing: the empty string is user file location
break; break;
} }
int numOfBackupsKept = cfg.readEntry<int>("numberofbackupfiles", 1); int numOfBackupsKept = cfg.readEntry<int>("numberofbackupfiles", 1);
QString suffix = cfg.readEntry<QString>("backupfilesuffix", "~"); QString suffix = cfg.readEntry<QString>("backupfilesuffix", "~");
if (numOfBackupsKept == 1) { if (numOfBackupsKept == 1) {
if (!KisBackup::simpleBackupFile(job.filePath, backupDir, suffix)) { if (!KisBackup::simpleBackupFile(job.filePath, backupDir, suffix)) {
qWarning() << "Failed to create simple backup file!" << job.file Path << backupDir << suffix; qWarning() << "Failed to create simple backup file!" << job.file Path << backupDir << suffix;
KisUsageLogger::log(QString("Failed to create a simple backup fo KisUsageLogger::log(QString("Failed to create a simple backup fo
r %1 in %2.").arg(job.filePath).arg(backupDir.isEmpty() ? "the same location as r %1 in %2.")
the file" : backupDir)); .arg(job.filePath, backupDir.isEmpty()
? "the same locat
ion as the file"
: backupDir));
return false; return false;
} }
else { else {
KisUsageLogger::log(QString("Create a simple backup for %1 in %2 KisUsageLogger::log(QString("Create a simple backup for %1 in %2
.").arg(job.filePath).arg(backupDir.isEmpty() ? "the same location as the file" .")
: backupDir)); .arg(job.filePath, backupDir.isEmpty()
? "the same locat
ion as the file"
: backupDir));
} }
} }
else if (numOfBackupsKept > 1) { else if (numOfBackupsKept > 1) {
if (!KisBackup::numberedBackupFile(job.filePath, backupDir, suffix, numOfBackupsKept)) { if (!KisBackup::numberedBackupFile(job.filePath, backupDir, suffix, numOfBackupsKept)) {
qWarning() << "Failed to create numbered backup file!" << job.fi lePath << backupDir << suffix; qWarning() << "Failed to create numbered backup file!" << job.fi lePath << backupDir << suffix;
KisUsageLogger::log(QString("Failed to create a numbered backup KisUsageLogger::log(QString("Failed to create a numbered backup
for %2.").arg(job.filePath).arg(backupDir.isEmpty() ? "the same location as the for %2.")
file" : backupDir)); .arg(job.filePath, backupDir.isEmpty()
? "the same locat
ion as the file"
: backupDir));
return false; return false;
} }
else { else {
KisUsageLogger::log(QString("Create a simple backup for %1 in %2 KisUsageLogger::log(QString("Create a simple backup for %1 in %2
.").arg(job.filePath).arg(backupDir.isEmpty() ? "the same location as the file" .")
: backupDir)); .arg(job.filePath, backupDir.isEmpty()
? "the same locat
ion as the file"
: backupDir));
} }
} }
} }
//KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(!job.mimeType.isEmpty(), false); //KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(!job.mimeType.isEmpty(), false);
if (job.mimeType.isEmpty()) { if (job.mimeType.isEmpty()) {
KisImportExportErrorCode error = ImportExportCodes::FileFormatNotSupport ed; KisImportExportErrorCode error = ImportExportCodes::FileFormatNotSupport ed;
slotCompleteSavingDocument(job, error, error.errorMessage(), ""); slotCompleteSavingDocument(job, error, error.errorMessage(), "");
return false; return false;
skipping to change at line 796 skipping to change at line 808
bool KisDocument::exportDocument(const QString &path, const QByteArray &mimeType , bool isAdvancedExporting, bool showWarnings, KisPropertiesConfigurationSP expo rtConfiguration) bool KisDocument::exportDocument(const QString &path, const QByteArray &mimeType , bool isAdvancedExporting, bool showWarnings, KisPropertiesConfigurationSP expo rtConfiguration)
{ {
using namespace KritaUtils; using namespace KritaUtils;
SaveFlags flags = SaveIsExporting; SaveFlags flags = SaveIsExporting;
if (showWarnings) { if (showWarnings) {
flags |= SaveShowWarnings; flags |= SaveShowWarnings;
} }
KisUsageLogger::log(QString("Exporting Document: %1 as %2. %3 * %4 pixels, % KisUsageLogger::log(QString("Exporting Document: %1 as %2. %3 * %4 pixels, %
5 layers, %6 frames, %7 framerate. Export configuration: %8") 5 layers, %6 frames, %7 "
.arg(path) "framerate. Export configuration: %8")
.arg(QString::fromLatin1(mimeType)) .arg(path, QString::fromLatin1(mimeType), QString::n
.arg(d->image->width()) umber(d->image->width()),
.arg(d->image->height()) QString::number(d->image->height()), QString::n
.arg(d->image->nlayers()) umber(d->image->nlayers()),
.arg(d->image->animationInterface()->totalLength()) QString::number(d->image->animationInterface()-
.arg(d->image->animationInterface()->framerate()) >totalLength()),
.arg(exportConfiguration ? exportConfiguration->toXML() QString::number(d->image->animationInterface()-
: "No configuration")); >framerate()),
(exportConfiguration ? exportConfiguration->toX
ML() : "No configuration")));
return exportDocumentImpl(KritaUtils::ExportFileJob(path, return exportDocumentImpl(KritaUtils::ExportFileJob(path,
mimeType, mimeType,
flags), flags),
exportConfiguration, isAdvancedExporting); exportConfiguration, isAdvancedExporting);
} }
bool KisDocument::saveAs(const QString &_path, const QByteArray &mimeType, bool showWarnings, KisPropertiesConfigurationSP exportConfiguration) bool KisDocument::saveAs(const QString &_path, const QByteArray &mimeType, bool showWarnings, KisPropertiesConfigurationSP exportConfiguration)
{ {
using namespace KritaUtils; using namespace KritaUtils;
KisUsageLogger::log(QString("Saving Document %9 as %1 (mime: %2). %3 * %4 pi KisUsageLogger::log(QString("Saving Document %9 as %1 (mime: %2). %3 * %4 pi
xels, %5 layers. %6 frames, %7 framerate. Export configuration: %8") xels, %5 layers. %6 frames, "
.arg(_path) "%7 framerate. Export configuration: %8")
.arg(QString::fromLatin1(mimeType)) .arg(_path, QString::fromLatin1(mimeType), QString::
.arg(d->image->width()) number(d->image->width()),
.arg(d->image->height()) QString::number(d->image->height()), QString::n
.arg(d->image->nlayers()) umber(d->image->nlayers()),
.arg(d->image->animationInterface()->totalLength()) QString::number(d->image->animationInterface()-
.arg(d->image->animationInterface()->framerate()) >totalLength()),
.arg(exportConfiguration ? exportConfiguration->toXML() QString::number(d->image->animationInterface()-
: "No configuration") >framerate()),
.arg(path())); (exportConfiguration ? exportConfiguration->toX
ML() : "No configuration"),
path()));
// Check whether it's an existing resource were are saving to // Check whether it's an existing resource were are saving to
if (resourceSavingFilter(_path, mimeType, exportConfiguration)) { if (resourceSavingFilter(_path, mimeType, exportConfiguration)) {
return true; return true;
} }
return exportDocumentImpl(ExportFileJob(_path, return exportDocumentImpl(ExportFileJob(_path,
mimeType, mimeType,
showWarnings ? SaveShowWarnings : Sa veNone), showWarnings ? SaveShowWarnings : Sa veNone),
exportConfiguration); exportConfiguration);
skipping to change at line 1329 skipping to change at line 1337
} }
const KritaUtils::ExportFileJob job = d->backgroundSaveJob; const KritaUtils::ExportFileJob job = d->backgroundSaveJob;
d->backgroundSaveJob = KritaUtils::ExportFileJob(); d->backgroundSaveJob = KritaUtils::ExportFileJob();
// unlock at the very end // unlock at the very end
d->savingMutex.unlock(); d->savingMutex.unlock();
QFileInfo fi(job.filePath); QFileInfo fi(job.filePath);
KisUsageLogger::log(QString("Completed saving %1 (mime: %2). Result: %3. War ning: %4. Size: %5") KisUsageLogger::log(QString("Completed saving %1 (mime: %2). Result: %3. War ning: %4. Size: %5")
.arg(job.filePath) .arg(job.filePath, QString::fromLatin1(job.mimeType)
.arg(QString::fromLatin1(job.mimeType)) ,
.arg(!status.isOk() ? errorMessage : "OK") (!status.isOk() ? errorMessage : "OK"), warning
.arg(warningMessage) Message,
.arg(fi.size())); QString::number(fi.size())));
emit sigCompleteBackgroundSaving(job, status, errorMessage, warningMessage); emit sigCompleteBackgroundSaving(job, status, errorMessage, warningMessage);
} }
void KisDocument::slotAutoSaveImpl(std::unique_ptr<KisDocument> &&optionalCloned Document) void KisDocument::slotAutoSaveImpl(std::unique_ptr<KisDocument> &&optionalCloned Document)
{ {
if (!d->modified || !d->modifiedAfterAutosave) return; if (!d->modified || !d->modifiedAfterAutosave) return;
const QString autoSaveFileName = generateAutoSaveFileName(localFilePath()); const QString autoSaveFileName = generateAutoSaveFileName(localFilePath());
emit statusBarMessage(i18n("Autosaving... %1", autoSaveFileName), successMes sageTimeout); emit statusBarMessage(i18n("Autosaving... %1", autoSaveFileName), successMes sageTimeout);
skipping to change at line 1858 skipping to change at line 1864
d->importExportManager->setUpdater(updater); d->importExportManager->setUpdater(updater);
} }
KisImportExportErrorCode status = d->importExportManager->importDocument(loc alFilePath(), typeName); KisImportExportErrorCode status = d->importExportManager->importDocument(loc alFilePath(), typeName);
if (!status.isOk()) { if (!status.isOk()) {
if (window && window->viewManager()) { if (window && window->viewManager()) {
updater->cancel(); updater->cancel();
} }
QString msg = status.errorMessage(); QString msg = status.errorMessage();
KisUsageLogger::log(QString("Loading %1 failed: %2").arg(prettyPath()).a rg(msg)); KisUsageLogger::log(QString("Loading %1 failed: %2").arg(prettyPath(), m sg));
if (!msg.isEmpty() && !fileBatchMode()) { if (!msg.isEmpty() && !fileBatchMode()) {
DlgLoadMessages dlg(i18nc("@title:window", "Krita"), DlgLoadMessages dlg(i18nc("@title:window", "Krita"),
i18n("Could not open %2.\nReason: %1", msg, pret tyPath()), i18n("Could not open %2.\nReason: %1", msg, pret tyPath()),
errorMessage().split("\n") + warningMessage().sp lit("\n")); errorMessage().split("\n") + warningMessage().sp lit("\n"));
dlg.exec(); dlg.exec();
} }
return false; return false;
} }
else if (!warningMessage().isEmpty() && !fileBatchMode()) { else if (!warningMessage().isEmpty() && !fileBatchMode()) {
skipping to change at line 2481 skipping to change at line 2487
d->mirrorAxisConfig.setAxisPosition(QRectF(image->bounds()).center()); d->mirrorAxisConfig.setAxisPosition(QRectF(image->bounds()).center());
setCurrentImage(image); setCurrentImage(image);
for(int i = 1; i < numberOfLayers; ++i) { for(int i = 1; i < numberOfLayers; ++i) {
KisPaintLayerSP layer = new KisPaintLayer(image, image->nextLayerName(), OPACITY_OPAQUE_U8, cs); KisPaintLayerSP layer = new KisPaintLayer(image, image->nextLayerName(), OPACITY_OPAQUE_U8, cs);
layer->setPinnedToTimeline(autopin); layer->setPinnedToTimeline(autopin);
image->addNode(layer, image->root(), i); image->addNode(layer, image->root(), i);
layer->setDirty(QRect(0, 0, width, height)); layer->setDirty(QRect(0, 0, width, height));
} }
KisUsageLogger::log(QString("Created image \"%1\", %2 * %3 pixels, %4 dpi. C KisUsageLogger::log(
olor model: %6 %5 (%7). Layers: %8") QString("Created image \"%1\", %2 * %3 pixels, %4 dpi. Color model: %6 %
.arg(name) 5 (%7). Layers: %8")
.arg(width).arg(height) .arg(name, QString::number(width), QString::number(height),
.arg(imageResolution * 72.0) QString::number(imageResolution * 72.0), image->colorSpace()->c
.arg(image->colorSpace()->colorModelId().name()) olorModelId().name(),
.arg(image->colorSpace()->colorDepthId().name()) image->colorSpace()->colorDepthId().name(), image->colorSpace()
.arg(image->colorSpace()->profile()->name()) ->profile()->name(),
.arg(numberOfLayers)); QString::number(numberOfLayers)));
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return true; return true;
} }
bool KisDocument::isSaving() const bool KisDocument::isSaving() const
{ {
const bool result = d->savingMutex.tryLock(); const bool result = d->savingMutex.tryLock();
if (result) { if (result) {
 End of changes. 9 change blocks. 
50 lines changed or deleted 66 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)