preferences: use std::string in struct preferences

This is a messy commit, because the "qPref" system relies
heavily on QString, which means lots of conversions between
the two worlds. Ultimately, I plan to base the preferences
system on std::string and only convert to QString when
pushing through Qt's property system or when writing into
Qt's settings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-13 22:59:32 +02:00 committed by bstoeger
parent 82fc9de40b
commit ccdd92aeb7
78 changed files with 645 additions and 694 deletions

View file

@ -402,10 +402,10 @@ cylinder_t *get_or_create_cylinder(struct dive *d, int idx)
/* if a default cylinder is set, use that */
void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl)
{
const char *cyl_name = prefs.default_cylinder;
const std::string &cyl_name = prefs.default_cylinder;
pressure_t pO2 = {.mbar = static_cast<int>(lrint(prefs.modpO2 * 1000.0))};
if (!cyl_name)
if (cyl_name.empty())
return;
for (auto &ti: tank_info_table) {
if (ti.name == cyl_name) {
@ -454,7 +454,7 @@ void add_default_cylinder(struct dive *d)
return;
cylinder_t cyl;
if (!empty_string(prefs.default_cylinder)) {
if (!prefs.default_cylinder.empty()) {
cyl = create_new_cylinder(d);
} else {
// roughly an AL80