diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-03 14:42:33 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-03 14:42:33 +0200 |
commit | 9201417e9973f901a39195507cf2935a529e821e (patch) | |
tree | 8cb23efc9ec1b62cb403d738ee6d47584a142cd0 | |
parent | 6aa89934e8f22a580dc8a63cec61fb9ea9d14f23 (diff) |
fix msvc empty config list
Some MSVC 2015RC bug with static initialized const char*. But reproduced
also in #179 (?)
-rw-r--r-- | facetracknoir/process_detector.cpp | 8 | ||||
-rw-r--r-- | facetracknoir/ui.cpp | 16 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp | 8 | ||||
-rw-r--r-- | opentrack/options.hpp | 12 |
4 files changed, 22 insertions, 22 deletions
diff --git a/facetracknoir/process_detector.cpp b/facetracknoir/process_detector.cpp index 237d350d..79b5c95f 100644 --- a/facetracknoir/process_detector.cpp +++ b/facetracknoir/process_detector.cpp @@ -9,25 +9,25 @@ void settings::set_game_list(const QString &game_list) { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); settings.setValue("executable-list", game_list); } QString settings::get_game_list() { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); return settings.value("executable-list").toString(); } bool settings::is_enabled() { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); return settings.value("executable-detector-enabled", false).toBool(); } void settings::set_is_enabled(bool enabled) { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); settings.setValue("executable-detector-enabled", enabled); } diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 284367ce..5a600f02 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -112,8 +112,8 @@ void MainWindow::open() { if (! fileName.isEmpty() ) { { - QSettings settings(group::org); - settings.setValue(group::filename_key, remove_app_path(fileName)); + QSettings settings(OPENTRACK_ORG); + settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); } fill_profile_combobox(); load_settings(); @@ -161,8 +161,8 @@ void MainWindow::saveAs() { (void) QFile::copy(oldFile, fileName); - QSettings settings(group::org); - settings.setValue (group::filename_key, remove_app_path(fileName)); + QSettings settings(OPENTRACK_ORG); + settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); } save(); @@ -460,8 +460,8 @@ void MainWindow::profileSelected(int index) return; { - QSettings settings(group::org); - settings.setValue (group::filename_key, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" + + QSettings settings(OPENTRACK_ORG); + settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" + ui.iconcomboProfile->itemText(index))); } load_settings(); @@ -540,6 +540,6 @@ void MainWindow::maybe_start_profile_from_executable() void MainWindow::set_profile(const QString &profile) { - QSettings settings(group::org); - settings.setValue(group::filename_key, MainWindow::remove_app_path(profile)); + QSettings settings(OPENTRACK_ORG); + settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, MainWindow::remove_app_path(profile)); } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp index 017a8f0a..80543e7a 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp @@ -36,12 +36,12 @@ void TrackerSettings::load_ini() { #ifdef OPENTRACK_API - QSettings settings(options::group::org); // Registry settings (in HK_USER) + QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER) #else QSettings settings("opentrack"); // Registry settings (in HK_USER) #endif #ifdef OPENTRACK_API - QString currentFile = settings.value( options::group::filename_key, QCoreApplication::applicationDirPath() + options::group::default_path ).toString(); + QString currentFile = settings.value( OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH ).toString(); #else QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); #endif @@ -106,12 +106,12 @@ void TrackerSettings::save_ini() const { #ifdef OPENTRACK_API - QSettings settings(options::group::org); // Registry settings (in HK_USER) + QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER) #else QSettings settings("opentrack"); // Registry settings (in HK_USER) #endif #ifdef OPENTRACK_API - QString currentFile = settings.value( options::group::filename_key, QCoreApplication::applicationDirPath() + options::group::default_path ).toString(); + QString currentFile = settings.value( OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH ).toString(); #else QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); #endif diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 7c3f6847..a10ba382 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -38,6 +38,10 @@ #include <memory> template<typename t> using mem = std::shared_ptr<t>; +#define OPENTRACK_CONFIG_FILENAME_KEY "settings-file" +#define OPENTRACK_DEFAULT_CONFIG_PATH "/settings/default.ini" +#define OPENTRACK_ORG "opentrack-2.3" + namespace options { template<typename k, typename v> using map = std::map<k, v>; @@ -97,7 +101,6 @@ namespace options { } conf.endGroup(); } - static constexpr const char* org = "opentrack-2.3"; void save() { @@ -129,13 +132,10 @@ namespace options { return kvs.count(s) != 0; } - static constexpr const char* filename_key = "settings-file"; - static constexpr const char* default_path = "/settings/default.ini"; - static const QString ini_pathname() { - QSettings settings(group::org); - return settings.value(filename_key, QCoreApplication::applicationDirPath() + default_path).toString(); + QSettings settings(OPENTRACK_ORG); + return settings.value(OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH).toString(); } static const QStringList ini_list() |