-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 18 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.h | 2 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 43 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.h | 9 |
4 files changed, 64 insertions, 8 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index c23ee34..bcb6877 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp | |||
@@ -419,6 +419,24 @@ void DrawPadCanvas::deletePage() | |||
419 | emit pageBackupsChanged(); | 419 | emit pageBackupsChanged(); |
420 | } | 420 | } |
421 | 421 | ||
422 | void DrawPadCanvas::movePageUp() | ||
423 | { | ||
424 | int index = m_pages.at(); | ||
425 | Page* page = m_pages.take(); | ||
426 | m_pages.insert(index - 1, page); | ||
427 | |||
428 | emit pagesChanged(); | ||
429 | } | ||
430 | |||
431 | void DrawPadCanvas::movePageDown() | ||
432 | { | ||
433 | int index = m_pages.at(); | ||
434 | Page* page = m_pages.take(); | ||
435 | m_pages.insert(index + 1, page); | ||
436 | |||
437 | emit pagesChanged(); | ||
438 | } | ||
439 | |||
422 | bool DrawPadCanvas::undoEnabled() | 440 | bool DrawPadCanvas::undoEnabled() |
423 | { | 441 | { |
424 | return (m_pageBackups.current() != m_pageBackups.getFirst()); | 442 | return (m_pageBackups.current() != m_pageBackups.getFirst()); |
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h index d74d425..39cf752 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.h +++ b/noncore/graphics/drawpad/drawpadcanvas.h | |||
@@ -55,6 +55,8 @@ public slots: | |||
55 | void newPage(uint width, uint height, const QColor& color); | 55 | void newPage(uint width, uint height, const QColor& color); |
56 | void clearPage(); | 56 | void clearPage(); |
57 | void deletePage(); | 57 | void deletePage(); |
58 | void movePageUp(); | ||
59 | void movePageDown(); | ||
58 | 60 | ||
59 | void undo(); | 61 | void undo(); |
60 | void redo(); | 62 | void redo(); |
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 0c7934e..428e008 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp | |||
@@ -170,13 +170,15 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi | |||
170 | deletePageButton->setAutoRaise(true); | 170 | deletePageButton->setAutoRaise(true); |
171 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); | 171 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); |
172 | 172 | ||
173 | QToolButton* movePageUpButton = new QToolButton(this); | 173 | m_pMovePageUpButton = new QToolButton(this); |
174 | movePageUpButton->setIconSet(Resource::loadIconSet("up")); | 174 | m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); |
175 | movePageUpButton->setAutoRaise(true); | 175 | m_pMovePageUpButton->setAutoRaise(true); |
176 | connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); | ||
176 | 177 | ||
177 | QToolButton* movePageDownButton = new QToolButton(this); | 178 | m_pMovePageDownButton = new QToolButton(this); |
178 | movePageDownButton->setIconSet(Resource::loadIconSet("down")); | 179 | m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); |
179 | movePageDownButton->setAutoRaise(true); | 180 | m_pMovePageDownButton->setAutoRaise(true); |
181 | connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); | ||
180 | 182 | ||
181 | m_pPageListView = new PageListView(m_pDrawPadCanvas, this); | 183 | m_pPageListView = new PageListView(m_pDrawPadCanvas, this); |
182 | connect(m_pPageListView, SIGNAL(selectionChanged()), this, SLOT(changePage())); | 184 | connect(m_pPageListView, SIGNAL(selectionChanged()), this, SLOT(changePage())); |
@@ -188,11 +190,13 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi | |||
188 | buttonLayout->addWidget(clearPageButton); | 190 | buttonLayout->addWidget(clearPageButton); |
189 | buttonLayout->addWidget(deletePageButton); | 191 | buttonLayout->addWidget(deletePageButton); |
190 | buttonLayout->addStretch(); | 192 | buttonLayout->addStretch(); |
191 | buttonLayout->addWidget(movePageUpButton); | 193 | buttonLayout->addWidget(m_pMovePageUpButton); |
192 | buttonLayout->addWidget(movePageDownButton); | 194 | buttonLayout->addWidget(m_pMovePageDownButton); |
193 | 195 | ||
194 | mainLayout->addLayout(buttonLayout); | 196 | mainLayout->addLayout(buttonLayout); |
195 | mainLayout->addWidget(m_pPageListView); | 197 | mainLayout->addWidget(m_pPageListView); |
198 | |||
199 | updateView(); | ||
196 | } | 200 | } |
197 | 201 | ||
198 | ThumbnailView::~ThumbnailView() | 202 | ThumbnailView::~ThumbnailView() |
@@ -200,6 +204,12 @@ ThumbnailView::~ThumbnailView() | |||
200 | hide(); | 204 | hide(); |
201 | } | 205 | } |
202 | 206 | ||
207 | void ThumbnailView::updateView() | ||
208 | { | ||
209 | m_pMovePageUpButton->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | ||
210 | m_pMovePageDownButton->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | ||
211 | } | ||
212 | |||
203 | void ThumbnailView::hide() | 213 | void ThumbnailView::hide() |
204 | { | 214 | { |
205 | QWidget::hide(); | 215 | QWidget::hide(); |
@@ -231,6 +241,7 @@ void ThumbnailView::newPage() | |||
231 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), | 241 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), |
232 | newPageDialog.selectedColor()); | 242 | newPageDialog.selectedColor()); |
233 | m_pPageListView->updateView(); | 243 | m_pPageListView->updateView(); |
244 | updateView(); | ||
234 | } | 245 | } |
235 | } | 246 | } |
236 | 247 | ||
@@ -263,10 +274,26 @@ void ThumbnailView::deletePage() | |||
263 | if (messageBox.exec() == QMessageBox::Yes) { | 274 | if (messageBox.exec() == QMessageBox::Yes) { |
264 | m_pDrawPadCanvas->deletePage(); | 275 | m_pDrawPadCanvas->deletePage(); |
265 | m_pPageListView->updateView(); | 276 | m_pPageListView->updateView(); |
277 | updateView(); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | void ThumbnailView::movePageUp() | ||
282 | { | ||
283 | m_pDrawPadCanvas->movePageUp(); | ||
284 | m_pPageListView->updateView(); | ||
285 | updateView(); | ||
266 | } | 286 | } |
287 | |||
288 | void ThumbnailView::movePageDown() | ||
289 | { | ||
290 | m_pDrawPadCanvas->movePageDown(); | ||
291 | m_pPageListView->updateView(); | ||
292 | updateView(); | ||
267 | } | 293 | } |
268 | 294 | ||
269 | void ThumbnailView::changePage() | 295 | void ThumbnailView::changePage() |
270 | { | 296 | { |
271 | m_pDrawPadCanvas->selectPage(m_pPageListView->selected()); | 297 | m_pDrawPadCanvas->selectPage(m_pPageListView->selected()); |
298 | updateView(); | ||
272 | } | 299 | } |
diff --git a/noncore/graphics/drawpad/thumbnailview.h b/noncore/graphics/drawpad/thumbnailview.h index 1fdb168..eb748fa 100644 --- a/noncore/graphics/drawpad/thumbnailview.h +++ b/noncore/graphics/drawpad/thumbnailview.h | |||
@@ -21,6 +21,8 @@ class DrawPad; | |||
21 | class DrawPadCanvas; | 21 | class DrawPadCanvas; |
22 | class Page; | 22 | class Page; |
23 | 23 | ||
24 | class QToolButton; | ||
25 | |||
24 | class PageListViewItem : public QListViewItem | 26 | class PageListViewItem : public QListViewItem |
25 | { | 27 | { |
26 | public: | 28 | public: |
@@ -59,6 +61,8 @@ public: | |||
59 | ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); | 61 | ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); |
60 | ~ThumbnailView(); | 62 | ~ThumbnailView(); |
61 | 63 | ||
64 | void updateView(); | ||
65 | |||
62 | void hide(); | 66 | void hide(); |
63 | void exec(); | 67 | void exec(); |
64 | 68 | ||
@@ -66,6 +70,8 @@ public slots: | |||
66 | void newPage(); | 70 | void newPage(); |
67 | void clearPage(); | 71 | void clearPage(); |
68 | void deletePage(); | 72 | void deletePage(); |
73 | void movePageUp(); | ||
74 | void movePageDown(); | ||
69 | void changePage(); | 75 | void changePage(); |
70 | 76 | ||
71 | private: | 77 | private: |
@@ -74,6 +80,9 @@ private: | |||
74 | DrawPad* m_pDrawPad; | 80 | DrawPad* m_pDrawPad; |
75 | DrawPadCanvas* m_pDrawPadCanvas; | 81 | DrawPadCanvas* m_pDrawPadCanvas; |
76 | 82 | ||
83 | QToolButton* m_pMovePageUpButton; | ||
84 | QToolButton* m_pMovePageDownButton; | ||
85 | |||
77 | PageListView* m_pPageListView; | 86 | PageListView* m_pPageListView; |
78 | }; | 87 | }; |
79 | 88 | ||