author | leseb <leseb> | 2002-06-08 16:46:59 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-08 16:46:59 (UTC) |
commit | 0fef046e0668d727df1884422144b26851d7de41 (patch) (unidiff) | |
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 | |||
@@ -14,5 +14,7 @@ | |||
14 | #include "thumbnailview.h" | 14 | #include "thumbnailview.h" |
15 | 15 | ||
16 | #include "drawpad.h" | ||
16 | #include "drawpadcanvas.h" | 17 | #include "drawpadcanvas.h" |
18 | #include "newpagedialog.h" | ||
17 | #include "page.h" | 19 | #include "page.h" |
18 | 20 | ||
@@ -144,8 +146,10 @@ Page* PageListView::selected() const | |||
144 | } | 146 | } |
145 | 147 | ||
146 | ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) | 148 | ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) |
147 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) | 149 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) |
148 | { | 150 | { |
149 | inLoop = false; | 151 | inLoop = false; |
152 | |||
153 | m_pDrawPad = drawPad; | ||
150 | m_pDrawPadCanvas = drawPadCanvas; | 154 | m_pDrawPadCanvas = drawPadCanvas; |
151 | 155 | ||
@@ -155,8 +159,10 @@ ThumbnailView::ThumbnailView(DrawPadCanvas* drawPadCanvas, QWidget* parent, cons | |||
155 | newPageButton->setIconSet(Resource::loadIconSet("new")); | 159 | newPageButton->setIconSet(Resource::loadIconSet("new")); |
156 | newPageButton->setAutoRaise(true); | 160 | newPageButton->setAutoRaise(true); |
161 | connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); | ||
157 | 162 | ||
158 | QToolButton* clearPageButton = new QToolButton(this); | 163 | QToolButton* clearPageButton = new QToolButton(this); |
159 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); | 164 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); |
160 | clearPageButton->setAutoRaise(true); | 165 | clearPageButton->setAutoRaise(true); |
166 | connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); | ||
161 | 167 | ||
162 | QToolButton* deletePageButton = new QToolButton(this); | 168 | QToolButton* deletePageButton = new QToolButton(this); |
@@ -215,4 +221,34 @@ void ThumbnailView::exec() | |||
215 | } | 221 | } |
216 | 222 | ||
223 | void ThumbnailView::newPage() | ||
224 | { | ||
225 | QRect rect = m_pDrawPadCanvas->contentsRect(); | ||
226 | |||
227 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), | ||
228 | m_pDrawPad->brush().color(), this); | ||
229 | |||
230 | if (newPageDialog.exec() == QDialog::Accepted) { | ||
231 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), | ||
232 | newPageDialog.selectedColor()); | ||
233 | m_pPageListView->updateView(); | ||
234 | } | ||
235 | } | ||
236 | |||
237 | void ThumbnailView::clearPage() | ||
238 | { | ||
239 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected page?"), | ||
240 | QMessageBox::Information, QMessageBox::Yes, | ||
241 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | ||
242 | QMessageBox::NoButton, this); | ||
243 | |||
244 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | ||
245 | messageBox.setButtonText(QMessageBox::No, tr("No")); | ||
246 | |||
247 | if (messageBox.exec() == QMessageBox::Yes) { | ||
248 | m_pDrawPadCanvas->clearPage(); | ||
249 | m_pPageListView->updateView(); | ||
250 | } | ||
251 | } | ||
252 | |||
217 | void ThumbnailView::deletePage() | 253 | void ThumbnailView::deletePage() |
218 | { | 254 | { |