mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: more fine-grained undo of profile editing
Place undo commands for every change of the profile, not only on "saving". Move the edit-mode from the mainwindow and the maintab to the profile widget. This is still very rough. For example, the only way to exit the edit mode is changing the current dive. The undo-commands are placed by the desktop-profile widget. We might think about moving that down to the profile-view so that this will be useable on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c5c8bfec65
commit
fce48367cd
12 changed files with 162 additions and 100 deletions
|
@ -145,8 +145,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
|
||||
registerApplicationState(ApplicationState::Default, { true, { mainTab.get(), FLAG_NONE }, { profile.get(), FLAG_NONE },
|
||||
{ diveList.get(), FLAG_NONE }, { mapWidget.get(), FLAG_NONE } });
|
||||
registerApplicationState(ApplicationState::EditDive, { false, { mainTab.get(), FLAG_NONE }, { profile.get(), FLAG_NONE },
|
||||
{ diveList.get(), FLAG_NONE }, { mapWidget.get(), FLAG_NONE } });
|
||||
registerApplicationState(ApplicationState::PlanDive, { false, { &plannerWidgets->plannerWidget, FLAG_NONE }, { profile.get(), FLAG_NONE },
|
||||
{ &plannerWidgets->plannerSettingsWidget, FLAG_NONE }, { &plannerWidgets->plannerDetails, FLAG_NONE } });
|
||||
registerApplicationState(ApplicationState::EditPlannedDive, { true, { &plannerWidgets->plannerWidget, FLAG_NONE }, { profile.get(), FLAG_NONE },
|
||||
|
@ -246,8 +244,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
set_git_update_cb(&updateProgress);
|
||||
set_error_cb(&showErrorFromC);
|
||||
|
||||
connect(profile->view.get(), &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
|
||||
|
||||
// full screen support is buggy on Windows and Ubuntu.
|
||||
// require the FULLSCREEN_SUPPORT macro to enable it!
|
||||
#ifndef FULLSCREEN_SUPPORT
|
||||
|
@ -1408,25 +1404,6 @@ void MainWindow::on_actionImportDiveSites_triggered()
|
|||
divesiteImport.exec();
|
||||
}
|
||||
|
||||
void MainWindow::editCurrentDive()
|
||||
{
|
||||
// We only allow editing of the profile for manually added dives.
|
||||
if (!current_dive || (!same_string(current_dive->dc.model, "manually added dive") && current_dive->dc.samples) || !userMayChangeAppState())
|
||||
return;
|
||||
|
||||
// This shouldn't be possible, but let's make sure no weird "double editing" takes place.
|
||||
if (mainTab->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING)
|
||||
return;
|
||||
|
||||
disableShortcuts(false);
|
||||
copy_dive(current_dive, &displayed_dive); // Work on a copy of the dive
|
||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
|
||||
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
||||
profile->setEditState(&displayed_dive, 0);
|
||||
setApplicationState(ApplicationState::EditDive);
|
||||
mainTab->enableEdition();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExport_triggered()
|
||||
{
|
||||
DiveLogExportDialog diveLogExport;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue