mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add menu entries for undo/redo
Add an edit menu with undo and redo submenus, and connect them to the UndoBuffer class. The submenus are only enabled when needed. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
853dfa6673
commit
c5138b2090
3 changed files with 49 additions and 1 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "usermanual.h"
|
||||
#endif
|
||||
#include <QNetworkProxy>
|
||||
#include "undobuffer.h"
|
||||
|
||||
MainWindow *MainWindow::m_Instance = NULL;
|
||||
|
||||
|
@ -77,6 +78,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
|
||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
||||
connect(ui.printPlan, SIGNAL(pressed()), ui.divePlannerWidget, SLOT(printDecoPlan()));
|
||||
connect(ui.menu_Edit, SIGNAL(aboutToShow()), this, SLOT(checkForUndoAndRedo()));
|
||||
#ifdef NO_PRINTING
|
||||
ui.printPlan->hide();
|
||||
#endif
|
||||
|
@ -152,6 +154,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
toolBar->setContentsMargins(zeroMargins);
|
||||
|
||||
updateManager = new UpdateManager(this);
|
||||
undoBuffer = new UndoBuffer(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -1466,3 +1469,19 @@ void MainWindow::on_actionFilterTags_triggered()
|
|||
else
|
||||
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());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue