Qt: rename pad profiles to config files

This commit is contained in:
Megamouse 2023-08-29 21:05:04 +02:00
parent cb8aa21fb1
commit f554b444c0
9 changed files with 103 additions and 103 deletions

View file

@ -4,7 +4,7 @@
LOG_CHANNEL(input_log, "Input"); LOG_CHANNEL(input_log, "Input");
extern std::string g_pad_profile_override; extern std::string g_input_config_override;
std::vector<std::string> cfg_pad::get_buttons(const std::string& str) std::vector<std::string> cfg_pad::get_buttons(const std::string& str)
{ {
@ -26,16 +26,16 @@ std::string cfg_pad::get_buttons(std::vector<std::string> vec)
return fmt::merge(vec, ","); return fmt::merge(vec, ",");
} }
bool cfg_input::load(const std::string& title_id, const std::string& profile, bool strict) bool cfg_input::load(const std::string& title_id, const std::string& config_file, bool strict)
{ {
input_log.notice("Loading pad config (title_id='%s', profile='%s', strict=%d)", title_id, profile, strict); input_log.notice("Loading pad config (title_id='%s', config_file='%s', strict=%d)", title_id, config_file, strict);
std::string cfg_name; std::string cfg_name;
// Check profile override first // Check configuration override first
if (!strict && !g_pad_profile_override.empty()) if (!strict && !g_input_config_override.empty())
{ {
cfg_name = rpcs3::utils::get_input_config_dir() + g_pad_profile_override + ".yml"; cfg_name = rpcs3::utils::get_input_config_dir() + g_input_config_override + ".yml";
} }
// Check custom config next // Check custom config next
@ -44,23 +44,23 @@ bool cfg_input::load(const std::string& title_id, const std::string& profile, bo
cfg_name = rpcs3::utils::get_custom_input_config_path(title_id); cfg_name = rpcs3::utils::get_custom_input_config_path(title_id);
} }
// Check active global profile next // Check active global configuration next
if ((title_id.empty() || !strict) && !profile.empty() && !fs::is_file(cfg_name)) if ((title_id.empty() || !strict) && !config_file.empty() && !fs::is_file(cfg_name))
{ {
cfg_name = rpcs3::utils::get_input_config_dir() + profile + ".yml"; cfg_name = rpcs3::utils::get_input_config_dir() + config_file + ".yml";
} }
// Fallback to default profile // Fallback to default configuration
if (!strict && !fs::is_file(cfg_name)) if (!strict && !fs::is_file(cfg_name))
{ {
cfg_name = rpcs3::utils::get_input_config_dir() + g_cfg_profile.default_profile + ".yml"; cfg_name = rpcs3::utils::get_input_config_dir() + g_cfg_input_configs.default_config + ".yml";
} }
from_default(); from_default();
if (fs::file cfg_file{ cfg_name, fs::read }) if (fs::file cfg_file{ cfg_name, fs::read })
{ {
input_log.notice("Loading pad profile: '%s'", cfg_name); input_log.notice("Loading input configuration: '%s'", cfg_name);
if (std::string content = cfg_file.to_string(); !content.empty()) if (std::string content = cfg_file.to_string(); !content.empty())
{ {
@ -69,7 +69,7 @@ bool cfg_input::load(const std::string& title_id, const std::string& profile, bo
} }
// Add keyboard by default // Add keyboard by default
input_log.notice("Pad profile empty. Adding default keyboard pad handler"); input_log.notice("Input configuration empty. Adding default keyboard pad handler");
player[0]->handler.from_string(fmt::format("%s", pad_handler::keyboard)); player[0]->handler.from_string(fmt::format("%s", pad_handler::keyboard));
player[0]->device.from_string(pad::keyboard_device_name.data()); player[0]->device.from_string(pad::keyboard_device_name.data());
player[0]->buddy_device.from_string(""sv); player[0]->buddy_device.from_string(""sv);
@ -77,14 +77,14 @@ bool cfg_input::load(const std::string& title_id, const std::string& profile, bo
return false; return false;
} }
void cfg_input::save(const std::string& title_id, const std::string& profile) const void cfg_input::save(const std::string& title_id, const std::string& config_file) const
{ {
std::string cfg_name; std::string cfg_name;
if (title_id.empty()) if (title_id.empty())
{ {
cfg_name = rpcs3::utils::get_input_config_dir() + profile + ".yml"; cfg_name = rpcs3::utils::get_input_config_dir() + config_file + ".yml";
input_log.notice("Saving pad config profile '%s' to '%s'", profile, cfg_name); input_log.notice("Saving input configuration '%s' to '%s'", config_file, cfg_name);
} }
else else
{ {
@ -105,12 +105,12 @@ void cfg_input::save(const std::string& title_id, const std::string& profile) co
} }
} }
cfg_profile::cfg_profile() cfg_input_configurations::cfg_input_configurations()
: path(rpcs3::utils::get_input_config_root() + "/active_profiles.yml") : path(rpcs3::utils::get_input_config_root() + "/active_input_configurations.yml")
{ {
} }
bool cfg_profile::load() bool cfg_input_configurations::load()
{ {
if (fs::file cfg_file{ path, fs::read }) if (fs::file cfg_file{ path, fs::read })
{ {
@ -121,14 +121,14 @@ bool cfg_profile::load()
return false; return false;
} }
void cfg_profile::save() const void cfg_input_configurations::save() const
{ {
input_log.notice("Saving pad profile config to '%s'", path); input_log.notice("Saving input configurations config to '%s'", path);
fs::pending_file cfg_file(path); fs::pending_file cfg_file(path);
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit())) if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{ {
input_log.error("Failed to save pad profile config to '%s' (error=%s)", path, fs::g_tls_error); input_log.error("Failed to save input configurations config to '%s' (error=%s)", path, fs::g_tls_error);
} }
} }

View file

@ -131,18 +131,18 @@ struct cfg_input final : cfg::node
void save(const std::string& title_id, const std::string& profile = "") const; void save(const std::string& title_id, const std::string& profile = "") const;
}; };
struct cfg_profile final : cfg::node struct cfg_input_configurations final : cfg::node
{ {
cfg_profile(); cfg_input_configurations();
bool load(); bool load();
void save() const; void save() const;
const std::string path; const std::string path;
const std::string global_key = "global"; const std::string global_key = "global";
const std::string default_profile = "Default"; const std::string default_config = "Default";
cfg::map_entry active_profiles{ this, "Active Profiles" }; cfg::map_entry active_configs{ this, "Active Configurations" };
}; };
extern cfg_input g_cfg_input; extern cfg_input g_cfg_input;
extern cfg_profile g_cfg_profile; extern cfg_input_configurations g_cfg_input_configs;

View file

@ -379,6 +379,6 @@ namespace rpcs3::utils
std::string get_custom_input_config_path(const std::string& title_id) std::string get_custom_input_config_path(const std::string& title_id)
{ {
if (title_id.empty()) return ""; if (title_id.empty()) return "";
return get_input_config_dir(title_id) + g_cfg_profile.default_profile + ".yml"; return get_input_config_dir(title_id) + g_cfg_input_configs.default_config + ".yml";
} }
} }

View file

@ -27,7 +27,7 @@
LOG_CHANNEL(sys_log, "SYS"); LOG_CHANNEL(sys_log, "SYS");
extern bool is_input_allowed(); extern bool is_input_allowed();
extern std::string g_pad_profile_override; extern std::string g_input_config_override;
namespace pad namespace pad
{ {
@ -100,19 +100,19 @@ void pad_thread::Init()
handlers.clear(); handlers.clear();
g_cfg_profile.load(); g_cfg_input_configs.load();
std::string active_profile = g_cfg_profile.active_profiles.get_value(pad::g_title_id); std::string active_config = g_cfg_input_configs.active_configs.get_value(pad::g_title_id);
if (active_profile.empty()) if (active_config.empty())
{ {
active_profile = g_cfg_profile.active_profiles.get_value(g_cfg_profile.global_key); active_config = g_cfg_input_configs.active_configs.get_value(g_cfg_input_configs.global_key);
} }
input_log.notice("Using pad profile: '%s' (override='%s')", active_profile, g_pad_profile_override); input_log.notice("Using input configuration: '%s' (override='%s')", active_config, g_input_config_override);
// Load in order to get the pad handlers // Load in order to get the pad handlers
if (!g_cfg_input.load(pad::g_title_id, active_profile)) if (!g_cfg_input.load(pad::g_title_id, active_config))
{ {
input_log.notice("Loaded empty pad config"); input_log.notice("Loaded empty pad config");
} }
@ -125,7 +125,7 @@ void pad_thread::Init()
} }
// Reload with proper defaults // Reload with proper defaults
if (!g_cfg_input.load(pad::g_title_id, active_profile)) if (!g_cfg_input.load(pad::g_title_id, active_config))
{ {
input_log.notice("Reloaded empty pad config"); input_log.notice("Reloaded empty pad config");
} }

View file

@ -88,7 +88,7 @@ static atomic_t<bool> s_headless = false;
static atomic_t<bool> s_no_gui = false; static atomic_t<bool> s_no_gui = false;
static atomic_t<char*> s_argv0; static atomic_t<char*> s_argv0;
std::string g_pad_profile_override; std::string g_input_config_override;
extern thread_local std::string(*g_tls_log_prefix)(); extern thread_local std::string(*g_tls_log_prefix)();
extern thread_local std::string_view g_tls_serialize_name; extern thread_local std::string_view g_tls_serialize_name;
@ -291,7 +291,7 @@ constexpr auto arg_styles = "styles";
constexpr auto arg_style = "style"; constexpr auto arg_style = "style";
constexpr auto arg_stylesheet = "stylesheet"; constexpr auto arg_stylesheet = "stylesheet";
constexpr auto arg_config = "config"; constexpr auto arg_config = "config";
constexpr auto arg_pad_profile = "pad-profile"; // only useful with no-gui constexpr auto arg_input_config = "input-config"; // only useful with no-gui
constexpr auto arg_q_debug = "qDebug"; constexpr auto arg_q_debug = "qDebug";
constexpr auto arg_error = "error"; constexpr auto arg_error = "error";
constexpr auto arg_updating = "updating"; constexpr auto arg_updating = "updating";
@ -652,8 +652,8 @@ int main(int argc, char** argv)
parser.addOption(QCommandLineOption(arg_stylesheet, "Loads a custom stylesheet.", "path", "")); parser.addOption(QCommandLineOption(arg_stylesheet, "Loads a custom stylesheet.", "path", ""));
const QCommandLineOption config_option(arg_config, "Forces the emulator to use this configuration file for CLI-booted game.", "path", ""); const QCommandLineOption config_option(arg_config, "Forces the emulator to use this configuration file for CLI-booted game.", "path", "");
parser.addOption(config_option); parser.addOption(config_option);
const QCommandLineOption pad_profile_option(arg_pad_profile, "Forces the emulator to use this pad profile file for CLI-booted game.", "name", ""); const QCommandLineOption input_config_option(arg_input_config, "Forces the emulator to use this input config file for CLI-booted game.", "name", "");
parser.addOption(pad_profile_option); parser.addOption(input_config_option);
const QCommandLineOption installfw_option(arg_installfw, "Forces the emulator to install this firmware file.", "path", ""); const QCommandLineOption installfw_option(arg_installfw, "Forces the emulator to install this firmware file.", "path", "");
parser.addOption(installfw_option); parser.addOption(installfw_option);
const QCommandLineOption installpkg_option(arg_installpkg, "Forces the emulator to install this pkg file.", "path", ""); const QCommandLineOption installpkg_option(arg_installpkg, "Forces the emulator to install this pkg file.", "path", "");
@ -1289,18 +1289,18 @@ int main(int argc, char** argv)
} }
} }
if (parser.isSet(arg_pad_profile)) if (parser.isSet(arg_input_config))
{ {
if (!s_no_gui) if (!s_no_gui)
{ {
report_fatal_error(fmt::format("The option '%s' can only be used in combination with '%s'.", arg_pad_profile, arg_no_gui)); report_fatal_error(fmt::format("The option '%s' can only be used in combination with '%s'.", arg_input_config, arg_no_gui));
} }
g_pad_profile_override = parser.value(pad_profile_option).toStdString(); g_input_config_override = parser.value(input_config_option).toStdString();
if (g_pad_profile_override.empty()) if (g_input_config_override.empty())
{ {
report_fatal_error(fmt::format("Pad profile name is empty")); report_fatal_error(fmt::format("Input config file name is empty"));
} }
} }

View file

@ -1684,10 +1684,10 @@ bool game_list_frame::RemoveCustomPadConfiguration(const std::string& title_id,
: tr("Remove custom pad configuration?")) != QMessageBox::Yes) : tr("Remove custom pad configuration?")) != QMessageBox::Yes)
return true; return true;
g_cfg_profile.load(); g_cfg_input_configs.load();
g_cfg_profile.active_profiles.erase(title_id); g_cfg_input_configs.active_configs.erase(title_id);
g_cfg_profile.save(); g_cfg_input_configs.save();
game_list_log.notice("Removed active pad profile entry for key '%s'", title_id); game_list_log.notice("Removed active input configuration entry for key '%s'", title_id);
if (QDir(qstr(config_dir)).removeRecursively()) if (QDir(qstr(config_dir)).removeRecursively())
{ {

View file

@ -30,7 +30,7 @@ LOG_CHANNEL(cfg_log, "CFG");
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString; constexpr auto qstr = QString::fromStdString;
cfg_profile g_cfg_profile; cfg_input_configurations g_cfg_input_configs;
inline bool CreateConfigFile(const QString& dir, const QString& name) inline bool CreateConfigFile(const QString& dir, const QString& name)
{ {
@ -85,38 +85,38 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr<gui_settings> gui_setti
setWindowTitle(tr("Gamepad Settings")); setWindowTitle(tr("Gamepad Settings"));
} }
// Load profiles // Load input configs
g_cfg_profile.load(); g_cfg_input_configs.load();
if (m_title_id.empty()) if (m_title_id.empty())
{ {
const QString profile_dir = qstr(rpcs3::utils::get_input_config_dir(m_title_id)); const QString input_config_dir = qstr(rpcs3::utils::get_input_config_dir(m_title_id));
QStringList profiles = gui::utils::get_dir_entries(QDir(profile_dir), QStringList() << "*.yml"); QStringList config_files = gui::utils::get_dir_entries(QDir(input_config_dir), QStringList() << "*.yml");
QString active_profile = qstr(g_cfg_profile.active_profiles.get_value(g_cfg_profile.global_key)); QString active_config_file = qstr(g_cfg_input_configs.active_configs.get_value(g_cfg_input_configs.global_key));
if (!profiles.contains(active_profile)) if (!config_files.contains(active_config_file))
{ {
const QString default_profile = qstr(g_cfg_profile.default_profile); const QString default_config_file = qstr(g_cfg_input_configs.default_config);
if (!profiles.contains(default_profile) && CreateConfigFile(profile_dir, default_profile)) if (!config_files.contains(default_config_file) && CreateConfigFile(input_config_dir, default_config_file))
{ {
profiles.prepend(default_profile); config_files.prepend(default_config_file);
} }
active_profile = default_profile; active_config_file = default_config_file;
} }
for (const QString& profile : profiles) for (const QString& profile : config_files)
{ {
ui->chooseProfile->addItem(profile); ui->chooseConfig->addItem(profile);
} }
ui->chooseProfile->setCurrentText(active_profile); ui->chooseConfig->setCurrentText(active_config_file);
} }
else else
{ {
ui->chooseProfile->addItem(qstr(m_title_id)); ui->chooseConfig->addItem(qstr(m_title_id));
ui->gb_profiles->setEnabled(false); ui->gb_config_files->setEnabled(false);
} }
// Create tab widget for 7 players // Create tab widget for 7 players
@ -143,11 +143,11 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr<gui_settings> gui_setti
// Combobox: Devices // Combobox: Devices
connect(ui->chooseDevice, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &pad_settings_dialog::ChangeDevice); connect(ui->chooseDevice, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &pad_settings_dialog::ChangeDevice);
// Combobox: Profiles // Combobox: Configs
connect(ui->chooseProfile, &QComboBox::currentTextChanged, this, &pad_settings_dialog::ChangeProfile); connect(ui->chooseConfig, &QComboBox::currentTextChanged, this, &pad_settings_dialog::ChangeConfig);
// Pushbutton: Add Profile // Pushbutton: Add config file
connect(ui->b_addProfile, &QAbstractButton::clicked, this, &pad_settings_dialog::AddProfile); connect(ui->b_addConfig, &QAbstractButton::clicked, this, &pad_settings_dialog::AddConfigFile);
ui->buttonBox->button(QDialogButtonBox::Reset)->setText(tr("Filter Noise")); ui->buttonBox->button(QDialogButtonBox::Reset)->setText(tr("Filter Noise"));
@ -221,7 +221,7 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr<gui_settings> gui_setti
// Set up first tab // Set up first tab
OnTabChanged(0); OnTabChanged(0);
ChangeProfile(ui->chooseProfile->currentText()); ChangeConfig(ui->chooseConfig->currentText());
} }
void pad_settings_dialog::closeEvent(QCloseEvent* event) void pad_settings_dialog::closeEvent(QCloseEvent* event)
@ -308,7 +308,7 @@ void pad_settings_dialog::InitButtons()
insert_button(button_ids::id_pressure_intensity, ui->b_pressure_intensity); insert_button(button_ids::id_pressure_intensity, ui->b_pressure_intensity);
m_pad_buttons->addButton(ui->b_refresh, button_ids::id_refresh); m_pad_buttons->addButton(ui->b_refresh, button_ids::id_refresh);
m_pad_buttons->addButton(ui->b_addProfile, button_ids::id_add_profile); m_pad_buttons->addButton(ui->b_addConfig, button_ids::id_add_config_file);
connect(m_pad_buttons, &QButtonGroup::idClicked, this, &pad_settings_dialog::OnPadButtonClicked); connect(m_pad_buttons, &QButtonGroup::idClicked, this, &pad_settings_dialog::OnPadButtonClicked);
@ -751,7 +751,7 @@ void pad_settings_dialog::ReactivateButtons()
ui->tabWidget->setFocusPolicy(Qt::TabFocus); ui->tabWidget->setFocusPolicy(Qt::TabFocus);
ui->scrollArea->setFocusPolicy(Qt::StrongFocus); ui->scrollArea->setFocusPolicy(Qt::StrongFocus);
ui->chooseProfile->setFocusPolicy(Qt::WheelFocus); ui->chooseConfig->setFocusPolicy(Qt::WheelFocus);
ui->chooseHandler->setFocusPolicy(Qt::WheelFocus); ui->chooseHandler->setFocusPolicy(Qt::WheelFocus);
ui->chooseDevice->setFocusPolicy(Qt::WheelFocus); ui->chooseDevice->setFocusPolicy(Qt::WheelFocus);
ui->chooseClass->setFocusPolicy(Qt::WheelFocus); ui->chooseClass->setFocusPolicy(Qt::WheelFocus);
@ -1251,7 +1251,7 @@ void pad_settings_dialog::OnPadButtonClicked(int id)
case button_ids::id_led: case button_ids::id_led:
case button_ids::id_pad_begin: case button_ids::id_pad_begin:
case button_ids::id_pad_end: case button_ids::id_pad_end:
case button_ids::id_add_profile: case button_ids::id_add_config_file:
case button_ids::id_refresh: case button_ids::id_refresh:
case button_ids::id_ok: case button_ids::id_ok:
case button_ids::id_cancel: case button_ids::id_cancel:
@ -1290,7 +1290,7 @@ void pad_settings_dialog::OnPadButtonClicked(int id)
ui->tabWidget->setFocusPolicy(Qt::ClickFocus); ui->tabWidget->setFocusPolicy(Qt::ClickFocus);
ui->scrollArea->setFocusPolicy(Qt::ClickFocus); ui->scrollArea->setFocusPolicy(Qt::ClickFocus);
ui->chooseProfile->setFocusPolicy(Qt::ClickFocus); ui->chooseConfig->setFocusPolicy(Qt::ClickFocus);
ui->chooseHandler->setFocusPolicy(Qt::ClickFocus); ui->chooseHandler->setFocusPolicy(Qt::ClickFocus);
ui->chooseDevice->setFocusPolicy(Qt::ClickFocus); ui->chooseDevice->setFocusPolicy(Qt::ClickFocus);
ui->chooseClass->setFocusPolicy(Qt::ClickFocus); ui->chooseClass->setFocusPolicy(Qt::ClickFocus);
@ -1551,15 +1551,15 @@ void pad_settings_dialog::ChangeHandler()
} }
} }
void pad_settings_dialog::ChangeProfile(const QString& profile) void pad_settings_dialog::ChangeConfig(const QString& config_file)
{ {
if (profile.isEmpty()) if (config_file.isEmpty())
return; return;
m_profile = sstr(profile); m_config_file = sstr(config_file);
// Load in order to get the pad handlers // Load in order to get the pad handlers
if (!g_cfg_input.load(m_title_id, m_profile, true)) if (!g_cfg_input.load(m_title_id, m_config_file, true))
{ {
cfg_log.notice("Loaded empty pad config"); cfg_log.notice("Loaded empty pad config");
} }
@ -1572,7 +1572,7 @@ void pad_settings_dialog::ChangeProfile(const QString& profile)
} }
// Reload with proper defaults // Reload with proper defaults
if (!g_cfg_input.load(m_title_id, m_profile, true)) if (!g_cfg_input.load(m_title_id, m_config_file, true))
{ {
cfg_log.notice("Reloaded empty pad config"); cfg_log.notice("Reloaded empty pad config");
} }
@ -1676,36 +1676,36 @@ void pad_settings_dialog::HandleDeviceClassChange(u32 class_id) const
} }
} }
void pad_settings_dialog::AddProfile() void pad_settings_dialog::AddConfigFile()
{ {
QInputDialog* dialog = new QInputDialog(this); QInputDialog* dialog = new QInputDialog(this);
dialog->setWindowTitle(tr("Choose a unique name")); dialog->setWindowTitle(tr("Choose a unique name"));
dialog->setLabelText(tr("Profile Name: ")); dialog->setLabelText(tr("Configuration Name: "));
dialog->setFixedSize(500, 100); dialog->setFixedSize(500, 100);
while (dialog->exec() != QDialog::Rejected) while (dialog->exec() != QDialog::Rejected)
{ {
const QString profile_name = dialog->textValue(); const QString config_name = dialog->textValue();
if (profile_name.isEmpty()) if (config_name.isEmpty())
{ {
QMessageBox::warning(this, tr("Error"), tr("Name cannot be empty")); QMessageBox::warning(this, tr("Error"), tr("Name cannot be empty"));
continue; continue;
} }
if (profile_name.contains(".")) if (config_name.contains("."))
{ {
QMessageBox::warning(this, tr("Error"), tr("Must choose a name without '.'")); QMessageBox::warning(this, tr("Error"), tr("Must choose a name without '.'"));
continue; continue;
} }
if (ui->chooseProfile->findText(profile_name) != -1) if (ui->chooseConfig->findText(config_name) != -1)
{ {
QMessageBox::warning(this, tr("Error"), tr("Please choose a non-existing name")); QMessageBox::warning(this, tr("Error"), tr("Please choose a non-existing name"));
continue; continue;
} }
if (CreateConfigFile(qstr(rpcs3::utils::get_input_config_dir(m_title_id)), profile_name)) if (CreateConfigFile(qstr(rpcs3::utils::get_input_config_dir(m_title_id)), config_name))
{ {
ui->chooseProfile->addItem(profile_name); ui->chooseConfig->addItem(config_name);
ui->chooseProfile->setCurrentText(profile_name); ui->chooseConfig->setCurrentText(config_name);
} }
break; break;
} }
@ -1864,12 +1864,12 @@ void pad_settings_dialog::SaveExit()
} }
} }
const std::string profile_key = m_title_id.empty() ? g_cfg_profile.global_key : m_title_id; const std::string config_file_key = m_title_id.empty() ? g_cfg_input_configs.global_key : m_title_id;
g_cfg_profile.active_profiles.set_value(profile_key, m_profile); g_cfg_input_configs.active_configs.set_value(config_file_key, m_config_file);
g_cfg_profile.save(); g_cfg_input_configs.save();
g_cfg_input.save(m_title_id, m_profile); g_cfg_input.save(m_title_id, m_config_file);
QDialog::accept(); QDialog::accept();
} }
@ -1877,7 +1877,7 @@ void pad_settings_dialog::SaveExit()
void pad_settings_dialog::CancelExit() void pad_settings_dialog::CancelExit()
{ {
// Reloads configs from file or defaults // Reloads configs from file or defaults
g_cfg_profile.load(); g_cfg_input_configs.load();
g_cfg_input.from_default(); g_cfg_input.from_default();
QDialog::reject(); QDialog::reject();

View file

@ -72,7 +72,7 @@ class pad_settings_dialog : public QDialog
id_reset_parameters, id_reset_parameters,
id_blacklist, id_blacklist,
id_refresh, id_refresh,
id_add_profile, id_add_config_file,
id_ok, id_ok,
id_cancel id_cancel
}; };
@ -97,10 +97,10 @@ private Q_SLOTS:
void OnTabChanged(int index); void OnTabChanged(int index);
void RefreshHandlers(); void RefreshHandlers();
void ChangeHandler(); void ChangeHandler();
void ChangeProfile(const QString& profile); void ChangeConfig(const QString& config_file);
void ChangeDevice(int index); void ChangeDevice(int index);
void HandleDeviceClassChange(u32 class_id) const; void HandleDeviceClassChange(u32 class_id) const;
void AddProfile(); void AddConfigFile();
/** Update the current player config with the GUI values. */ /** Update the current player config with the GUI values. */
void ApplyCurrentPlayerConfig(int new_player_id); void ApplyCurrentPlayerConfig(int new_player_id);
void RefreshPads(); void RefreshPads();
@ -147,7 +147,7 @@ private:
std::mutex m_handler_mutex; std::mutex m_handler_mutex;
std::string m_device_name; std::string m_device_name;
std::string m_buddy_device_name; std::string m_buddy_device_name;
std::string m_profile; std::string m_config_file;
QTimer m_timer_pad_refresh; QTimer m_timer_pad_refresh;
int m_last_player_id = 0; int m_last_player_id = 0;

View file

@ -147,11 +147,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="gb_profiles"> <widget class="QGroupBox" name="gb_config_files">
<property name="title"> <property name="title">
<string>Profiles</string> <string>Configuration Files</string>
</property> </property>
<layout class="QHBoxLayout" name="gb_profiles_layout"> <layout class="QHBoxLayout" name="gb_config_files_layout">
<property name="leftMargin"> <property name="leftMargin">
<number>5</number> <number>5</number>
</property> </property>
@ -165,12 +165,12 @@
<number>5</number> <number>5</number>
</property> </property>
<item> <item>
<widget class="QComboBox" name="chooseProfile"/> <widget class="QComboBox" name="chooseConfig"/>
</item> </item>
<item> <item>
<widget class="QPushButton" name="b_addProfile"> <widget class="QPushButton" name="b_addConfig">
<property name="text"> <property name="text">
<string>Add Profile</string> <string>Add Configuration</string>
</property> </property>
<property name="autoDefault"> <property name="autoDefault">
<bool>false</bool> <bool>false</bool>