mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:33:23 +00:00
Small code cleanup.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
dcd8381764
commit
777f047247
2 changed files with 18 additions and 9 deletions
|
@ -355,15 +355,24 @@ void MainWindow::on_actionEditDeviceNames_triggered()
|
|||
DiveComputerManagementDialog::instance()->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDivePlanner_triggered()
|
||||
bool MainWindow::plannerStateClean()
|
||||
{
|
||||
int i;
|
||||
struct dive *dive;
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to plan a dive."));
|
||||
return;
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDivePlanner_triggered()
|
||||
{
|
||||
if (!plannerStateClean())
|
||||
return;
|
||||
|
||||
int i;
|
||||
struct dive *dive;
|
||||
|
||||
disableDcShortcuts();
|
||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||
DivePlannerPointsModel::instance()->clear();
|
||||
|
@ -381,11 +390,9 @@ void MainWindow::on_actionDivePlanner_triggered()
|
|||
|
||||
void MainWindow::on_actionAddDive_triggered()
|
||||
{
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
||||
if(!plannerStateClean())
|
||||
return;
|
||||
}
|
||||
|
||||
dive_list()->rememberSelection();
|
||||
dive_list()->unselectDives();
|
||||
disableDcShortcuts();
|
||||
|
|
|
@ -172,6 +172,8 @@ private:
|
|||
void updateLastUsedDir(const QString &s);
|
||||
bool filesAsArguments;
|
||||
UpdateManager *updateManager;
|
||||
|
||||
bool plannerStateClean();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
Loading…
Add table
Reference in a new issue