Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 64 |
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 @@ | |||
16 | #include "drawpad.h" | 16 | #include "drawpad.h" |
17 | #include "newpagedialog.h" | 17 | #include "newpagedialog.h" |
18 | #include "page.h" | ||
18 | #include "tool.h" | 19 | #include "tool.h" |
19 | 20 | ||
@@ -26,5 +27,4 @@ | |||
26 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
27 | #include <qpainter.h> | 28 | #include <qpainter.h> |
28 | #include <qpixmap.h> | ||
29 | #include <qtextcodec.h> | 29 | #include <qtextcodec.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
@@ -39,5 +39,5 @@ public: | |||
39 | ~DrawPadCanvasXmlHandler(); | 39 | ~DrawPadCanvasXmlHandler(); |
40 | 40 | ||
41 | QList<QPixmap> pixmaps(); | 41 | QList<Page> pages(); |
42 | 42 | ||
43 | bool startElement(const QString& namespaceURI, const QString& localName, | 43 | bool startElement(const QString& namespaceURI, const QString& localName, |
@@ -56,5 +56,5 @@ private: | |||
56 | ulong m_dataLenght; | 56 | ulong m_dataLenght; |
57 | QString m_dataFormat; | 57 | QString m_dataFormat; |
58 | QList<QPixmap> m_pixmaps; | 58 | QList<Page> m_pages; |
59 | }; | 59 | }; |
60 | 60 | ||
@@ -68,7 +68,7 @@ DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler() | |||
68 | } | 68 | } |
69 | 69 | ||
70 | QList<QPixmap> DrawPadCanvasXmlHandler::pixmaps() | 70 | QList<Page> DrawPadCanvasXmlHandler::pages() |
71 | { | 71 | { |
72 | return m_pixmaps; | 72 | return m_pages; |
73 | } | 73 | } |
74 | 74 | ||
@@ -148,7 +148,7 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | QPixmap* pixmap = new QPixmap(image.width(), image.height()); | 150 | Page* page = new Page(image.width(), image.height()); |
151 | pixmap->convertFromImage(image); | 151 | page->convertFromImage(image); |
152 | m_pixmaps.append(pixmap); | 152 | m_pages.append(page); |
153 | } | 153 | } |
154 | 154 | ||
@@ -182,13 +182,13 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
182 | xmlSimpleReader.parse(xmlInputSource); | 182 | xmlSimpleReader.parse(xmlInputSource); |
183 | 183 | ||
184 | m_pages = drawPadCanvasXmlHandler.pixmaps(); | 184 | m_pages = drawPadCanvasXmlHandler.pages(); |
185 | 185 | ||
186 | if (m_pages.isEmpty()) { | 186 | if (m_pages.isEmpty()) { |
187 | m_pages.append(new QPixmap(contentsRect().size())); | 187 | m_pages.append(new Page(contentsRect().size())); |
188 | m_pages.current()->fill(Qt::white); | 188 | m_pages.current()->fill(Qt::white); |
189 | } | 189 | } |
190 | 190 | ||
191 | m_pageBackups.clear(); | 191 | m_pageBackups.clear(); |
192 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 192 | m_pageBackups.append(new Page(*(m_pages.current()))); |
193 | 193 | ||
194 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 194 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -201,9 +201,9 @@ void DrawPadCanvas::load(QIODevice* ioDevice) | |||
201 | void DrawPadCanvas::initialPage() | 201 | void DrawPadCanvas::initialPage() |
202 | { | 202 | { |
203 | m_pages.append(new QPixmap(236, 232)); | 203 | m_pages.append(new Page(236, 232)); |
204 | m_pages.current()->fill(Qt::white); | 204 | m_pages.current()->fill(Qt::white); |
205 | 205 | ||
206 | m_pageBackups.clear(); | 206 | m_pageBackups.clear(); |
207 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 207 | m_pageBackups.append(new Page(*(m_pages.current()))); |
208 | 208 | ||
209 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 209 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -222,5 +222,5 @@ void DrawPadCanvas::save(QIODevice* ioDevice) | |||
222 | textStream << " <images>" << endl; | 222 | textStream << " <images>" << endl; |
223 | 223 | ||
224 | QListIterator<QPixmap> bufferIterator(m_pages); | 224 | QListIterator<Page> bufferIterator(m_pages); |
225 | 225 | ||
226 | for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) { | 226 | for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) { |
@@ -257,11 +257,11 @@ void DrawPadCanvas::save(QIODevice* ioDevice) | |||
257 | void DrawPadCanvas::importPage(const QString& fileName) | 257 | void DrawPadCanvas::importPage(const QString& fileName) |
258 | { | 258 | { |
259 | QPixmap* importedPixmap = new QPixmap(); | 259 | Page* importedPage = new Page(); |
260 | 260 | ||
261 | importedPixmap->load(fileName); | 261 | importedPage->load(fileName); |
262 | m_pages.insert(m_pages.at() + 1, importedPixmap); | 262 | m_pages.insert(m_pages.at() + 1, importedPage); |
263 | 263 | ||
264 | m_pageBackups.clear(); | 264 | m_pageBackups.clear(); |
265 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 265 | m_pageBackups.append(new Page(*(m_pages.current()))); |
266 | 266 | ||
267 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 267 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -309,10 +309,10 @@ void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,c | |||
309 | } | 309 | } |
310 | 310 | ||
311 | QPixmap* DrawPadCanvas::currentPage() | 311 | Page* DrawPadCanvas::currentPage() |
312 | { | 312 | { |
313 | return m_pages.current(); | 313 | return m_pages.current(); |
314 | } | 314 | } |
315 | 315 | ||
316 | QList<QPixmap> DrawPadCanvas::pages() | 316 | QList<Page> DrawPadCanvas::pages() |
317 | { | 317 | { |
318 | return m_pages; | 318 | return m_pages; |
@@ -340,5 +340,5 @@ void DrawPadCanvas::backupPage() | |||
340 | } | 340 | } |
341 | 341 | ||
342 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 342 | m_pageBackups.append(new Page(*(m_pages.current()))); |
343 | 343 | ||
344 | emit pageBackupsChanged(); | 344 | emit pageBackupsChanged(); |
@@ -358,9 +358,9 @@ void DrawPadCanvas::deleteAll() | |||
358 | m_pages.clear(); | 358 | m_pages.clear(); |
359 | 359 | ||
360 | m_pages.append(new QPixmap(contentsRect().size())); | 360 | m_pages.append(new Page(contentsRect().size())); |
361 | m_pages.current()->fill(Qt::white); | 361 | m_pages.current()->fill(Qt::white); |
362 | 362 | ||
363 | m_pageBackups.clear(); | 363 | m_pageBackups.clear(); |
364 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 364 | m_pageBackups.append(new Page(*(m_pages.current()))); |
365 | 365 | ||
366 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 366 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -380,10 +380,10 @@ void DrawPadCanvas::newPage() | |||
380 | 380 | ||
381 | if (newPageDialog.exec() == QDialog::Accepted) { | 381 | if (newPageDialog.exec() == QDialog::Accepted) { |
382 | m_pages.insert(m_pages.at() + 1, new QPixmap(newPageDialog.selectedWidth(), | 382 | m_pages.insert(m_pages.at() + 1, new Page(newPageDialog.selectedWidth(), |
383 | newPageDialog.selectedHeight())); | 383 | newPageDialog.selectedHeight())); |
384 | m_pages.current()->fill(newPageDialog.selectedColor()); | 384 | m_pages.current()->fill(newPageDialog.selectedColor()); |
385 | 385 | ||
386 | m_pageBackups.clear(); | 386 | m_pageBackups.clear(); |
387 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 387 | m_pageBackups.append(new Page(*(m_pages.current()))); |
388 | 388 | ||
389 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 389 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -426,10 +426,10 @@ void DrawPadCanvas::deletePage() | |||
426 | 426 | ||
427 | if (m_pages.isEmpty()) { | 427 | if (m_pages.isEmpty()) { |
428 | m_pages.append(new QPixmap(contentsRect().size())); | 428 | m_pages.append(new Page(contentsRect().size())); |
429 | m_pages.current()->fill(Qt::white); | 429 | m_pages.current()->fill(Qt::white); |
430 | } | 430 | } |
431 | 431 | ||
432 | m_pageBackups.clear(); | 432 | m_pageBackups.clear(); |
433 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 433 | m_pageBackups.append(new Page(*(m_pages.current()))); |
434 | 434 | ||
435 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 435 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -483,5 +483,5 @@ void DrawPadCanvas::goFirstPage() | |||
483 | m_pages.first(); | 483 | m_pages.first(); |
484 | m_pageBackups.clear(); | 484 | m_pageBackups.clear(); |
485 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 485 | m_pageBackups.append(new Page(*(m_pages.current()))); |
486 | 486 | ||
487 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 487 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -496,5 +496,5 @@ void DrawPadCanvas::goPreviousPage() | |||
496 | m_pages.prev(); | 496 | m_pages.prev(); |
497 | m_pageBackups.clear(); | 497 | m_pageBackups.clear(); |
498 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 498 | m_pageBackups.append(new Page(*(m_pages.current()))); |
499 | 499 | ||
500 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 500 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -509,5 +509,5 @@ void DrawPadCanvas::goNextPage() | |||
509 | m_pages.next(); | 509 | m_pages.next(); |
510 | m_pageBackups.clear(); | 510 | m_pageBackups.clear(); |
511 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 511 | m_pageBackups.append(new Page(*(m_pages.current()))); |
512 | 512 | ||
513 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 513 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |
@@ -522,5 +522,5 @@ void DrawPadCanvas::goLastPage() | |||
522 | m_pages.last(); | 522 | m_pages.last(); |
523 | m_pageBackups.clear(); | 523 | m_pageBackups.clear(); |
524 | m_pageBackups.append(new QPixmap(*(m_pages.current()))); | 524 | m_pageBackups.append(new Page(*(m_pages.current()))); |
525 | 525 | ||
526 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); | 526 | resizeContents(m_pages.current()->width(), m_pages.current()->height()); |