From 0cfea5205d54a374170a4a7aeb32641aab00cf90 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 4 Jul 2014 06:53:33 -0700 Subject: UI restructure: correctly setup planning I had tested this mostly with add dive and completely forgot to track the same changes in the planning routine. Oops. This allowed to get rid of a no longer useful helper as well. Fixes #594 Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index fc7447860..5be757d47 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -391,33 +391,9 @@ bool MainWindow::plannerStateClean() return true; } -// setup displayed_dive so we can start planning with it -void MainWindow::createFakeDiveForAddAndPlan() -{ - clear_dive(&displayed_dive); - displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600; - displayed_dive.dc.model = "manually added dive"; // don't translate! this is stored in the XML file - // now show the mostly empty main tab - ui.InfoWidget->updateDiveInfo(); - -#if 0 // don't want to do any of this, I think - // select this new dive (but remember the old selection - ui.ListWidget->rememberSelection(); - ui.ListWidget->unselectDives(); - ui.ListWidget->reload(DiveTripModel::CURRENT); - ui.ListWidget->selectDives(QList() << dive_table.nr - 1); - ui.InfoWidget->updateDiveInfo(); - showProfile(); -#endif -} - void MainWindow::planCanceled() { showProfile(); -#if 0 // shouldn't need this - ui.ListWidget->reload(DiveTripModel::CURRENT); - ui.ListWidget->restoreSelection(); -#endif refreshDisplay(); } @@ -458,23 +434,23 @@ void MainWindow::on_actionDivePlanner_triggered() ui.ListWidget->endSearch(); // put us in PLAN mode DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); + + // clean out the dive and give it an id and the correct dc model + clear_dive(&displayed_dive); + displayed_dive.id = dive_getUniqID(&displayed_dive); + displayed_dive.dc.model = "planned dive"; // don't translate! this is stored in the XML file + ui.newProfile->setPlanState(); ui.infoPane->setCurrentIndex(PLANNERWIDGET); - // set up the staging dive and clean up the widgets - DivePlannerPointsModel::instance()->clear(); - // setup the staging dive cylinders from the selected dive + DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->setupCylinders(); // create a simple starting dive, using the first gas from the just copied cylidners DivePlannerPointsModel::instance()->setupStartTime(); - createFakeDiveForAddAndPlan(); DivePlannerPointsModel::instance()->createSimpleDive(); - // reload and then disable the dive list - ui.ListWidget->reload(DiveTripModel::CURRENT); - ui.ListWidget->setEnabled(false); ui.diveListPane->setCurrentIndex(1); // switch to the plan output ui.globePane->setCurrentIndex(1); #ifdef NO_MARBLE -- cgit v1.2.3-70-g09d2