author | leseb <leseb> | 2002-06-08 16:46:59 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-08 16:46:59 (UTC) |
commit | 0fef046e0668d727df1884422144b26851d7de41 (patch) (side-by-side diff) | |
tree | e25a8838720d1ce0a3e419ddf079f84f1e148588 /noncore/graphics/drawpad/thumbnailview.cpp | |
parent | 571908b989a85d256767dc5b27bccdb717554bb5 (diff) | |
download | opie-0fef046e0668d727df1884422144b26851d7de41.zip opie-0fef046e0668d727df1884422144b26851d7de41.tar.gz opie-0fef046e0668d727df1884422144b26851d7de41.tar.bz2 |
Working version of new page and clear page in thumbnail view
Diffstat (limited to 'noncore/graphics/drawpad/thumbnailview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 476b7b9..08e106d 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp @@ -15,3 +15,5 @@ +#include "drawpad.h" #include "drawpadcanvas.h" +#include "newpagedialog.h" #include "page.h" @@ -145,3 +147,3 @@ Page* PageListView::selected() const -ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) +ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) @@ -149,2 +151,4 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons inLoop = false; + + m_pDrawPad = drawPad; m_pDrawPadCanvas = drawPadCanvas; @@ -156,2 +160,3 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons newPageButton->setAutoRaise(true); + connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); @@ -160,2 +165,3 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons clearPageButton->setAutoRaise(true); + connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); @@ -216,2 +222,32 @@ void ThumbnailView::exec() +void ThumbnailView::newPage() +{ + QRect rect = m_pDrawPadCanvas->contentsRect(); + + NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), + m_pDrawPad->brush().color(), this); + + if (newPageDialog.exec() == QDialog::Accepted) { + m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), + newPageDialog.selectedColor()); + m_pPageListView->updateView(); + } +} + +void ThumbnailView::clearPage() +{ + QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected 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_pDrawPadCanvas->clearPage(); + m_pPageListView->updateView(); + } +} + void ThumbnailView::deletePage() |