summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp18
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.h2
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp43
-rw-r--r--noncore/graphics/drawpad/thumbnailview.h11
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
@@ -421,2 +421,20 @@ void DrawPadCanvas::deletePage()
+void DrawPadCanvas::movePageUp()
+{
+ int index = m_pages.at();
+ Page* page = m_pages.take();
+ m_pages.insert(index - 1, page);
+
+ emit pagesChanged();
+}
+
+void DrawPadCanvas::movePageDown()
+{
+ int index = m_pages.at();
+ Page* page = m_pages.take();
+ m_pages.insert(index + 1, page);
+
+ emit pagesChanged();
+}
+
bool DrawPadCanvas::undoEnabled()
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
@@ -57,2 +57,4 @@ public slots:
void deletePage();
+ void movePageUp();
+ void movePageDown();
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
@@ -172,9 +172,11 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi
- QToolButton* movePageUpButton = new QToolButton(this);
- movePageUpButton->setIconSet(Resource::loadIconSet("up"));
- movePageUpButton->setAutoRaise(true);
+ m_pMovePageUpButton = new QToolButton(this);
+ m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up"));
+ m_pMovePageUpButton->setAutoRaise(true);
+ connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp()));
- QToolButton* movePageDownButton = new QToolButton(this);
- movePageDownButton->setIconSet(Resource::loadIconSet("down"));
- movePageDownButton->setAutoRaise(true);
+ m_pMovePageDownButton = new QToolButton(this);
+ m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down"));
+ m_pMovePageDownButton->setAutoRaise(true);
+ connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown()));
@@ -190,4 +192,4 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi
buttonLayout->addStretch();
- buttonLayout->addWidget(movePageUpButton);
- buttonLayout->addWidget(movePageDownButton);
+ buttonLayout->addWidget(m_pMovePageUpButton);
+ buttonLayout->addWidget(m_pMovePageDownButton);
@@ -195,2 +197,4 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi
mainLayout->addWidget(m_pPageListView);
+
+ updateView();
}
@@ -202,2 +206,8 @@ ThumbnailView::~ThumbnailView()
+void ThumbnailView::updateView()
+{
+ m_pMovePageUpButton->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
+ m_pMovePageDownButton->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
+}
+
void ThumbnailView::hide()
@@ -233,2 +243,3 @@ void ThumbnailView::newPage()
m_pPageListView->updateView();
+ updateView();
}
@@ -265,2 +276,3 @@ void ThumbnailView::deletePage()
m_pPageListView->updateView();
+ updateView();
}
@@ -268,2 +280,16 @@ void ThumbnailView::deletePage()
+void ThumbnailView::movePageUp()
+{
+ m_pDrawPadCanvas->movePageUp();
+ m_pPageListView->updateView();
+ updateView();
+}
+
+void ThumbnailView::movePageDown()
+{
+ m_pDrawPadCanvas->movePageDown();
+ m_pPageListView->updateView();
+ updateView();
+}
+
void ThumbnailView::changePage()
@@ -271,2 +297,3 @@ void ThumbnailView::changePage()
m_pDrawPadCanvas->selectPage(m_pPageListView->selected());
+ updateView();
}
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
@@ -23,2 +23,4 @@ class Page;
+class QToolButton;
+
class PageListViewItem : public QListViewItem
@@ -60,3 +62,5 @@ public:
~ThumbnailView();
-
+
+ void updateView();
+
void hide();
@@ -68,2 +72,4 @@ public slots:
void deletePage();
+ void movePageUp();
+ void movePageDown();
void changePage();
@@ -76,2 +82,5 @@ private:
+ QToolButton* m_pMovePageUpButton;
+ QToolButton* m_pMovePageDownButton;
+
PageListView* m_pPageListView;