Implement a settingsChanged in DivePlannerWidget

This is so we can default to the GF's from the preferences. We need the
bail handler in createTemporaryPlan, because its triggered when we
change GF's, and if we don't have a stagingDive there, we will access a
NULL-pointer.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2013-12-09 07:43:00 +01:00 committed by Dirk Hohndel
parent 3b115b9400
commit e6c51cc314
4 changed files with 13 additions and 1 deletions

View file

@ -1002,6 +1002,12 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
setMinimumHeight(0);
}
void DivePlannerWidget::settingsChanged()
{
ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh);
}
void DivePlannerPointsModel::addCylinder_clicked()
{
CylindersModel::instance()->add();
@ -1402,6 +1408,9 @@ void DivePlannerPointsModel::createTemporaryPlan()
// Get the user-input and calculate the dive info
// Not sure if this is the place to create the diveplan...
// We just start with a surface node at time = 0
if (!stagingDive)
return;
diveplan.dp = NULL;
int lastIndex = -1;
for (int i = 0; i < rowCount(); i++) {

View file

@ -236,6 +236,7 @@ public:
explicit DivePlannerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
public slots:
void settingsChanged();
void atmPressureChanged(const QString& pressure);
void bottomSacChanged(const QString& bottomSac);
void decoSacChanged(const QString& decosac);

View file

@ -56,6 +56,7 @@ MainWindow::MainWindow() : helpView(0)
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ProfileWidget, SLOT(refresh()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.InfoWidget, SLOT(updateDiveInfo()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlanner, SLOT(settingsChanged()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlannerWidget, SLOT(settingsChanged()));
ui.mainErrorMessage->hide();
initialUiSetup();
@ -67,6 +68,7 @@ MainWindow::MainWindow() : helpView(0)
ui.ListWidget->expand(ui.ListWidget->model()->index(0,0));
ui.ListWidget->scrollTo(ui.ListWidget->model()->index(0,0), QAbstractItemView::PositionAtCenter);
ui.divePlanner->settingsChanged();
ui.divePlannerWidget->settingsChanged();
}
// this gets called after we download dives from a divecomputer

View file

@ -53,7 +53,7 @@
<number>0</number>
</property>
<item>
<widget class="DivePlannerWidget" name="widget" native="true"/>
<widget class="DivePlannerWidget" name="divePlannerWidget" native="true"/>
</item>
</layout>
</widget>