[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegraphics/gwenview
From: Aurélien Gâteau <agateau () kde ! org>
Date: 2010-05-21 14:58:24
Message-ID: 20100521150402.BE3F9AC8BE () svn ! kde ! org
[Download RAW message or body]
SVN commit 1129196 by gateau:
Refactored to prepare for delayed undostack pushing
M +1 -2 app/gvcore.cpp
M +1 -2 app/imageopscontextmanageritem.cpp
M +2 -1 lib/abstractimageoperation.cpp
M +2 -2 lib/abstractimageoperation.h
M +4 -8 tests/documenttest.cpp
M +1 -2 tests/transformimageoperationtest.cpp
--- trunk/KDE/kdegraphics/gwenview/app/gvcore.cpp #1129195:1129196
@@ -224,8 +224,7 @@
static void applyTransform(const KUrl& url, Orientation orientation) {
TransformImageOperation* op = new TransformImageOperation(orientation);
Document::Ptr doc = DocumentFactory::instance()->load(url);
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
}
--- trunk/KDE/kdegraphics/gwenview/app/imageopscontextmanageritem.cpp #1129195:1129196
@@ -281,8 +281,7 @@
KUrl url = contextManager()->currentUrl();
Document::Ptr doc = DocumentFactory::instance()->load(url);
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
}
--- trunk/KDE/kdegraphics/gwenview/lib/abstractimageoperation.cpp #1129195:1129196
@@ -48,8 +48,9 @@
}
-void AbstractImageOperation::setDocument(Document::Ptr doc) {
+void AbstractImageOperation::applyToDocument(Document::Ptr doc) {
d->mUrl = doc->url();
+ doc->undoStack()->push(this);
}
--- trunk/KDE/kdegraphics/gwenview/lib/abstractimageoperation.h #1129195:1129196
@@ -35,12 +35,12 @@
struct AbstractImageOperationPrivate;
-class GWENVIEWLIB_EXPORT AbstractImageOperation : public QUndoCommand {
+class GWENVIEWLIB_EXPORT AbstractImageOperation : protected QUndoCommand {
public:
AbstractImageOperation();
virtual ~AbstractImageOperation();
- void setDocument(Document::Ptr);
+ void applyToDocument(Document::Ptr);
Document::Ptr document() const;
private:
--- trunk/KDE/kdegraphics/gwenview/tests/documenttest.cpp #1129195:1129196
@@ -451,8 +451,7 @@
// Modify image
QVERIFY(doc->editor());
TestOperation* op = new TestOperation;
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
QVERIFY(doc->isModified());
QCOMPARE(modifiedDocumentListChangedSpy.count(), 1);
modifiedDocumentListChangedSpy.clear();
@@ -547,8 +546,7 @@
// Modify it
TransformImageOperation* op = new TransformImageOperation(ROT_90);
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
QCOMPARE(spy.count(), 1);
@@ -579,13 +577,11 @@
QCOMPARE(savedSpy.count(), 0);
op = new TransformImageOperation(ROT_90);
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
QCOMPARE(modifiedSpy.count(), 1);
op = new TransformImageOperation(ROT_90);
- op->setDocument(doc);
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
QCOMPARE(modifiedSpy.count(), 2);
doc->undoStack()->undo();
--- trunk/KDE/kdegraphics/gwenview/tests/transformimageoperationtest.cpp #1129195:1129196
@@ -60,10 +60,9 @@
Document::Ptr doc = DocumentFactory::instance()->load(url);
TransformImageOperation* op = new TransformImageOperation(ROT_90);
- op->setDocument(doc);
QEventLoop loop;
connect(doc.data(), SIGNAL(allTasksDone()), &loop, SLOT(quit()));
- doc->undoStack()->push(op);
+ op->applyToDocument(doc);
loop.exec();
QCOMPARE(image, doc->image());
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic