From fa1801471c2708ed8266ec7b99bd4cec886ccc1b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 8 Jul 2018 23:29:49 +0200 Subject: options: fix 2 issues 1. Calling valueChanged didn't invoke machinery in value, only base_value aka value_. There's a fast path in value::type() despite the pessimization. 2. Split global scope stuff into options::globals from the options::globals stuff 3. Adjust usages --- gui/process_detector.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gui/process_detector.cpp') diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index 969b1856..0ff05f93 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -24,31 +24,32 @@ static constexpr inline auto RECORD_SEPARATOR = QChar(char(0x1e)); // RS ^] static constexpr inline auto UNIT_SEPARATOR = QChar(char(0x1f)); // US ^_ using namespace options; +using namespace options::globals; void proc_detector_settings::set_game_list(const QString &game_list) { - group::with_global_settings_object([&](QSettings& settings) { + with_global_settings_object([&](QSettings& settings) { settings.setValue("executable-list", game_list); }); } QString proc_detector_settings::get_game_list() { - return group::with_global_settings_object([&](QSettings& settings) { + return with_global_settings_object([&](QSettings& settings) { return settings.value("executable-list").toString(); }); } bool proc_detector_settings::is_enabled() { - return group::with_global_settings_object([&](QSettings& settings) { + return with_global_settings_object([&](QSettings& settings) { return settings.value("executable-detector-enabled", false).toBool(); }); } void proc_detector_settings::set_is_enabled(bool enabled) { - group::with_global_settings_object([&](QSettings& settings) { + with_global_settings_object([&](QSettings& settings) { settings.setValue("executable-detector-enabled", enabled); }); } @@ -76,7 +77,7 @@ QHash proc_detector_settings::split_process_names() void BrowseButton::browse() { - QString dir_path = QFileInfo(group::ini_pathname()).absolutePath(); + QString dir_path = QFileInfo(ini_pathname()).absolutePath(); QString filename = QFileDialog::getOpenFileName( this, tr("Set executable name"), @@ -96,7 +97,7 @@ int process_detector::add_row(QString const& exe_name, QString const& profile) QComboBox* cb = new QComboBox(); cb->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); cb->addItem(""); - cb->addItems(group::ini_list()); + cb->addItems(ini_list()); ui.tableWidget->setCellWidget(i, 1, cb); QTableWidgetItem* twi = new QTableWidgetItem(exe_name); -- cgit v1.2.3