Merge pull request #1780 from DarkLordZach/controller-profiles

configure_input: Add Controller Setup Profiles and simplify input UI
This commit is contained in:
bunnei 2018-12-23 14:34:29 -05:00 committed by GitHub
commit d08bdc861f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 401 additions and 66 deletions

View file

@ -4,6 +4,7 @@
#include <QSettings>
#include "common/file_util.h"
#include "configure_input_simple.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/hid/controllers/npad.h"
#include "input_common/main.h"
@ -339,6 +340,13 @@ void Config::ReadTouchscreenValues() {
qt_config->endGroup();
}
void Config::ApplyDefaultProfileIfInputInvalid() {
if (!std::any_of(Settings::values.players.begin(), Settings::values.players.end(),
[](const Settings::PlayerInput& in) { return in.connected; })) {
ApplyInputProfileConfiguration(UISettings::values.profile_index);
}
}
void Config::ReadValues() {
qt_config->beginGroup("Controls");
@ -518,6 +526,9 @@ void Config::ReadValues() {
UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
UISettings::values.callout_flags = qt_config->value("calloutFlags", 0).toUInt();
UISettings::values.show_console = qt_config->value("showConsole", false).toBool();
UISettings::values.profile_index = qt_config->value("profileIndex", 0).toUInt();
ApplyDefaultProfileIfInputInvalid();
qt_config->endGroup();
}
@ -720,6 +731,7 @@ void Config::SaveValues() {
qt_config->setValue("firstStart", UISettings::values.first_start);
qt_config->setValue("calloutFlags", UISettings::values.callout_flags);
qt_config->setValue("showConsole", UISettings::values.show_console);
qt_config->setValue("profileIndex", UISettings::values.profile_index);
qt_config->endGroup();
}