mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: correctly refresh the display
We were making things way too hard (and were doing things that don't need doing, like clearing the DivePlanPointModel). Currently we still crash after manually adding a dive or when canceling a plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
eb59b97c2b
commit
c88a90f379
2 changed files with 3 additions and 15 deletions
|
@ -256,7 +256,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
||||||
connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
|
connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
|
||||||
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
|
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
|
||||||
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(showProfile()));
|
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(showProfile()));
|
||||||
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(refreshDisplay()));
|
|
||||||
connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
|
connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
|
||||||
connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(showProfile()));
|
connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(showProfile()));
|
||||||
|
|
||||||
|
@ -666,7 +665,6 @@ void DivePlannerPointsModel::cancelPlan()
|
||||||
stagingDive = NULL;
|
stagingDive = NULL;
|
||||||
}
|
}
|
||||||
setPlanMode(NOTHING);
|
setPlanMode(NOTHING);
|
||||||
MainWindow::instance()->graphics()->setProfileState();
|
|
||||||
diveplan.dp = NULL;
|
diveplan.dp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,17 +864,10 @@ void DivePlannerPointsModel::createPlan()
|
||||||
// Remove and clean the diveplan, so we don't delete
|
// Remove and clean the diveplan, so we don't delete
|
||||||
// the dive by mistake.
|
// the dive by mistake.
|
||||||
diveplan.dp = NULL;
|
diveplan.dp = NULL;
|
||||||
clear();
|
|
||||||
|
|
||||||
// we unselected all dives earlier, so as a side effect recreating the dive list will select the new dive
|
|
||||||
MainWindow::instance()->recreateDiveList();
|
|
||||||
planCreated();
|
planCreated();
|
||||||
setPlanMode(NOTHING);
|
setPlanMode(NOTHING);
|
||||||
free(stagingDive);
|
free(stagingDive);
|
||||||
stagingDive = NULL;
|
stagingDive = NULL;
|
||||||
oldRecalc = plannerModel->setRecalc(false);
|
// we unselected all dives earlier, so as a side effect recreating the dive list will select the new dive
|
||||||
CylindersModel::instance()->setDive(current_dive);
|
MainWindow::instance()->refreshDisplay();
|
||||||
CylindersModel::instance()->update();
|
|
||||||
plannerModel->setRecalc(oldRecalc);
|
|
||||||
MainWindow::instance()->graphics()->setProfileState();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,10 +301,7 @@ void MainWindow::enableDcShortcuts()
|
||||||
void MainWindow::showProfile()
|
void MainWindow::showProfile()
|
||||||
{
|
{
|
||||||
enableDcShortcuts();
|
enableDcShortcuts();
|
||||||
//TODO: I BROKE THIS BY COMMENTING THE LINE BELOW
|
ui.newProfile->setProfileState();
|
||||||
// and I'm sleepy now, so I think I should not try to fix right away.
|
|
||||||
// we don't setCurrentIndex anymore, we ->setPlanState() or ->setAddState() on the ProfileView.
|
|
||||||
//ui.stackedWidget->setCurrentIndex(PROFILE);
|
|
||||||
ui.infoPane->setCurrentIndex(MAINTAB);
|
ui.infoPane->setCurrentIndex(MAINTAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue