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) (ignore 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 | |||
@@ -12,9 +12,11 @@ | |||
12 | ***************************************************************************/ | 12 | ***************************************************************************/ |
13 | 13 | ||
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 | ||
19 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
20 | 22 | ||
@@ -142,23 +144,27 @@ Page* PageListView::selected() const | |||
142 | 144 | ||
143 | return page; | 145 | return page; |
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 | ||
152 | setCaption(tr("Thumbnail")); | 156 | setCaption(tr("Thumbnail")); |
153 | 157 | ||
154 | QToolButton* newPageButton = new QToolButton(this); | 158 | QToolButton* newPageButton = new QToolButton(this); |
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); |
163 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); | 169 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); |
164 | deletePageButton->setAutoRaise(true); | 170 | deletePageButton->setAutoRaise(true); |
@@ -213,8 +219,38 @@ void ThumbnailView::exec() | |||
213 | qApp->enter_loop(); | 219 | qApp->enter_loop(); |
214 | } | 220 | } |
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 | { |
219 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe selected page?"), | 255 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe selected page?"), |
220 | QMessageBox::Information, QMessageBox::Yes, | 256 | QMessageBox::Information, QMessageBox::Yes, |