Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 81 |
1 files changed, 30 insertions, 51 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 3c593b6..5cc2197 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp @@ -43,2 +43,4 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) m_pDrawPadCanvas = new DrawPadCanvas(this, this); + connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateNavigationToolButtons())); + connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); @@ -73,3 +75,3 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) QAction* clearAllAction = new QAction(tr("Clear All"), QString::null, 0, this); - connect(clearAllAction, SIGNAL(activated()), this, SLOT(clearAll())); + connect(clearAllAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(clearAll())); clearAllAction->addTo(toolsPopupMenu); @@ -88,3 +90,3 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); - connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); + connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); newPageAction->addTo(pageToolBar); @@ -96,3 +98,3 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); - connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); + connect(deletePageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deletePage())); deletePageAction->addTo(pageToolBar); @@ -106,4 +108,14 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) + m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("drawpad/undo"), QString::null, 0, this); + connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); + m_pUndoAction->addTo(navigationToolBar); + + m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("drawpad/redo"), QString::null, 0, this); + connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); + m_pRedoAction->addTo(navigationToolBar); + + updateUndoRedoToolButtons(); + m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); - connect(m_pFirstPageAction, SIGNAL(activated()), this, SLOT(goFirstPage())); + connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); m_pFirstPageAction->addTo(navigationToolBar); @@ -111,3 +123,3 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); - connect(m_pPreviousPageAction, SIGNAL(activated()), this, SLOT(goPreviousPage())); + connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); m_pPreviousPageAction->addTo(navigationToolBar); @@ -115,3 +127,3 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); - connect(m_pNextPageAction, SIGNAL(activated()), this, SLOT(goNextPage())); + connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); m_pNextPageAction->addTo(navigationToolBar); @@ -119,6 +131,6 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); - connect(m_pLastPageAction, SIGNAL(activated()), this, SLOT(goLastPage())); + connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); m_pLastPageAction->addTo(navigationToolBar); - updateNavigationToolBar(); + updateNavigationToolButtons(); @@ -163,2 +175,5 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags f) emptyToolBar->setHorizontalStretchable(true); + emptyToolBar->addSeparator(); + + // init draw parameters toolbar @@ -220,44 +235,2 @@ DrawPad::~DrawPad() -void DrawPad::clearAll() -{ - m_pDrawPadCanvas->clearAll(); - updateNavigationToolBar(); -} - -void DrawPad::newPage() -{ - m_pDrawPadCanvas->newPage(); - updateNavigationToolBar(); -} - -void DrawPad::deletePage() -{ - m_pDrawPadCanvas->deletePage(); - updateNavigationToolBar(); -} - -void DrawPad::goFirstPage() -{ - m_pDrawPadCanvas->goFirstPage(); - updateNavigationToolBar(); -} - -void DrawPad::goPreviousPage() -{ - m_pDrawPadCanvas->goPreviousPage(); - updateNavigationToolBar(); -} - -void DrawPad::goNextPage() -{ - m_pDrawPadCanvas->goNextPage(); - updateNavigationToolBar(); -} - -void DrawPad::goLastPage() -{ - m_pDrawPadCanvas->goLastPage(); - updateNavigationToolBar(); -} - void DrawPad::setPointDrawMode() @@ -383,3 +356,9 @@ void DrawPad::changeBrushColor(int index) -void DrawPad::updateNavigationToolBar() +void DrawPad::updateUndoRedoToolButtons() +{ + m_pUndoAction->setEnabled(m_pDrawPadCanvas->undoEnabled()); + m_pRedoAction->setEnabled(m_pDrawPadCanvas->redoEnabled()); +} + +void DrawPad::updateNavigationToolButtons() { |