mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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();
|
DiveComputerManagementDialog::instance()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDivePlanner_triggered()
|
bool MainWindow::plannerStateClean()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct dive *dive;
|
|
||||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
ui.InfoWidget->isEditing()) {
|
ui.InfoWidget->isEditing()) {
|
||||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to plan a dive."));
|
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionDivePlanner_triggered()
|
||||||
|
{
|
||||||
|
if (!plannerStateClean())
|
||||||
|
return;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
struct dive *dive;
|
||||||
|
|
||||||
disableDcShortcuts();
|
disableDcShortcuts();
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
DivePlannerPointsModel::instance()->clear();
|
DivePlannerPointsModel::instance()->clear();
|
||||||
|
@ -381,11 +390,9 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionAddDive_triggered()
|
void MainWindow::on_actionAddDive_triggered()
|
||||||
{
|
{
|
||||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
if(!plannerStateClean())
|
||||||
ui.InfoWidget->isEditing()) {
|
|
||||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
dive_list()->rememberSelection();
|
dive_list()->rememberSelection();
|
||||||
dive_list()->unselectDives();
|
dive_list()->unselectDives();
|
||||||
disableDcShortcuts();
|
disableDcShortcuts();
|
||||||
|
|
|
@ -172,6 +172,8 @@ private:
|
||||||
void updateLastUsedDir(const QString &s);
|
void updateLastUsedDir(const QString &s);
|
||||||
bool filesAsArguments;
|
bool filesAsArguments;
|
||||||
UpdateManager *updateManager;
|
UpdateManager *updateManager;
|
||||||
|
|
||||||
|
bool plannerStateClean();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue