Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 79bef35..252f4d5 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -3,49 +3,48 @@ * DrawPad - a drawing program for Opie Environment * * * * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "drawpadcanvas.h" #include "drawpad.h" #include "newpagedialog.h" #include "page.h" #include "tool.h" #include <qpe/applnk.h> #include <qpe/filemanager.h> #include <qpe/mimetype.h> #include <qbuffer.h> #include <qimage.h> -#include <qmessagebox.h> #include <qpainter.h> #include <qtextcodec.h> #include <qtextstream.h> #include <qxml.h> #include <zlib.h> class DrawPadCanvasXmlHandler: public QXmlDefaultHandler { public: DrawPadCanvasXmlHandler(); ~DrawPadCanvasXmlHandler(); QList<Page> pages(); bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts); bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName); bool characters(const QString& ch); private: enum State { Unknown, @@ -325,141 +324,111 @@ uint DrawPadCanvas::pagePosition() uint DrawPadCanvas::pageCount() { return m_pages.count(); } void DrawPadCanvas::backupPage() { QPixmap* currentBackup = m_pageBackups.current(); while (m_pageBackups.last() != currentBackup) { m_pageBackups.removeLast(); } while (m_pageBackups.count() >= (5 + 1)) { m_pageBackups.removeFirst(); } m_pageBackups.append(new Page(*(m_pages.current()))); emit pageBackupsChanged(); } void DrawPadCanvas::deleteAll() { - QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), - QMessageBox::Information, QMessageBox::Yes, - QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, - QMessageBox::NoButton, this); - - messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); - messageBox.setButtonText(QMessageBox::No, tr("No")); - - if (messageBox.exec() == QMessageBox::Yes) { m_pages.clear(); m_pages.append(new Page(contentsRect().size())); m_pages.current()->fill(Qt::white); m_pageBackups.clear(); m_pageBackups.append(new Page(*(m_pages.current()))); resizeContents(m_pages.current()->width(), m_pages.current()->height()); viewport()->update(); emit pagesChanged(); emit pageBackupsChanged(); } -} void DrawPadCanvas::newPage() { QRect rect = contentsRect(); NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), m_pDrawPad->brush().color(), this); if (newPageDialog.exec() == QDialog::Accepted) { 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 Page(*(m_pages.current()))); resizeContents(m_pages.current()->width(), m_pages.current()->height()); viewport()->update(); emit pagesChanged(); emit pageBackupsChanged(); } } void DrawPadCanvas::clearPage() { - QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), - QMessageBox::Information, QMessageBox::Yes, - QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, - QMessageBox::NoButton, this); - - messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); - messageBox.setButtonText(QMessageBox::No, tr("No")); - - if (messageBox.exec() == QMessageBox::Yes) { m_pages.current()->fill(Qt::white); viewport()->update(); } -} void DrawPadCanvas::deletePage() { - QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), - QMessageBox::Information, QMessageBox::Yes, - QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, - QMessageBox::NoButton, this); - - messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); - messageBox.setButtonText(QMessageBox::No, tr("No")); - - if (messageBox.exec() == QMessageBox::Yes) { m_pages.remove(m_pages.current()); if (m_pages.isEmpty()) { m_pages.append(new Page(contentsRect().size())); m_pages.current()->fill(Qt::white); } m_pageBackups.clear(); m_pageBackups.append(new Page(*(m_pages.current()))); resizeContents(m_pages.current()->width(), m_pages.current()->height()); viewport()->update(); emit pagesChanged(); emit pageBackupsChanged(); } -} bool DrawPadCanvas::undoEnabled() { return (m_pageBackups.current() != m_pageBackups.getFirst()); } bool DrawPadCanvas::redoEnabled() { return (m_pageBackups.current() != m_pageBackups.getLast()); } bool DrawPadCanvas::goPreviousPageEnabled() { return (m_pages.current() != m_pages.getFirst()); } bool DrawPadCanvas::goNextPageEnabled() { return (m_pages.current() != m_pages.getLast()); } void DrawPadCanvas::undo() { *(m_pages.current()) = *(m_pageBackups.prev()); |