From 1a4bffb7363138e1fb3b3aabd7027e4f5f3dc36f Mon Sep 17 00:00:00 2001 From: Drew Fisher Date: Fri, 8 Oct 2010 03:33:56 -0700 Subject: [PATCH] Connect board-wipe button to functionality. --- action.cpp | 6 +++--- mainwindow.cpp | 8 +++++++- mainwindow.h | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/action.cpp b/action.cpp index a3dce91..9eb7e48 100644 --- a/action.cpp +++ b/action.cpp @@ -47,17 +47,17 @@ DrawLineAction::DrawLineAction() : Action(Action::DrawLine) { DrawLineAction::~DrawLineAction() { } -AddImageAction::AddImageAction() { +AddImageAction::AddImageAction() : Action(Action::AddImage) { } AddImageAction::~AddImageAction() { } -UserChatAction::UserChatAction() { +UserChatAction::UserChatAction() : Action(Action::UserChat) { } UserChatAction::~UserChatAction() { } -ClearBoardAction::ClearBoardAction() { +ClearBoardAction::ClearBoardAction() : Action(Action::ClearBoard) { } ClearBoardAction::~ClearBoardAction() { } diff --git a/mainwindow.cpp b/mainwindow.cpp index cdc3b7d..fb8669e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -37,6 +37,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { QObject::connect(board, SIGNAL(actionHappened(Action*)), this, SLOT(marshallAction(Action*))); QObject::connect(colorAction, SIGNAL(triggered()), this, SLOT(chooseColor())); + QObject::connect(clearAction, SIGNAL(triggered()), this, SLOT(clearBoard())); statusBar()->showMessage("Ready"); } @@ -53,6 +54,11 @@ void MainWindow::chooseColor() { colorAction->setIcon(QIcon(pixmap)); } +void MainWindow::clearBoard() { + ClearBoardAction* action = new ClearBoardAction(); + marshallAction(action); +} + void MainWindow::load() { QString fileName = QFileDialog::getOpenFileName(this, "Load saved board:", ".", "Shareboards (*.board)"); if(fileName.isEmpty()) { @@ -145,7 +151,7 @@ void MainWindow::createToolBars() { // Create some other one-click actions that are not a part of the action group. QAction* imageAction = new QAction(QIcon("icons/import_image.png"), "Import Image", this); - QAction* clearAction = new QAction(QIcon("icons/clear.png"), "Clear", this); + clearAction = new QAction(QIcon("icons/clear.png"), "Clear", this); // Style spinboxWidget = new QSpinBox(this); diff --git a/mainwindow.h b/mainwindow.h index 6914f30..9437980 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -26,6 +26,7 @@ public slots: void switchToConnect(); void showError(QString error); void chooseColor(); + void clearBoard(); void marshallAction(Action* action); private: void createActions(); @@ -38,6 +39,7 @@ private: QAction* saveAction; QAction* quitAction; QAction* colorAction; + QAction* clearAction; QSpinBox* spinboxWidget; ConnectionManager* connMan; // HistoryManager* historyManager; -- 2.39.2