summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/drawpadcanvas.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 9f1e50b..79bef35 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -16,4 +16,5 @@
#include "drawpad.h"
#include "newpagedialog.h"
+#include "page.h"
#include "tool.h"
@@ -26,5 +27,4 @@
#include <qmessagebox.h>
#include <qpainter.h>
-#include <qpixmap.h>
#include <qtextcodec.h>
#include <qtextstream.h>
@@ -39,5 +39,5 @@ public:
~DrawPadCanvasXmlHandler();
- QList<QPixmap> pixmaps();
+ QList<Page> pages();
bool startElement(const QString& namespaceURI, const QString& localName,
@@ -56,5 +56,5 @@ private:
ulong m_dataLenght;
QString m_dataFormat;
- QList<QPixmap> m_pixmaps;
+ QList<Page> m_pages;
};
@@ -68,7 +68,7 @@ DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler()
}
-QList<QPixmap> DrawPadCanvasXmlHandler::pixmaps()
+QList<Page> DrawPadCanvasXmlHandler::pages()
{
- return m_pixmaps;
+ return m_pages;
}
@@ -148,7 +148,7 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
}
- QPixmap* pixmap = new QPixmap(image.width(), image.height());
- pixmap->convertFromImage(image);
- m_pixmaps.append(pixmap);
+ Page* page = new Page(image.width(), image.height());
+ page->convertFromImage(image);
+ m_pages.append(page);
}
@@ -182,13 +182,13 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
xmlSimpleReader.parse(xmlInputSource);
- m_pages = drawPadCanvasXmlHandler.pixmaps();
+ m_pages = drawPadCanvasXmlHandler.pages();
if (m_pages.isEmpty()) {
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
}
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -201,9 +201,9 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
void DrawPadCanvas::initialPage()
{
- m_pages.append(new QPixmap(236, 232));
+ m_pages.append(new Page(236, 232));
m_pages.current()->fill(Qt::white);
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -222,5 +222,5 @@ void DrawPadCanvas::save(QIODevice* ioDevice)
textStream << " <images>" << endl;
- QListIterator<QPixmap> bufferIterator(m_pages);
+ QListIterator<Page> bufferIterator(m_pages);
for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) {
@@ -257,11 +257,11 @@ void DrawPadCanvas::save(QIODevice* ioDevice)
void DrawPadCanvas::importPage(const QString& fileName)
{
- QPixmap* importedPixmap = new QPixmap();
+ Page* importedPage = new Page();
- importedPixmap->load(fileName);
- m_pages.insert(m_pages.at() + 1, importedPixmap);
+ importedPage->load(fileName);
+ m_pages.insert(m_pages.at() + 1, importedPage);
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -309,10 +309,10 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c
}
-QPixmap* DrawPadCanvas::currentPage()
+Page* DrawPadCanvas::currentPage()
{
return m_pages.current();
}
-QList<QPixmap> DrawPadCanvas::pages()
+QList<Page> DrawPadCanvas::pages()
{
return m_pages;
@@ -340,5 +340,5 @@ void DrawPadCanvas::backupPage()
}
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
emit pageBackupsChanged();
@@ -358,9 +358,9 @@ void DrawPadCanvas::deleteAll()
m_pages.clear();
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -380,10 +380,10 @@ void DrawPadCanvas::newPage()
if (newPageDialog.exec() == QDialog::Accepted) {
- m_pages.insert(m_pages.at() + 1, new QPixmap(newPageDialog.selectedWidth(),
- newPageDialog.selectedHeight()));
+ m_pages.insert(m_pages.at() + 1, new Page(newPageDialog.selectedWidth(),
+ newPageDialog.selectedHeight()));
m_pages.current()->fill(newPageDialog.selectedColor());
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -426,10 +426,10 @@ void DrawPadCanvas::deletePage()
if (m_pages.isEmpty()) {
- m_pages.append(new QPixmap(contentsRect().size()));
+ m_pages.append(new Page(contentsRect().size()));
m_pages.current()->fill(Qt::white);
}
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -483,5 +483,5 @@ void DrawPadCanvas::goFirstPage()
m_pages.first();
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -496,5 +496,5 @@ void DrawPadCanvas::goPreviousPage()
m_pages.prev();
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -509,5 +509,5 @@ void DrawPadCanvas::goNextPage()
m_pages.next();
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
@@ -522,5 +522,5 @@ void DrawPadCanvas::goLastPage()
m_pages.last();
m_pageBackups.clear();
- m_pageBackups.append(new QPixmap(*(m_pages.current())));
+ m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());