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

@ -9,7 +9,7 @@
#include "errorhelper.h"
#include "core/settings/qPref.h"
char *settings_suffix = NULL;
std::string settings_suffix;
static QTranslator qtTranslator, ssrfTranslator, parentLanguageTranslator;
void init_qt_late()
@ -29,17 +29,17 @@ void init_qt_late()
QGuiApplication::setDesktopFileName("subsurface");
#endif
// enable user specific settings (based on command line argument)
if (settings_suffix) {
if (!settings_suffix.empty()) {
if (verbose)
#if defined(SUBSURFACE_MOBILE) && ((defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || (defined(Q_OS_DARWIN) && !defined(Q_OS_IOS)))
report_info("using custom config for Subsurface-Mobile-%s", settings_suffix);
report_info("using custom config for Subsurface-Mobile-%s", settings_suffix.c_str());
#else
report_info("using custom config for Subsurface-%s", settings_suffix);
report_info("using custom config for Subsurface-%s", settings_suffix.c_str());
#endif
#if defined(SUBSURFACE_MOBILE) && ((defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || (defined(Q_OS_DARWIN) && !defined(Q_OS_IOS)))
QCoreApplication::setApplicationName(QString("Subsurface-Mobile-%1").arg(settings_suffix));
QCoreApplication::setApplicationName(QString::fromStdString("Subsurface-Mobile-" + settings_suffix));
#else
QCoreApplication::setApplicationName(QString("Subsurface-%1").arg(settings_suffix));
QCoreApplication::setApplicationName(QString::fromStdString("Subsurface-" + settings_suffix));
#endif
} else {
#if defined(SUBSURFACE_MOBILE) && ((defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || (defined(Q_OS_DARWIN) && !defined(Q_OS_IOS)))