desktop: remove EDIT mode

The only way to enter edit mode is to edit the profile. However,
that means that the profile is already visible, so there is no
need to change the mode. Simply remove the EDIT mode.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-03-02 10:57:18 +01:00
parent 3965ae2c89
commit accf1fcc8f
3 changed files with 0 additions and 38 deletions

View file

@ -1092,36 +1092,6 @@ void MainWindow::on_actionViewAll_triggered()
ui.bottomSplitter->setCollapsible(1,false); ui.bottomSplitter->setCollapsible(1,false);
} }
void MainWindow::enterEditState()
{
stateBeforeEdit = state;
if (state == VIEWALL || state == INFO_MAXIMIZED)
return;
toggleCollapsible(true);
beginChangeState(EDIT);
ui.topSplitter->setSizes({ EXPANDED, EXPANDED });
ui.mainSplitter->setSizes({ EXPANDED, COLLAPSED });
int appW = qApp->desktop()->size().width();
QList<int> infoProfileSizes { round_int(appW * 0.3), round_int(appW * 0.7) };
QSettings settings;
settings.beginGroup("MainWindow");
if (settings.value("mainSplitter").isValid()) {
ui.topSplitter->restoreState(settings.value("topSplitter").toByteArray());
if (ui.topSplitter->sizes().first() == 0 || ui.topSplitter->sizes().last() == 0)
ui.topSplitter->setSizes(infoProfileSizes);
} else {
ui.topSplitter->setSizes(infoProfileSizes);
}
}
void MainWindow::exitEditState()
{
if (stateBeforeEdit == state)
return;
enterState(stateBeforeEdit);
}
void MainWindow::enterState(CurrentState newState) void MainWindow::enterState(CurrentState newState)
{ {
state = newState; state = newState;
@ -1141,8 +1111,6 @@ void MainWindow::enterState(CurrentState newState)
case PROFILE_MAXIMIZED: case PROFILE_MAXIMIZED:
on_actionViewProfile_triggered(); on_actionViewProfile_triggered();
break; break;
case EDIT:
break;
} }
} }

View file

@ -58,7 +58,6 @@ public:
INFO_MAXIMIZED, INFO_MAXIMIZED,
PROFILE_MAXIMIZED, PROFILE_MAXIMIZED,
LIST_MAXIMIZED, LIST_MAXIMIZED,
EDIT,
}; };
MainWindow(); MainWindow();
@ -81,8 +80,6 @@ public:
NotificationWidget *getNotificationWidget(); NotificationWidget *getNotificationWidget();
void enableDisableCloudActions(); void enableDisableCloudActions();
void enableDisableOtherDCsActions(); void enableDisableOtherDCsActions();
void enterEditState();
void exitEditState();
void editDiveSite(dive_site *ds); void editDiveSite(dive_site *ds);
std::unique_ptr<MainTab> mainTab; std::unique_ptr<MainTab> mainTab;

View file

@ -214,7 +214,6 @@ void MainTab::enableEdition(EditMode newEditMode)
ui.editDiveSiteButton->setEnabled(false); ui.editDiveSiteButton->setEnabled(false);
MainWindow::instance()->diveList->setEnabled(false); MainWindow::instance()->diveList->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false); MainWindow::instance()->setEnabledToolbar(false);
MainWindow::instance()->enterEditState();
ui.dateEdit->setEnabled(true); ui.dateEdit->setEnabled(true);
displayMessage(tr("This dive is being edited.")); displayMessage(tr("This dive is being edited."));
@ -521,7 +520,6 @@ void MainTab::acceptChanges()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
MainWindow::instance()->diveList->verticalScrollBar()->setSliderPosition(scrolledBy); MainWindow::instance()->diveList->verticalScrollBar()->setSliderPosition(scrolledBy);
MainWindow::instance()->diveList->setFocus(); MainWindow::instance()->diveList->setFocus();
MainWindow::instance()->exitEditState();
MainWindow::instance()->setEnabledToolbar(true); MainWindow::instance()->setEnabledToolbar(true);
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
editMode = NONE; editMode = NONE;
@ -552,7 +550,6 @@ void MainTab::rejectChanges()
// show the profile and dive info // show the profile and dive info
MainWindow::instance()->graphics->replot(); MainWindow::instance()->graphics->replot();
MainWindow::instance()->setEnabledToolbar(true); MainWindow::instance()->setEnabledToolbar(true);
MainWindow::instance()->exitEditState();
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
} }