mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
planner: initialize dive selection mode in constructor
There is no point in repopulating this regularly, as the content does not change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4c02d1c279
commit
1fb9d6236b
3 changed files with 5 additions and 13 deletions
|
@ -582,7 +582,6 @@ void PlannerWidgets::planDive()
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
|
|
||||||
repopulateGasModel();
|
repopulateGasModel();
|
||||||
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
|
||||||
plannerWidget.setReplanButton(false);
|
plannerWidget.setReplanButton(false);
|
||||||
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when)); // This will reload the profile!
|
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when)); // This will reload the profile!
|
||||||
}
|
}
|
||||||
|
@ -597,7 +596,6 @@ void PlannerWidgets::replanDive(int currentDC)
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(planned_dive.get(), currentDC);
|
DivePlannerPointsModel::instance()->loadFromDive(planned_dive.get(), currentDC);
|
||||||
|
|
||||||
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
|
||||||
plannerWidget.setReplanButton(true);
|
plannerWidget.setReplanButton(true);
|
||||||
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when));
|
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when));
|
||||||
if (planned_dive->surface_pressure.mbar)
|
if (planned_dive->surface_pressure.mbar)
|
||||||
|
|
|
@ -25,11 +25,11 @@ void GasSelectionModel::repopulate(const dive *d)
|
||||||
|
|
||||||
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::FontRole) {
|
if (role == Qt::FontRole)
|
||||||
return defaultModelFont();
|
return defaultModelFont();
|
||||||
}
|
|
||||||
return QStringListModel::data(index, role);
|
return QStringListModel::data(index, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dive Type Model for the divetype combo box
|
// Dive Type Model for the divetype combo box
|
||||||
|
|
||||||
Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex&) const
|
Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex&) const
|
||||||
|
@ -37,7 +37,7 @@ Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex&) const
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveTypeSelectionModel::repopulate()
|
DiveTypeSelectionModel::DiveTypeSelectionModel()
|
||||||
{
|
{
|
||||||
QStringList modes;
|
QStringList modes;
|
||||||
for (int i = 0; i < FREEDIVE; i++)
|
for (int i = 0; i < FREEDIVE; i++)
|
||||||
|
@ -47,13 +47,11 @@ void DiveTypeSelectionModel::repopulate()
|
||||||
|
|
||||||
QVariant DiveTypeSelectionModel::data(const QModelIndex &index, int role) const
|
QVariant DiveTypeSelectionModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::FontRole) {
|
if (role == Qt::FontRole)
|
||||||
return defaultModelFont();
|
return defaultModelFont();
|
||||||
}
|
|
||||||
return QStringListModel::data(index, role);
|
return QStringListModel::data(index, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Language Model, The Model to populate the list of possible Languages.
|
// Language Model, The Model to populate the list of possible Languages.
|
||||||
|
|
||||||
LanguageModel *LanguageModel::instance()
|
LanguageModel *LanguageModel::instance()
|
||||||
|
|
|
@ -26,19 +26,15 @@ class GasSelectionModel : public QStringListModel {
|
||||||
public:
|
public:
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
public
|
|
||||||
slots:
|
|
||||||
void repopulate(const dive *d);
|
void repopulate(const dive *d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiveTypeSelectionModel : public QStringListModel {
|
class DiveTypeSelectionModel : public QStringListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
DiveTypeSelectionModel();
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
public
|
|
||||||
slots:
|
|
||||||
void repopulate();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LanguageModel : public QAbstractListModel {
|
class LanguageModel : public QAbstractListModel {
|
||||||
|
|
Loading…
Reference in a new issue