From 9a4f8b50bd9b88b00959a08524e1617be1486c95 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 8 May 2014 23:36:45 +0200 Subject: When starting the planner, copy cylinders from currently selected dive. This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index fb5e3af8e..769f486de 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -325,6 +325,8 @@ void MainWindow::enableDcShortcuts() void MainWindow::on_actionDivePlanner_triggered() { + 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.")); @@ -334,6 +336,13 @@ void MainWindow::on_actionDivePlanner_triggered() DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->clear(); CylindersModel::instance()->clear(); + for_each_dive(i,dive) { + if(dive->selected){ + DivePlannerPointsModel::instance()->copyCylindersFrom(dive); + CylindersModel::instance()->copyFromDive(dive); + break; + } + } ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); ui.infoPane->setCurrentIndex(PLANNERWIDGET); } -- cgit v1.2.3-70-g09d2