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 <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Grace Karanja 2015-02-11 09:10:34 +03:00 committed by Dirk Hohndel
parent 6374d9cc03
commit 013da6b0af
7 changed files with 3 additions and 152 deletions

View file

@ -36,7 +36,6 @@
#include "usermanual.h"
#endif
#include <QNetworkProxy>
#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);