mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
82fc9de40b
commit
ccdd92aeb7
78 changed files with 645 additions and 694 deletions
|
|
@ -22,8 +22,8 @@ void TestQPrefEquipment::test_struct_get()
|
|||
// Test struct pref -> get func.
|
||||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
prefs.default_cylinder = copy_qstring("new base11");
|
||||
QCOMPARE(tst->default_cylinder(), QString(prefs.default_cylinder));
|
||||
prefs.default_cylinder = "new base11";
|
||||
QCOMPARE(tst->default_cylinder(), QString::fromStdString(prefs.default_cylinder));
|
||||
prefs.include_unused_tanks = true;
|
||||
QCOMPARE(tst->include_unused_tanks(), prefs.include_unused_tanks);
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ void TestQPrefEquipment::test_set_struct()
|
|||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
tst->set_default_cylinder("new base21");
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("new base21"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("new base21"));
|
||||
tst->set_include_unused_tanks(false);
|
||||
QCOMPARE(prefs.include_unused_tanks, false);
|
||||
}
|
||||
|
|
@ -46,11 +46,11 @@ void TestQPrefEquipment::test_set_load_struct()
|
|||
auto tst = qPrefEquipment::instance();
|
||||
|
||||
tst->set_default_cylinder("new base31");
|
||||
prefs.default_cylinder = copy_qstring("error");
|
||||
prefs.default_cylinder = "error";
|
||||
tst->set_include_unused_tanks(false);
|
||||
prefs.include_unused_tanks = true;
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("new base31"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("new base31"));
|
||||
QCOMPARE(prefs.include_unused_tanks, false);
|
||||
}
|
||||
|
||||
|
|
@ -59,15 +59,15 @@ void TestQPrefEquipment::test_struct_disk()
|
|||
// test struct prefs -> disk
|
||||
|
||||
auto tst = qPrefEquipment::instance();
|
||||
prefs.default_cylinder = copy_qstring("base41");
|
||||
prefs.default_cylinder = "base41";
|
||||
prefs.include_unused_tanks = true;
|
||||
|
||||
tst->sync();
|
||||
prefs.default_cylinder = copy_qstring("error");
|
||||
prefs.default_cylinder = "error";
|
||||
prefs.include_unused_tanks = false;
|
||||
|
||||
tst->load();
|
||||
QCOMPARE(QString(prefs.default_cylinder), QString("base41"));
|
||||
QCOMPARE(QString::fromStdString(prefs.default_cylinder), QString("base41"));
|
||||
QCOMPARE(prefs.include_unused_tanks, true);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue