Changeset View
Changeset View
Standalone View
Standalone View
lib/document/documentloadedimpl.cpp
Show All 27 Lines | |||||
28 | #include <QTransform> | 28 | #include <QTransform> | ||
29 | #include <QDebug> | 29 | #include <QDebug> | ||
30 | #include <QUrl> | 30 | #include <QUrl> | ||
31 | 31 | | |||
32 | // KDE | 32 | // KDE | ||
33 | 33 | | |||
34 | // Local | 34 | // Local | ||
35 | #include "documentjob.h" | 35 | #include "documentjob.h" | ||
36 | #include "gwenviewconfig.h" | ||||
36 | #include "imageutils.h" | 37 | #include "imageutils.h" | ||
37 | #include "savejob.h" | 38 | #include "savejob.h" | ||
38 | 39 | | |||
39 | namespace Gwenview | 40 | namespace Gwenview | ||
40 | { | 41 | { | ||
41 | 42 | | |||
42 | struct DocumentLoadedImplPrivate | 43 | struct DocumentLoadedImplPrivate | ||
43 | { | 44 | { | ||
Show All 32 Lines | |||||
76 | Document::LoadingState DocumentLoadedImpl::loadingState() const | 77 | Document::LoadingState DocumentLoadedImpl::loadingState() const | ||
77 | { | 78 | { | ||
78 | return Document::Loaded; | 79 | return Document::Loaded; | ||
79 | } | 80 | } | ||
80 | 81 | | |||
81 | bool DocumentLoadedImpl::saveInternal(QIODevice* device, const QByteArray& format) | 82 | bool DocumentLoadedImpl::saveInternal(QIODevice* device, const QByteArray& format) | ||
82 | { | 83 | { | ||
83 | QImageWriter writer(device, format); | 84 | QImageWriter writer(device, format); | ||
85 | // If we're saving a non-JPEG image as a JPEG, respect the quality setting | ||||
86 | if (format == QStringLiteral("jpeg")) { | ||||
87 | writer.setQuality(GwenviewConfig::jPEGQuality()); | ||||
88 | } | ||||
84 | bool ok = writer.write(document()->image()); | 89 | bool ok = writer.write(document()->image()); | ||
85 | if (ok) { | 90 | if (ok) { | ||
86 | setDocumentFormat(format); | 91 | setDocumentFormat(format); | ||
87 | } else { | 92 | } else { | ||
88 | setDocumentErrorString(writer.errorString()); | 93 | setDocumentErrorString(writer.errorString()); | ||
89 | } | 94 | } | ||
90 | return ok; | 95 | return ok; | ||
91 | } | 96 | } | ||
Show All 32 Lines |