code cleanup: introduce empty_cylinder constant
This deals with the issue of initializing structs in C++. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
@@ -421,7 +421,7 @@ int CylindersModel::rowCount(const QModelIndex&) const
|
||||
void CylindersModel::add()
|
||||
{
|
||||
int row = rows;
|
||||
cylinder_t cyl = { 0 };
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
fill_default_cylinder(&displayed_dive, &cyl);
|
||||
cyl.start = cyl.type.workingpressure;
|
||||
cyl.manually_added = true;
|
||||
|
||||
@@ -166,12 +166,12 @@ void DivePlannerPointsModel::setupCylinders()
|
||||
}
|
||||
}
|
||||
if (!empty_string(prefs.default_cylinder)) {
|
||||
cylinder_t cyl = { 0 };
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
fill_default_cylinder(&displayed_dive, &cyl);
|
||||
cyl.start = cyl.type.workingpressure;
|
||||
add_to_cylinder_table(&displayed_dive.cylinders, 0, cyl);
|
||||
} else {
|
||||
cylinder_t cyl = { 0 };
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
// roughly an AL80
|
||||
cyl.type.description = copy_qstring(tr("unknown"));
|
||||
cyl.type.size.mliter = 11100;
|
||||
|
||||
@@ -515,7 +515,7 @@ void processRangesZip(Vector1 &items1, Vector2 &items2, Predicate cond, Action a
|
||||
return 1;
|
||||
},
|
||||
[&](Vector1 &v1, int from, int to) { // Action
|
||||
return action(v1, items2, from, to, actItem);
|
||||
return action(v1, items2, from, to, actItem);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ QModelIndex DiveTripModelTree::parent(const QModelIndex &index) const
|
||||
}
|
||||
|
||||
DiveTripModelTree::Item::Item(dive_trip *t, const QVector<dive *> &divesIn) : d_or_t{nullptr, t},
|
||||
dives(divesIn.toStdVector()),
|
||||
dives(std::vector<dive *>(divesIn.begin(), divesIn.end())),
|
||||
shown(std::any_of(dives.begin(), dives.end(), [](dive *d){ return !d->hidden_by_filter; }))
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user