author | leseb <leseb> | 2002-06-09 16:06:21 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-09 16:06:21 (UTC) |
commit | b59a64c90deba66180e3a778d411296e984f64ea (patch) (unidiff) | |
tree | 88ef0767602dd174f5911719ffb346a4fcf7420f | |
parent | 29c0d188836a59bff1fbcd1d338fcd3334c0f1f5 (diff) | |
download | opie-b59a64c90deba66180e3a778d411296e984f64ea.zip opie-b59a64c90deba66180e3a778d411296e984f64ea.tar.gz opie-b59a64c90deba66180e3a778d411296e984f64ea.tar.bz2 |
Changing page order now works in thumbnail view
-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 | 11 |
4 files changed, 65 insertions, 9 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 | |||
@@ -420,4 +420,22 @@ void DrawPadCanvas::deletePage() | |||
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 | { |
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 | |||
@@ -56,4 +56,6 @@ public slots: | |||
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(); |
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 | |||
@@ -171,11 +171,13 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi | |||
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); |
@@ -189,9 +191,11 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi | |||
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 | ||
@@ -201,4 +205,10 @@ ThumbnailView::~ThumbnailView() | |||
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 | { |
@@ -232,4 +242,5 @@ void ThumbnailView::newPage() | |||
232 | newPageDialog.selectedColor()); | 242 | newPageDialog.selectedColor()); |
233 | m_pPageListView->updateView(); | 243 | m_pPageListView->updateView(); |
244 | updateView(); | ||
234 | } | 245 | } |
235 | } | 246 | } |
@@ -264,9 +275,25 @@ void ThumbnailView::deletePage() | |||
264 | m_pDrawPadCanvas->deletePage(); | 275 | m_pDrawPadCanvas->deletePage(); |
265 | m_pPageListView->updateView(); | 276 | m_pPageListView->updateView(); |
277 | updateView(); | ||
266 | } | 278 | } |
267 | } | 279 | } |
268 | 280 | ||
281 | void ThumbnailView::movePageUp() | ||
282 | { | ||
283 | m_pDrawPadCanvas->movePageUp(); | ||
284 | m_pPageListView->updateView(); | ||
285 | updateView(); | ||
286 | } | ||
287 | |||
288 | void ThumbnailView::movePageDown() | ||
289 | { | ||
290 | m_pDrawPadCanvas->movePageDown(); | ||
291 | m_pPageListView->updateView(); | ||
292 | updateView(); | ||
293 | } | ||
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 | |||
@@ -22,4 +22,6 @@ 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 | { |
@@ -59,5 +61,7 @@ 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(); |
@@ -67,4 +71,6 @@ public slots: | |||
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 | ||
@@ -75,4 +81,7 @@ private: | |||
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 | }; |