[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegraphics/gwenview
From: Aurélien Gâteau <aurelien.gateau () free ! fr>
Date: 2007-06-30 22:53:48
Message-ID: 1183244028.370074.1335.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 681943 by gateau:
Introduced Document::format() and Document::isModified()
Started to implement format(). isModified() has not been implemented yet.
M +4 -0 lib/abstractdocumentimpl.cpp
M +1 -0 lib/abstractdocumentimpl.h
M +13 -0 lib/document.cpp
M +5 -0 lib/document.h
M +3 -1 lib/loadingdocumentimpl.cpp
M +3 -2 tests/documenttest.cpp
--- trunk/KDE/kdegraphics/gwenview/lib/abstractdocumentimpl.cpp #681942:681943
@@ -60,4 +60,8 @@
d->mDocument->setImage(image);
}
+
+void AbstractDocumentImpl::setDocumentFormat(const QByteArray& format) {
+ d->mDocument->setFormat(format);
+}
} // namespace
--- trunk/KDE/kdegraphics/gwenview/lib/abstractdocumentimpl.h #681942:681943
@@ -59,6 +59,7 @@
protected:
Document* document() const;
void setDocumentImage(const QImage& image);
+ void setDocumentFormat(const QByteArray& format);
void switchToImpl(AbstractDocumentImpl* impl);
private:
--- trunk/KDE/kdegraphics/gwenview/lib/document.cpp #681942:681943
@@ -37,6 +37,7 @@
AbstractDocumentImpl* mImpl;
KUrl mUrl;
QImage mImage;
+ QByteArray mFormat;
};
@@ -97,4 +98,16 @@
return d->mImpl->save(url, format);
}
+QByteArray Document::format() const {
+ return d->mFormat;
+}
+
+void Document::setFormat(const QByteArray& format) {
+ d->mFormat = format;
+}
+
+bool Document::isModified() const {
+ return false;
+}
+
} // namespace
--- trunk/KDE/kdegraphics/gwenview/lib/document.h #681942:681943
@@ -55,12 +55,16 @@
bool isLoaded() const;
+ bool isModified() const;
+
QImage& image();
KUrl url() const;
SaveResult save(const KUrl& url, const QString& format);
+ QByteArray format() const;
+
Q_SIGNALS:
void loaded();
@@ -69,6 +73,7 @@
friend class AbstractDocumentImpl;
void setImage(const QImage&);
+ void setFormat(const QByteArray&);
void switchToImpl(AbstractDocumentImpl* impl);
Document();
--- trunk/KDE/kdegraphics/gwenview/lib/loadingdocumentimpl.cpp #681942:681943
@@ -135,7 +135,9 @@
Q_ASSERT(d->mThread.isFinished());
setDocumentImage(d->mThread.image());
loaded();
- if (d->mThread.format() == "jpeg") {
+ QByteArray format = d->mThread.format();
+ setDocumentFormat(format);
+ if (format == "jpeg") {
switchToImpl(new JpegDocumentLoadedImpl(document(), d->mThread.data()));
} else {
switchToImpl(new DocumentLoadedImpl(document()));
--- trunk/KDE/kdegraphics/gwenview/tests/documenttest.cpp #681942:681943
@@ -43,6 +43,7 @@
QTest::qWait(30);
}
QCOMPARE(image, doc->image());
+ QCOMPARE(doc->format().data(), "png");
}
/**
@@ -93,14 +94,14 @@
KUrl url("orient6.jpg");
Document::Ptr doc = DocumentFactory::instance()->load(url);
KUrl destUrl(QDir::currentPath() + "/result.png");
- Document::SaveResult result = doc->save(destUrl, "PNG");
+ Document::SaveResult result = doc->save(destUrl, "png");
QCOMPARE(result, Document::SR_OK);
QVERIFY2(doc->isLoaded(),
"Document is supposed to finish loading before saving"
);
- QImage image("result.png", "PNG");
+ QImage image("result.png", "png");
QCOMPARE(doc->image(), image);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic