From 412238720806e1d66f6a94418f2af7d6785d4452 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Wed, 25 Mar 2015 16:07:42 +0200 Subject: Manual added dives edit button is missing once the manual added dive is added it can't be edited directly, This can be fixed by adding an edit button to the log menu, this will be consistent with the plan/replan buttons. Fixes #847 Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 21 +++++++++++++++++++++ qt-ui/mainwindow.h | 1 + qt-ui/mainwindow.ui | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 2c17648d6..8147e7f3a 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -654,6 +654,27 @@ void MainWindow::on_actionAddDive_triggered() graphics()->plotDive(); } +void MainWindow::on_actionEditDive_triggered() +{ + if (information()->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) { + QMessageBox::warning(this, tr("Warning"), tr("Please, first finish the current edition before trying to do another.")); + return; + } + + const bool isTripEdit = dive_list()->selectedTrips().count() >= 1; + if (!current_dive || isTripEdit || strcmp(current_dive->dc.model, "manually added dive")) { + return; + } + + DivePlannerPointsModel::instance()->clear(); + disableShortcuts(); + DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); + graphics()->setAddState(); + setApplicationState("EditDive"); + DivePlannerPointsModel::instance()->loadFromDive(current_dive); + information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE); +} + void MainWindow::on_actionRenumber_triggered() { RenumberDialog::instance()->renumberOnlySelected(false); diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 22fd02d4d..7b6007bb4 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -113,6 +113,7 @@ slots: void on_actionDivelogs_de_triggered(); void on_actionEditDeviceNames_triggered(); void on_actionAddDive_triggered(); + void on_actionEditDive_triggered(); void on_actionRenumber_triggered(); void on_actionAutoGroup_triggered(); void on_actionYearlyStatistics_triggered(); diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 82f7bcd7f..1494706a0 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -82,6 +82,7 @@ &Log + @@ -253,6 +254,11 @@ Ctrl++ + + + &Edit dive + + &Copy dive components -- cgit v1.2.3-70-g09d2