mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: disable undo- and redo-actions in edit mode
We have to avoid that undo/redo removes the currently edited dive from under our feet. This code can be removed once proper undo/redo (including editing) is implemented. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
63b65a7e20
commit
26901a8dbd
2 changed files with 9 additions and 6 deletions
|
@ -260,14 +260,11 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
memset(&what, 0, sizeof(what));
|
memset(&what, 0, sizeof(what));
|
||||||
|
|
||||||
updateManager = new UpdateManager(this);
|
updateManager = new UpdateManager(this);
|
||||||
QAction *undoAction = Command::undoAction(this);
|
undoAction = Command::undoAction(this);
|
||||||
QAction *redoAction = Command::redoAction(this);
|
redoAction = Command::redoAction(this);
|
||||||
undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||||
redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
|
redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
|
||||||
QList<QAction*>undoRedoActions;
|
ui.menu_Edit->addActions({ undoAction, redoAction });
|
||||||
undoRedoActions.append(undoAction);
|
|
||||||
undoRedoActions.append(redoAction);
|
|
||||||
ui.menu_Edit->addActions(undoRedoActions);
|
|
||||||
|
|
||||||
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
|
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
|
||||||
connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition()));
|
connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition()));
|
||||||
|
@ -1184,6 +1181,8 @@ void MainWindow::on_actionViewAll_triggered()
|
||||||
|
|
||||||
void MainWindow::enterEditState()
|
void MainWindow::enterEditState()
|
||||||
{
|
{
|
||||||
|
undoAction->setEnabled(false);
|
||||||
|
redoAction->setEnabled(false);
|
||||||
stateBeforeEdit = state;
|
stateBeforeEdit = state;
|
||||||
if (state == VIEWALL || state == INFO_MAXIMIZED)
|
if (state == VIEWALL || state == INFO_MAXIMIZED)
|
||||||
return;
|
return;
|
||||||
|
@ -1207,6 +1206,8 @@ void MainWindow::enterEditState()
|
||||||
|
|
||||||
void MainWindow::exitEditState()
|
void MainWindow::exitEditState()
|
||||||
{
|
{
|
||||||
|
undoAction->setEnabled(true);
|
||||||
|
redoAction->setEnabled(true);
|
||||||
if (stateBeforeEdit == state)
|
if (stateBeforeEdit == state)
|
||||||
return;
|
return;
|
||||||
enterState(stateBeforeEdit);
|
enterState(stateBeforeEdit);
|
||||||
|
|
|
@ -185,6 +185,8 @@ private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
QAction *actionNextDive;
|
QAction *actionNextDive;
|
||||||
QAction *actionPreviousDive;
|
QAction *actionPreviousDive;
|
||||||
|
QAction *undoAction;
|
||||||
|
QAction *redoAction;
|
||||||
#ifndef NO_USERMANUAL
|
#ifndef NO_USERMANUAL
|
||||||
UserManual *helpView;
|
UserManual *helpView;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue