diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 4c31b1310..7c65e2c28 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -560,6 +560,8 @@ void PlannerWidgets::planDive(dive *currentDive) else // No salinity means salt water plannerWidget.setSalinity(SEAWATER_SALINITY); } + GasSelectionModel::instance()->repopulate(); + DiveTypeSelectionModel::instance()->repopulate(); plannerWidget.setReplanButton(false); plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when)); // This will reload the profile! @@ -570,6 +572,7 @@ void PlannerWidgets::replanDive(int currentDC) DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive, currentDC); + DiveTypeSelectionModel::instance()->repopulate(); plannerWidget.setReplanButton(true); plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when)); if (displayed_dive.surface_pressure.mbar) diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 1a4fd91dd..e10d7eda1 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -5,8 +5,8 @@ #include "core/divelog.h" #include "core/subsurface-string.h" #include "qt-models/cylindermodel.h" +#include "qt-models/models.h" // For defaultModelFont(). #include "core/planner.h" -#include "qt-models/models.h" #include "core/device.h" #include "core/qthelper.h" #include "core/range.h" @@ -87,8 +87,6 @@ void DivePlannerPointsModel::createSimpleDive(struct dive *dIn) addStop(M_OR_FT(5, 15), 45 * 60, 0, cylinderid, true, UNDEF_COMP_TYPE); } updateDiveProfile(); - GasSelectionModel::instance()->repopulate(); - DiveTypeSelectionModel::instance()->repopulate(); } void DivePlannerPointsModel::setupStartTime() @@ -179,7 +177,6 @@ void DivePlannerPointsModel::loadFromDive(dive *dIn, int dcNrIn) current_divemode = get_current_divemode(dc, d->dc.duration.seconds, &evd, ¤t_divemode); if (!hasMarkedSamples && !dc->last_manual_time.seconds) addStop(0, d->dc.duration.seconds,cylinderid, last_sp.mbar, true, current_divemode); - DiveTypeSelectionModel::instance()->repopulate(); preserved_until = d->duration; updateDiveProfile(); diff --git a/qt-models/models.cpp b/qt-models/models.cpp index dfc917993..314d73aec 100644 --- a/qt-models/models.cpp +++ b/qt-models/models.cpp @@ -51,7 +51,7 @@ DiveTypeSelectionModel *DiveTypeSelectionModel::instance() void DiveTypeSelectionModel::repopulate() { - QStringList modes = QStringList(); + QStringList modes; for (int i = 0; i < FREEDIVE; i++) modes.append(gettextFromC::tr(divemode_text_ui[i])); setStringList(modes);