From 013da6b0af3e3dd5d074f2dbbc342d9b948717b4 Mon Sep 17 00:00:00 2001 From: Grace Karanja Date: Wed, 11 Feb 2015 09:10:34 +0300 Subject: Reverse undo buffer Reverse all the code using the UndoBuffer class so that we can use the QUndoStack and QUndoCommand classes. These are Qt's own inbuild undo framework classes, offering a better undo/redo process. Signed-off-by: Grace Karanja Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 163ff7d61..9908e2402 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -36,7 +36,6 @@ #include "usermanual.h" #endif #include -#include "undobuffer.h" MainWindow *MainWindow::m_Instance = NULL; @@ -108,7 +107,6 @@ MainWindow::MainWindow() : QMainWindow(), connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated())); connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled())); connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan())); - connect(ui.menu_Edit, SIGNAL(aboutToShow()), this, SLOT(checkForUndoAndRedo())); #ifdef NO_PRINTING ui.printPlan->hide(); ui.menuFile->removeAction(ui.actionPrint); @@ -182,7 +180,6 @@ MainWindow::MainWindow() : QMainWindow(), toolBar->setContentsMargins(zeroMargins); updateManager = new UpdateManager(this); - undoBuffer = new UndoBuffer(this); } MainWindow::~MainWindow() @@ -1502,22 +1499,6 @@ void MainWindow::on_actionFilterTags_triggered() ui.multiFilter->setVisible(true); } -void MainWindow::on_action_Undo_triggered() -{ - undoBuffer->undo(); -} - -void MainWindow::on_action_Redo_triggered() -{ - undoBuffer->redo(); -} - -void MainWindow::checkForUndoAndRedo() -{ - ui.action_Undo->setEnabled(undoBuffer->canUndo()); - ui.action_Redo->setEnabled(undoBuffer->canRedo()); -} - void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight) { applicationState[state] = WidgetForQuadrant(topLeft, topRight, bottomLeft, bottomRight); -- cgit v1.2.3-70-g09d2