Merge pull request #2521 from lioncash/naming
yuzu/configuration: Make function naming consistent
This commit is contained in:
commit
8d7a012297
|
@ -22,11 +22,11 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
||||||
&ConfigureAudio::setVolumeIndicatorText);
|
&ConfigureAudio::SetVolumeIndicatorText);
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureAudio::updateAudioDevices);
|
&ConfigureAudio::UpdateAudioDevices);
|
||||||
|
|
||||||
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
|
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
|
||||||
ui->output_sink_combo_box->setEnabled(!is_powered_on);
|
ui->output_sink_combo_box->setEnabled(!is_powered_on);
|
||||||
|
@ -35,20 +35,20 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
||||||
|
|
||||||
ConfigureAudio::~ConfigureAudio() = default;
|
ConfigureAudio::~ConfigureAudio() = default;
|
||||||
|
|
||||||
void ConfigureAudio::setConfiguration() {
|
void ConfigureAudio::SetConfiguration() {
|
||||||
setOutputSinkFromSinkID();
|
SetOutputSinkFromSinkID();
|
||||||
|
|
||||||
// The device list cannot be pre-populated (nor listed) until the output sink is known.
|
// The device list cannot be pre-populated (nor listed) until the output sink is known.
|
||||||
updateAudioDevices(ui->output_sink_combo_box->currentIndex());
|
UpdateAudioDevices(ui->output_sink_combo_box->currentIndex());
|
||||||
|
|
||||||
setAudioDeviceFromDeviceID();
|
SetAudioDeviceFromDeviceID();
|
||||||
|
|
||||||
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
|
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
|
||||||
ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum());
|
ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum());
|
||||||
setVolumeIndicatorText(ui->volume_slider->sliderPosition());
|
SetVolumeIndicatorText(ui->volume_slider->sliderPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::setOutputSinkFromSinkID() {
|
void ConfigureAudio::SetOutputSinkFromSinkID() {
|
||||||
int new_sink_index = 0;
|
int new_sink_index = 0;
|
||||||
|
|
||||||
const QString sink_id = QString::fromStdString(Settings::values.sink_id);
|
const QString sink_id = QString::fromStdString(Settings::values.sink_id);
|
||||||
|
@ -62,7 +62,7 @@ void ConfigureAudio::setOutputSinkFromSinkID() {
|
||||||
ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
|
ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::setAudioDeviceFromDeviceID() {
|
void ConfigureAudio::SetAudioDeviceFromDeviceID() {
|
||||||
int new_device_index = -1;
|
int new_device_index = -1;
|
||||||
|
|
||||||
const QString device_id = QString::fromStdString(Settings::values.audio_device_id);
|
const QString device_id = QString::fromStdString(Settings::values.audio_device_id);
|
||||||
|
@ -76,11 +76,11 @@ void ConfigureAudio::setAudioDeviceFromDeviceID() {
|
||||||
ui->audio_device_combo_box->setCurrentIndex(new_device_index);
|
ui->audio_device_combo_box->setCurrentIndex(new_device_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::setVolumeIndicatorText(int percentage) {
|
void ConfigureAudio::SetVolumeIndicatorText(int percentage) {
|
||||||
ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage));
|
ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::applyConfiguration() {
|
void ConfigureAudio::ApplyConfiguration() {
|
||||||
Settings::values.sink_id =
|
Settings::values.sink_id =
|
||||||
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
|
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
|
||||||
.toStdString();
|
.toStdString();
|
||||||
|
@ -92,7 +92,7 @@ void ConfigureAudio::applyConfiguration() {
|
||||||
static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum();
|
static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::updateAudioDevices(int sink_index) {
|
void ConfigureAudio::UpdateAudioDevices(int sink_index) {
|
||||||
ui->audio_device_combo_box->clear();
|
ui->audio_device_combo_box->clear();
|
||||||
ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name));
|
ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name));
|
||||||
|
|
||||||
|
@ -102,6 +102,6 @@ void ConfigureAudio::updateAudioDevices(int sink_index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::retranslateUi() {
|
void ConfigureAudio::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,16 @@ public:
|
||||||
explicit ConfigureAudio(QWidget* parent = nullptr);
|
explicit ConfigureAudio(QWidget* parent = nullptr);
|
||||||
~ConfigureAudio() override;
|
~ConfigureAudio() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateAudioDevices(int sink_index);
|
void UpdateAudioDevices(int sink_index);
|
||||||
|
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void setOutputSinkFromSinkID();
|
void SetOutputSinkFromSinkID();
|
||||||
void setAudioDeviceFromDeviceID();
|
void SetAudioDeviceFromDeviceID();
|
||||||
void setVolumeIndicatorText(int percentage);
|
void SetVolumeIndicatorText(int percentage);
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureAudio> ui;
|
std::unique_ptr<Ui::ConfigureAudio> ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
|
|
||||||
ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
|
ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
connect(ui->open_log_button, &QPushButton::pressed, []() {
|
connect(ui->open_log_button, &QPushButton::pressed, []() {
|
||||||
QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
|
QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
|
@ -25,7 +26,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
|
||||||
|
|
||||||
ConfigureDebug::~ConfigureDebug() = default;
|
ConfigureDebug::~ConfigureDebug() = default;
|
||||||
|
|
||||||
void ConfigureDebug::setConfiguration() {
|
void ConfigureDebug::SetConfiguration() {
|
||||||
ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
|
ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
|
||||||
ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub);
|
ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub);
|
||||||
ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
|
ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
|
||||||
|
@ -37,7 +38,7 @@ void ConfigureDebug::setConfiguration() {
|
||||||
ui->dump_decompressed_nso->setChecked(Settings::values.dump_nso);
|
ui->dump_decompressed_nso->setChecked(Settings::values.dump_nso);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDebug::applyConfiguration() {
|
void ConfigureDebug::ApplyConfiguration() {
|
||||||
Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
|
Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
|
||||||
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
|
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
|
||||||
UISettings::values.show_console = ui->toggle_console->isChecked();
|
UISettings::values.show_console = ui->toggle_console->isChecked();
|
||||||
|
|
|
@ -18,10 +18,10 @@ public:
|
||||||
explicit ConfigureDebug(QWidget* parent = nullptr);
|
explicit ConfigureDebug(QWidget* parent = nullptr);
|
||||||
~ConfigureDebug() override;
|
~ConfigureDebug() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureDebug> ui;
|
std::unique_ptr<Ui::ConfigureDebug> ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,11 +15,11 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry)
|
||||||
: QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) {
|
: QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->hotkeysTab->Populate(registry);
|
ui->hotkeysTab->Populate(registry);
|
||||||
this->setConfiguration();
|
|
||||||
this->PopulateSelectionList();
|
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
|
SetConfiguration();
|
||||||
|
PopulateSelectionList();
|
||||||
|
|
||||||
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
||||||
&ConfigureDialog::UpdateVisibleTabs);
|
&ConfigureDialog::UpdateVisibleTabs);
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry)
|
||||||
|
|
||||||
ConfigureDialog::~ConfigureDialog() = default;
|
ConfigureDialog::~ConfigureDialog() = default;
|
||||||
|
|
||||||
void ConfigureDialog::setConfiguration() {}
|
void ConfigureDialog::SetConfiguration() {}
|
||||||
|
|
||||||
void ConfigureDialog::applyConfiguration() {
|
void ConfigureDialog::ApplyConfiguration() {
|
||||||
ui->generalTab->applyConfiguration();
|
ui->generalTab->ApplyConfiguration();
|
||||||
ui->gameListTab->applyConfiguration();
|
ui->gameListTab->ApplyConfiguration();
|
||||||
ui->systemTab->applyConfiguration();
|
ui->systemTab->ApplyConfiguration();
|
||||||
ui->profileManagerTab->applyConfiguration();
|
ui->profileManagerTab->ApplyConfiguration();
|
||||||
ui->inputTab->applyConfiguration();
|
ui->inputTab->ApplyConfiguration();
|
||||||
ui->hotkeysTab->applyConfiguration(registry);
|
ui->hotkeysTab->ApplyConfiguration(registry);
|
||||||
ui->graphicsTab->applyConfiguration();
|
ui->graphicsTab->ApplyConfiguration();
|
||||||
ui->audioTab->applyConfiguration();
|
ui->audioTab->ApplyConfiguration();
|
||||||
ui->debugTab->applyConfiguration();
|
ui->debugTab->ApplyConfiguration();
|
||||||
ui->webTab->applyConfiguration();
|
ui->webTab->ApplyConfiguration();
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
Settings::LogSettings();
|
Settings::LogSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ public:
|
||||||
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry);
|
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry);
|
||||||
~ConfigureDialog() override;
|
~ConfigureDialog() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void UpdateVisibleTabs();
|
void UpdateVisibleTabs();
|
||||||
void PopulateSelectionList();
|
void PopulateSelectionList();
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,20 @@
|
||||||
#include "yuzu/ui_settings.h"
|
#include "yuzu/ui_settings.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr std::array<std::pair<u32, const char*>, 5> default_icon_sizes{{
|
constexpr std::array default_icon_sizes{
|
||||||
std::make_pair(0, QT_TR_NOOP("None")),
|
std::make_pair(0, QT_TR_NOOP("None")),
|
||||||
std::make_pair(32, QT_TR_NOOP("Small (32x32)")),
|
std::make_pair(32, QT_TR_NOOP("Small (32x32)")),
|
||||||
std::make_pair(64, QT_TR_NOOP("Standard (64x64)")),
|
std::make_pair(64, QT_TR_NOOP("Standard (64x64)")),
|
||||||
std::make_pair(128, QT_TR_NOOP("Large (128x128)")),
|
std::make_pair(128, QT_TR_NOOP("Large (128x128)")),
|
||||||
std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")),
|
std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")),
|
||||||
}};
|
};
|
||||||
|
|
||||||
constexpr std::array<const char*, 4> row_text_names{{
|
constexpr std::array row_text_names{
|
||||||
QT_TR_NOOP("Filename"),
|
QT_TR_NOOP("Filename"),
|
||||||
QT_TR_NOOP("Filetype"),
|
QT_TR_NOOP("Filetype"),
|
||||||
QT_TR_NOOP("Title ID"),
|
QT_TR_NOOP("Title ID"),
|
||||||
QT_TR_NOOP("Title Name"),
|
QT_TR_NOOP("Title Name"),
|
||||||
}};
|
};
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
ConfigureGameList::ConfigureGameList(QWidget* parent)
|
ConfigureGameList::ConfigureGameList(QWidget* parent)
|
||||||
|
@ -35,7 +35,7 @@ ConfigureGameList::ConfigureGameList(QWidget* parent)
|
||||||
InitializeIconSizeComboBox();
|
InitializeIconSizeComboBox();
|
||||||
InitializeRowComboBoxes();
|
InitializeRowComboBoxes();
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
// Force game list reload if any of the relevant settings are changed.
|
// Force game list reload if any of the relevant settings are changed.
|
||||||
connect(ui->show_unknown, &QCheckBox::stateChanged, this,
|
connect(ui->show_unknown, &QCheckBox::stateChanged, this,
|
||||||
|
@ -50,7 +50,7 @@ ConfigureGameList::ConfigureGameList(QWidget* parent)
|
||||||
|
|
||||||
ConfigureGameList::~ConfigureGameList() = default;
|
ConfigureGameList::~ConfigureGameList() = default;
|
||||||
|
|
||||||
void ConfigureGameList::applyConfiguration() {
|
void ConfigureGameList::ApplyConfiguration() {
|
||||||
UISettings::values.show_unknown = ui->show_unknown->isChecked();
|
UISettings::values.show_unknown = ui->show_unknown->isChecked();
|
||||||
UISettings::values.show_add_ons = ui->show_add_ons->isChecked();
|
UISettings::values.show_add_ons = ui->show_add_ons->isChecked();
|
||||||
UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt();
|
UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt();
|
||||||
|
@ -63,7 +63,7 @@ void ConfigureGameList::RequestGameListUpdate() {
|
||||||
UISettings::values.is_game_list_reload_pending.exchange(true);
|
UISettings::values.is_game_list_reload_pending.exchange(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGameList::setConfiguration() {
|
void ConfigureGameList::SetConfiguration() {
|
||||||
ui->show_unknown->setChecked(UISettings::values.show_unknown);
|
ui->show_unknown->setChecked(UISettings::values.show_unknown);
|
||||||
ui->show_add_ons->setChecked(UISettings::values.show_add_ons);
|
ui->show_add_ons->setChecked(UISettings::values.show_add_ons);
|
||||||
ui->icon_size_combobox->setCurrentIndex(
|
ui->icon_size_combobox->setCurrentIndex(
|
||||||
|
|
|
@ -18,12 +18,12 @@ public:
|
||||||
explicit ConfigureGameList(QWidget* parent = nullptr);
|
explicit ConfigureGameList(QWidget* parent = nullptr);
|
||||||
~ConfigureGameList() override;
|
~ConfigureGameList() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RequestGameListUpdate();
|
void RequestGameListUpdate();
|
||||||
|
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
void changeEvent(QEvent*) override;
|
void changeEvent(QEvent*) override;
|
||||||
void RetranslateUI();
|
void RetranslateUI();
|
||||||
|
|
|
@ -18,7 +18,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
||||||
QString::fromUtf8(theme.second));
|
QString::fromUtf8(theme.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this,
|
connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this,
|
||||||
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
||||||
|
@ -28,7 +28,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
||||||
|
|
||||||
ConfigureGeneral::~ConfigureGeneral() = default;
|
ConfigureGeneral::~ConfigureGeneral() = default;
|
||||||
|
|
||||||
void ConfigureGeneral::setConfiguration() {
|
void ConfigureGeneral::SetConfiguration() {
|
||||||
ui->toggle_deepscan->setChecked(UISettings::values.game_directory_deepscan);
|
ui->toggle_deepscan->setChecked(UISettings::values.game_directory_deepscan);
|
||||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
||||||
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot);
|
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot);
|
||||||
|
@ -36,7 +36,7 @@ void ConfigureGeneral::setConfiguration() {
|
||||||
ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGeneral::applyConfiguration() {
|
void ConfigureGeneral::ApplyConfiguration() {
|
||||||
UISettings::values.game_directory_deepscan = ui->toggle_deepscan->isChecked();
|
UISettings::values.game_directory_deepscan = ui->toggle_deepscan->isChecked();
|
||||||
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
||||||
UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
|
UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
|
||||||
|
|
|
@ -20,10 +20,10 @@ public:
|
||||||
explicit ConfigureGeneral(QWidget* parent = nullptr);
|
explicit ConfigureGeneral(QWidget* parent = nullptr);
|
||||||
~ConfigureGeneral() override;
|
~ConfigureGeneral() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,8 @@ Resolution FromResolutionFactor(float factor) {
|
||||||
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setConfiguration();
|
|
||||||
|
SetConfiguration();
|
||||||
|
|
||||||
connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled);
|
connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled);
|
||||||
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
||||||
|
@ -66,7 +67,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
|
|
||||||
ConfigureGraphics::~ConfigureGraphics() = default;
|
ConfigureGraphics::~ConfigureGraphics() = default;
|
||||||
|
|
||||||
void ConfigureGraphics::setConfiguration() {
|
void ConfigureGraphics::SetConfiguration() {
|
||||||
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
||||||
|
|
||||||
ui->resolution_factor_combobox->setCurrentIndex(
|
ui->resolution_factor_combobox->setCurrentIndex(
|
||||||
|
@ -87,7 +88,7 @@ void ConfigureGraphics::setConfiguration() {
|
||||||
Settings::values.bg_blue));
|
Settings::values.bg_blue));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::applyConfiguration() {
|
void ConfigureGraphics::ApplyConfiguration() {
|
||||||
Settings::values.resolution_factor =
|
Settings::values.resolution_factor =
|
||||||
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
||||||
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
||||||
|
|
|
@ -18,10 +18,10 @@ public:
|
||||||
explicit ConfigureGraphics(QWidget* parent = nullptr);
|
explicit ConfigureGraphics(QWidget* parent = nullptr);
|
||||||
~ConfigureGraphics() override;
|
~ConfigureGraphics() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
void UpdateBackgroundColorButton(QColor color);
|
void UpdateBackgroundColorButton(QColor color);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) {
|
void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
|
||||||
for (int key_id = 0; key_id < model->rowCount(); key_id++) {
|
for (int key_id = 0; key_id < model->rowCount(); key_id++) {
|
||||||
const QStandardItem* parent = model->item(key_id, 0);
|
const QStandardItem* parent = model->item(key_id, 0);
|
||||||
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
||||||
|
@ -113,6 +113,6 @@ void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) {
|
||||||
registry.SaveHotkeys();
|
registry.SaveHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureHotkeys::retranslateUi() {
|
void ConfigureHotkeys::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ public:
|
||||||
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
||||||
~ConfigureHotkeys() override;
|
~ConfigureHotkeys() override;
|
||||||
|
|
||||||
void applyConfiguration(HotkeyRegistry& registry);
|
void ApplyConfiguration(HotkeyRegistry& registry);
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the hotkey list widget using data from the provided registry.
|
* Populates the hotkey list widget using data from the provided registry.
|
||||||
|
|
|
@ -50,12 +50,12 @@ void OnDockedModeChanged(bool last_state, bool new_state) {
|
||||||
namespace {
|
namespace {
|
||||||
template <typename Dialog, typename... Args>
|
template <typename Dialog, typename... Args>
|
||||||
void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
|
void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
|
||||||
parent.applyConfiguration();
|
parent.ApplyConfiguration();
|
||||||
Dialog dialog(&parent, std::forward<Args>(args)...);
|
Dialog dialog(&parent, std::forward<Args>(args)...);
|
||||||
|
|
||||||
const auto res = dialog.exec();
|
const auto res = dialog.exec();
|
||||||
if (res == QDialog::Accepted) {
|
if (res == QDialog::Accepted) {
|
||||||
dialog.applyConfiguration();
|
dialog.ApplyConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
@ -79,24 +79,24 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||||
tr("Single Right Joycon"), tr("Single Left Joycon")});
|
tr("Single Right Joycon"), tr("Single Left Joycon")});
|
||||||
}
|
}
|
||||||
|
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
updateUIEnabled();
|
UpdateUIEnabled();
|
||||||
|
|
||||||
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
||||||
&ConfigureInput::restoreDefaults);
|
&ConfigureInput::RestoreDefaults);
|
||||||
|
|
||||||
for (auto* enabled : players_controller) {
|
for (auto* enabled : players_controller) {
|
||||||
connect(enabled, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(enabled, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureInput::updateUIEnabled);
|
&ConfigureInput::UpdateUIEnabled);
|
||||||
}
|
}
|
||||||
connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled);
|
connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled);
|
||||||
connect(ui->handheld_connected, &QCheckBox::stateChanged, this,
|
connect(ui->handheld_connected, &QCheckBox::stateChanged, this,
|
||||||
&ConfigureInput::updateUIEnabled);
|
&ConfigureInput::UpdateUIEnabled);
|
||||||
connect(ui->mouse_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled);
|
connect(ui->mouse_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled);
|
||||||
connect(ui->keyboard_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled);
|
connect(ui->keyboard_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled);
|
||||||
connect(ui->debug_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled);
|
connect(ui->debug_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled);
|
||||||
connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this,
|
connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this,
|
||||||
&ConfigureInput::updateUIEnabled);
|
&ConfigureInput::UpdateUIEnabled);
|
||||||
|
|
||||||
for (std::size_t i = 0; i < players_configure.size(); ++i) {
|
for (std::size_t i = 0; i < players_configure.size(); ++i) {
|
||||||
connect(players_configure[i], &QPushButton::pressed, this,
|
connect(players_configure[i], &QPushButton::pressed, this,
|
||||||
|
@ -118,7 +118,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||||
|
|
||||||
ConfigureInput::~ConfigureInput() = default;
|
ConfigureInput::~ConfigureInput() = default;
|
||||||
|
|
||||||
void ConfigureInput::applyConfiguration() {
|
void ConfigureInput::ApplyConfiguration() {
|
||||||
for (std::size_t i = 0; i < players_controller.size(); ++i) {
|
for (std::size_t i = 0; i < players_controller.size(); ++i) {
|
||||||
const auto controller_type_index = players_controller[i]->currentIndex();
|
const auto controller_type_index = players_controller[i]->currentIndex();
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ void ConfigureInput::applyConfiguration() {
|
||||||
Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked();
|
Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::updateUIEnabled() {
|
void ConfigureInput::UpdateUIEnabled() {
|
||||||
bool hit_disabled = false;
|
bool hit_disabled = false;
|
||||||
for (auto* player : players_controller) {
|
for (auto* player : players_controller) {
|
||||||
player->setDisabled(hit_disabled);
|
player->setDisabled(hit_disabled);
|
||||||
|
@ -168,7 +168,7 @@ void ConfigureInput::updateUIEnabled() {
|
||||||
ui->touchscreen_advanced->setEnabled(ui->touchscreen_enabled->isChecked());
|
ui->touchscreen_advanced->setEnabled(ui->touchscreen_enabled->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::loadConfiguration() {
|
void ConfigureInput::LoadConfiguration() {
|
||||||
std::stable_partition(
|
std::stable_partition(
|
||||||
Settings::values.players.begin(),
|
Settings::values.players.begin(),
|
||||||
Settings::values.players.begin() +
|
Settings::values.players.begin() +
|
||||||
|
@ -191,10 +191,10 @@ void ConfigureInput::loadConfiguration() {
|
||||||
ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled);
|
ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled);
|
||||||
ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled);
|
ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled);
|
||||||
|
|
||||||
updateUIEnabled();
|
UpdateUIEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::restoreDefaults() {
|
void ConfigureInput::RestoreDefaults() {
|
||||||
players_controller[0]->setCurrentIndex(2);
|
players_controller[0]->setCurrentIndex(2);
|
||||||
|
|
||||||
for (std::size_t i = 1; i < players_controller.size(); ++i) {
|
for (std::size_t i = 1; i < players_controller.size(); ++i) {
|
||||||
|
@ -207,5 +207,5 @@ void ConfigureInput::restoreDefaults() {
|
||||||
ui->keyboard_enabled->setCheckState(Qt::Unchecked);
|
ui->keyboard_enabled->setCheckState(Qt::Unchecked);
|
||||||
ui->debug_enabled->setCheckState(Qt::Unchecked);
|
ui->debug_enabled->setCheckState(Qt::Unchecked);
|
||||||
ui->touchscreen_enabled->setCheckState(Qt::Checked);
|
ui->touchscreen_enabled->setCheckState(Qt::Checked);
|
||||||
updateUIEnabled();
|
UpdateUIEnabled();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,15 @@ public:
|
||||||
~ConfigureInput() override;
|
~ConfigureInput() override;
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateUIEnabled();
|
void UpdateUIEnabled();
|
||||||
|
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
/// Restore all buttons to their default values.
|
/// Restore all buttons to their default values.
|
||||||
void restoreDefaults();
|
void RestoreDefaults();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureInput> ui;
|
std::unique_ptr<Ui::ConfigureInput> ui;
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
|
|
||||||
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button, &QPushButton::released, [=] {
|
connect(button, &QPushButton::released, [=] {
|
||||||
handleClick(
|
HandleClick(
|
||||||
button_map[button_id],
|
button_map[button_id],
|
||||||
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
||||||
InputCommon::Polling::DeviceType::Button);
|
InputCommon::Polling::DeviceType::Button);
|
||||||
|
@ -274,7 +274,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
|
|
||||||
analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(analog_button, &QPushButton::released, [=]() {
|
connect(analog_button, &QPushButton::released, [=]() {
|
||||||
handleClick(analog_map_buttons[analog_id][sub_button_id],
|
HandleClick(analog_map_buttons[analog_id][sub_button_id],
|
||||||
[=](const Common::ParamPackage& params) {
|
[=](const Common::ParamPackage& params) {
|
||||||
SetAnalogButton(params, analogs_param[analog_id],
|
SetAnalogButton(params, analogs_param[analog_id],
|
||||||
analog_sub_buttons[sub_button_id]);
|
analog_sub_buttons[sub_button_id]);
|
||||||
|
@ -304,7 +304,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
QMessageBox::information(this, tr("Information"),
|
QMessageBox::information(this, tr("Information"),
|
||||||
tr("After pressing OK, first move your joystick horizontally, "
|
tr("After pressing OK, first move your joystick horizontally, "
|
||||||
"and then vertically."));
|
"and then vertically."));
|
||||||
handleClick(
|
HandleClick(
|
||||||
analog_map_stick[analog_id],
|
analog_map_stick[analog_id],
|
||||||
[=](const Common::ParamPackage& params) { analogs_param[analog_id] = params; },
|
[=](const Common::ParamPackage& params) { analogs_param[analog_id] = params; },
|
||||||
InputCommon::Polling::DeviceType::Analog);
|
InputCommon::Polling::DeviceType::Analog);
|
||||||
|
@ -312,17 +312,17 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
||||||
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
|
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); });
|
||||||
|
|
||||||
timeout_timer->setSingleShot(true);
|
timeout_timer->setSingleShot(true);
|
||||||
connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); });
|
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
||||||
|
|
||||||
connect(poll_timer.get(), &QTimer::timeout, [this]() {
|
connect(poll_timer.get(), &QTimer::timeout, [this] {
|
||||||
Common::ParamPackage params;
|
Common::ParamPackage params;
|
||||||
for (auto& poller : device_pollers) {
|
for (auto& poller : device_pollers) {
|
||||||
params = poller->GetNextInput();
|
params = poller->GetNextInput();
|
||||||
if (params.Has("engine")) {
|
if (params.Has("engine")) {
|
||||||
setPollingResult(params, false);
|
SetPollingResult(params, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,8 +340,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
[this, i] { OnControllerButtonClick(static_cast<int>(i)); });
|
[this, i] { OnControllerButtonClick(static_cast<int>(i)); });
|
||||||
}
|
}
|
||||||
|
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
this->resize(0, 0);
|
resize(0, 0);
|
||||||
|
|
||||||
// TODO(wwylele): enable this when we actually emulate it
|
// TODO(wwylele): enable this when we actually emulate it
|
||||||
ui->buttonHome->setEnabled(false);
|
ui->buttonHome->setEnabled(false);
|
||||||
|
@ -349,7 +349,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
|
|
||||||
ConfigureInputPlayer::~ConfigureInputPlayer() = default;
|
ConfigureInputPlayer::~ConfigureInputPlayer() = default;
|
||||||
|
|
||||||
void ConfigureInputPlayer::applyConfiguration() {
|
void ConfigureInputPlayer::ApplyConfiguration() {
|
||||||
auto& buttons =
|
auto& buttons =
|
||||||
debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons;
|
debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons;
|
||||||
auto& analogs =
|
auto& analogs =
|
||||||
|
@ -382,7 +382,7 @@ void ConfigureInputPlayer::OnControllerButtonClick(int i) {
|
||||||
QStringLiteral("QPushButton { background-color: %1 }").arg(controller_colors[i].name()));
|
QStringLiteral("QPushButton { background-color: %1 }").arg(controller_colors[i].name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::loadConfiguration() {
|
void ConfigureInputPlayer::LoadConfiguration() {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
std::transform(Settings::values.debug_pad_buttons.begin(),
|
std::transform(Settings::values.debug_pad_buttons.begin(),
|
||||||
Settings::values.debug_pad_buttons.end(), buttons_param.begin(),
|
Settings::values.debug_pad_buttons.end(), buttons_param.begin(),
|
||||||
|
@ -399,7 +399,7 @@ void ConfigureInputPlayer::loadConfiguration() {
|
||||||
[](const std::string& str) { return Common::ParamPackage(str); });
|
[](const std::string& str) { return Common::ParamPackage(str); });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
return;
|
return;
|
||||||
|
@ -421,7 +421,7 @@ void ConfigureInputPlayer::loadConfiguration() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::restoreDefaults() {
|
void ConfigureInputPlayer::RestoreDefaults() {
|
||||||
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
|
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
|
||||||
buttons_param[button_id] = Common::ParamPackage{
|
buttons_param[button_id] = Common::ParamPackage{
|
||||||
InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])};
|
InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])};
|
||||||
|
@ -434,7 +434,7 @@ void ConfigureInputPlayer::restoreDefaults() {
|
||||||
SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
|
SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::ClearAll() {
|
void ConfigureInputPlayer::ClearAll() {
|
||||||
|
@ -458,10 +458,10 @@ void ConfigureInputPlayer::ClearAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::updateButtonLabels() {
|
void ConfigureInputPlayer::UpdateButtonLabels() {
|
||||||
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
|
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
|
||||||
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ void ConfigureInputPlayer::updateButtonLabels() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::handleClick(
|
void ConfigureInputPlayer::HandleClick(
|
||||||
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||||
InputCommon::Polling::DeviceType type) {
|
InputCommon::Polling::DeviceType type) {
|
||||||
button->setText(tr("[press key]"));
|
button->setText(tr("[press key]"));
|
||||||
|
@ -509,7 +509,7 @@ void ConfigureInputPlayer::handleClick(
|
||||||
poll_timer->start(200); // Check for new inputs every 200ms
|
poll_timer->start(200); // Check for new inputs every 200ms
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::setPollingResult(const Common::ParamPackage& params, bool abort) {
|
void ConfigureInputPlayer::SetPollingResult(const Common::ParamPackage& params, bool abort) {
|
||||||
releaseKeyboard();
|
releaseKeyboard();
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
timeout_timer->stop();
|
timeout_timer->stop();
|
||||||
|
@ -522,22 +522,23 @@ void ConfigureInputPlayer::setPollingResult(const Common::ParamPackage& params,
|
||||||
(*input_setter)(params);
|
(*input_setter)(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
input_setter = std::nullopt;
|
input_setter = std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
|
void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
|
||||||
if (!input_setter || !event)
|
if (!input_setter || !event) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->key() != Qt::Key_Escape) {
|
if (event->key() != Qt::Key_Escape) {
|
||||||
if (want_keyboard_keys) {
|
if (want_keyboard_keys) {
|
||||||
setPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())},
|
SetPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())},
|
||||||
false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
// Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling
|
// Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPollingResult({}, true);
|
SetPollingResult({}, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,28 +38,28 @@ public:
|
||||||
~ConfigureInputPlayer() override;
|
~ConfigureInputPlayer() override;
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnControllerButtonClick(int i);
|
void OnControllerButtonClick(int i);
|
||||||
|
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
/// Restore all buttons to their default values.
|
/// Restore all buttons to their default values.
|
||||||
void restoreDefaults();
|
void RestoreDefaults();
|
||||||
/// Clear all input configuration
|
/// Clear all input configuration
|
||||||
void ClearAll();
|
void ClearAll();
|
||||||
|
|
||||||
/// Update UI to reflect current configuration.
|
/// Update UI to reflect current configuration.
|
||||||
void updateButtonLabels();
|
void UpdateButtonLabels();
|
||||||
|
|
||||||
/// Called when the button was pressed.
|
/// Called when the button was pressed.
|
||||||
void handleClick(QPushButton* button,
|
void HandleClick(QPushButton* button,
|
||||||
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||||
InputCommon::Polling::DeviceType type);
|
InputCommon::Polling::DeviceType type);
|
||||||
|
|
||||||
/// Finish polling and configure input using the input_setter
|
/// Finish polling and configure input using the input_setter
|
||||||
void setPollingResult(const Common::ParamPackage& params, bool abort);
|
void SetPollingResult(const Common::ParamPackage& params, bool abort);
|
||||||
|
|
||||||
/// Handle key press events.
|
/// Handle key press events.
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
|
|
@ -15,12 +15,12 @@ namespace {
|
||||||
|
|
||||||
template <typename Dialog, typename... Args>
|
template <typename Dialog, typename... Args>
|
||||||
void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) {
|
void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) {
|
||||||
caller->applyConfiguration();
|
caller->ApplyConfiguration();
|
||||||
Dialog dialog(caller, std::forward<Args>(args)...);
|
Dialog dialog(caller, std::forward<Args>(args)...);
|
||||||
|
|
||||||
const auto res = dialog.exec();
|
const auto res = dialog.exec();
|
||||||
if (res == QDialog::Accepted) {
|
if (res == QDialog::Accepted) {
|
||||||
dialog.applyConfiguration();
|
dialog.ApplyConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,27 +103,29 @@ ConfigureInputSimple::ConfigureInputSimple(QWidget* parent)
|
||||||
&ConfigureInputSimple::OnSelectProfile);
|
&ConfigureInputSimple::OnSelectProfile);
|
||||||
connect(ui->profile_configure, &QPushButton::pressed, this, &ConfigureInputSimple::OnConfigure);
|
connect(ui->profile_configure, &QPushButton::pressed, this, &ConfigureInputSimple::OnConfigure);
|
||||||
|
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureInputSimple::~ConfigureInputSimple() = default;
|
ConfigureInputSimple::~ConfigureInputSimple() = default;
|
||||||
|
|
||||||
void ConfigureInputSimple::applyConfiguration() {
|
void ConfigureInputSimple::ApplyConfiguration() {
|
||||||
auto index = ui->profile_combobox->currentIndex();
|
auto index = ui->profile_combobox->currentIndex();
|
||||||
// Make the stored index for "Custom" very large so that if new profiles are added it
|
// Make the stored index for "Custom" very large so that if new profiles are added it
|
||||||
// doesn't change.
|
// doesn't change.
|
||||||
if (index >= static_cast<int>(INPUT_PROFILES.size() - 1))
|
if (index >= static_cast<int>(INPUT_PROFILES.size() - 1)) {
|
||||||
index = std::numeric_limits<int>::max();
|
index = std::numeric_limits<int>::max();
|
||||||
|
}
|
||||||
|
|
||||||
UISettings::values.profile_index = index;
|
UISettings::values.profile_index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputSimple::loadConfiguration() {
|
void ConfigureInputSimple::LoadConfiguration() {
|
||||||
const auto index = UISettings::values.profile_index;
|
const auto index = UISettings::values.profile_index;
|
||||||
if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0)
|
if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0) {
|
||||||
ui->profile_combobox->setCurrentIndex(static_cast<int>(INPUT_PROFILES.size() - 1));
|
ui->profile_combobox->setCurrentIndex(static_cast<int>(INPUT_PROFILES.size() - 1));
|
||||||
else
|
} else {
|
||||||
ui->profile_combobox->setCurrentIndex(index);
|
ui->profile_combobox->setCurrentIndex(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputSimple::OnSelectProfile(int index) {
|
void ConfigureInputSimple::OnSelectProfile(int index) {
|
||||||
|
|
|
@ -27,11 +27,11 @@ public:
|
||||||
~ConfigureInputSimple() override;
|
~ConfigureInputSimple() override;
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
|
|
||||||
void OnSelectProfile(int index);
|
void OnSelectProfile(int index);
|
||||||
void OnConfigure();
|
void OnConfigure();
|
||||||
|
|
|
@ -84,7 +84,7 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
|
||||||
|
|
||||||
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button, &QPushButton::released, [=] {
|
connect(button, &QPushButton::released, [=] {
|
||||||
handleClick(
|
HandleClick(
|
||||||
button_map[button_id],
|
button_map[button_id],
|
||||||
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
||||||
InputCommon::Polling::DeviceType::Button);
|
InputCommon::Polling::DeviceType::Button);
|
||||||
|
@ -105,48 +105,48 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
||||||
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
|
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); });
|
||||||
|
|
||||||
timeout_timer->setSingleShot(true);
|
timeout_timer->setSingleShot(true);
|
||||||
connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); });
|
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
||||||
|
|
||||||
connect(poll_timer.get(), &QTimer::timeout, [this]() {
|
connect(poll_timer.get(), &QTimer::timeout, [this] {
|
||||||
Common::ParamPackage params;
|
Common::ParamPackage params;
|
||||||
for (auto& poller : device_pollers) {
|
for (auto& poller : device_pollers) {
|
||||||
params = poller->GetNextInput();
|
params = poller->GetNextInput();
|
||||||
if (params.Has("engine")) {
|
if (params.Has("engine")) {
|
||||||
setPollingResult(params, false);
|
SetPollingResult(params, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadConfiguration();
|
LoadConfiguration();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureMouseAdvanced::~ConfigureMouseAdvanced() = default;
|
ConfigureMouseAdvanced::~ConfigureMouseAdvanced() = default;
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::applyConfiguration() {
|
void ConfigureMouseAdvanced::ApplyConfiguration() {
|
||||||
std::transform(buttons_param.begin(), buttons_param.end(),
|
std::transform(buttons_param.begin(), buttons_param.end(),
|
||||||
Settings::values.mouse_buttons.begin(),
|
Settings::values.mouse_buttons.begin(),
|
||||||
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::loadConfiguration() {
|
void ConfigureMouseAdvanced::LoadConfiguration() {
|
||||||
std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(),
|
std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(),
|
||||||
buttons_param.begin(),
|
buttons_param.begin(),
|
||||||
[](const std::string& str) { return Common::ParamPackage(str); });
|
[](const std::string& str) { return Common::ParamPackage(str); });
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::restoreDefaults() {
|
void ConfigureMouseAdvanced::RestoreDefaults() {
|
||||||
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) {
|
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) {
|
||||||
buttons_param[button_id] = Common::ParamPackage{
|
buttons_param[button_id] = Common::ParamPackage{
|
||||||
InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])};
|
InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])};
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::ClearAll() {
|
void ConfigureMouseAdvanced::ClearAll() {
|
||||||
|
@ -157,16 +157,16 @@ void ConfigureMouseAdvanced::ClearAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::updateButtonLabels() {
|
void ConfigureMouseAdvanced::UpdateButtonLabels() {
|
||||||
for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; button++) {
|
for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; button++) {
|
||||||
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::handleClick(
|
void ConfigureMouseAdvanced::HandleClick(
|
||||||
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||||
InputCommon::Polling::DeviceType type) {
|
InputCommon::Polling::DeviceType type) {
|
||||||
button->setText(tr("[press key]"));
|
button->setText(tr("[press key]"));
|
||||||
|
@ -194,7 +194,7 @@ void ConfigureMouseAdvanced::handleClick(
|
||||||
poll_timer->start(200); // Check for new inputs every 200ms
|
poll_timer->start(200); // Check for new inputs every 200ms
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::setPollingResult(const Common::ParamPackage& params, bool abort) {
|
void ConfigureMouseAdvanced::SetPollingResult(const Common::ParamPackage& params, bool abort) {
|
||||||
releaseKeyboard();
|
releaseKeyboard();
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
timeout_timer->stop();
|
timeout_timer->stop();
|
||||||
|
@ -207,22 +207,23 @@ void ConfigureMouseAdvanced::setPollingResult(const Common::ParamPackage& params
|
||||||
(*input_setter)(params);
|
(*input_setter)(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
input_setter = std::nullopt;
|
input_setter = std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMouseAdvanced::keyPressEvent(QKeyEvent* event) {
|
void ConfigureMouseAdvanced::keyPressEvent(QKeyEvent* event) {
|
||||||
if (!input_setter || !event)
|
if (!input_setter || !event) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->key() != Qt::Key_Escape) {
|
if (event->key() != Qt::Key_Escape) {
|
||||||
if (want_keyboard_keys) {
|
if (want_keyboard_keys) {
|
||||||
setPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())},
|
SetPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())},
|
||||||
false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
// Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling
|
// Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPollingResult({}, true);
|
SetPollingResult({}, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,26 +25,26 @@ public:
|
||||||
explicit ConfigureMouseAdvanced(QWidget* parent);
|
explicit ConfigureMouseAdvanced(QWidget* parent);
|
||||||
~ConfigureMouseAdvanced() override;
|
~ConfigureMouseAdvanced() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
/// Restore all buttons to their default values.
|
/// Restore all buttons to their default values.
|
||||||
void restoreDefaults();
|
void RestoreDefaults();
|
||||||
/// Clear all input configuration
|
/// Clear all input configuration
|
||||||
void ClearAll();
|
void ClearAll();
|
||||||
|
|
||||||
/// Update UI to reflect current configuration.
|
/// Update UI to reflect current configuration.
|
||||||
void updateButtonLabels();
|
void UpdateButtonLabels();
|
||||||
|
|
||||||
/// Called when the button was pressed.
|
/// Called when the button was pressed.
|
||||||
void handleClick(QPushButton* button,
|
void HandleClick(QPushButton* button,
|
||||||
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||||
InputCommon::Polling::DeviceType type);
|
InputCommon::Polling::DeviceType type);
|
||||||
|
|
||||||
/// Finish polling and configure input using the input_setter
|
/// Finish polling and configure input using the input_setter
|
||||||
void setPollingResult(const Common::ParamPackage& params, bool abort);
|
void SetPollingResult(const Common::ParamPackage& params, bool abort);
|
||||||
|
|
||||||
/// Handle key press events.
|
/// Handle key press events.
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
|
|
@ -67,12 +67,12 @@ ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent, u64 title_id)
|
||||||
connect(item_model, &QStandardItemModel::itemChanged,
|
connect(item_model, &QStandardItemModel::itemChanged,
|
||||||
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
||||||
|
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default;
|
ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default;
|
||||||
|
|
||||||
void ConfigurePerGameGeneral::applyConfiguration() {
|
void ConfigurePerGameGeneral::ApplyConfiguration() {
|
||||||
std::vector<std::string> disabled_addons;
|
std::vector<std::string> disabled_addons;
|
||||||
|
|
||||||
for (const auto& item : list_items) {
|
for (const auto& item : list_items) {
|
||||||
|
@ -92,12 +92,12 @@ void ConfigurePerGameGeneral::applyConfiguration() {
|
||||||
Settings::values.disabled_addons[title_id] = disabled_addons;
|
Settings::values.disabled_addons[title_id] = disabled_addons;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurePerGameGeneral::loadFromFile(FileSys::VirtualFile file) {
|
void ConfigurePerGameGeneral::LoadFromFile(FileSys::VirtualFile file) {
|
||||||
this->file = std::move(file);
|
this->file = std::move(file);
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurePerGameGeneral::loadConfiguration() {
|
void ConfigurePerGameGeneral::LoadConfiguration() {
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,13 @@ public:
|
||||||
~ConfigurePerGameGeneral() override;
|
~ConfigurePerGameGeneral() override;
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
void loadFromFile(FileSys::VirtualFile file);
|
void LoadFromFile(FileSys::VirtualFile file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void LoadConfiguration();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigurePerGameGeneral> ui;
|
std::unique_ptr<Ui::ConfigurePerGameGeneral> ui;
|
||||||
FileSys::VirtualFile file;
|
FileSys::VirtualFile file;
|
||||||
u64 title_id;
|
u64 title_id;
|
||||||
|
@ -45,6 +47,4 @@ private:
|
||||||
QGraphicsScene* scene;
|
QGraphicsScene* scene;
|
||||||
|
|
||||||
std::vector<QList<QStandardItem*>> list_items;
|
std::vector<QList<QStandardItem*>> list_items;
|
||||||
|
|
||||||
void loadConfiguration();
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -119,12 +119,12 @@ ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent)
|
||||||
scene = new QGraphicsScene;
|
scene = new QGraphicsScene;
|
||||||
ui->current_user_icon->setScene(scene);
|
ui->current_user_icon->setScene(scene);
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureProfileManager::~ConfigureProfileManager() = default;
|
ConfigureProfileManager::~ConfigureProfileManager() = default;
|
||||||
|
|
||||||
void ConfigureProfileManager::setConfiguration() {
|
void ConfigureProfileManager::SetConfiguration() {
|
||||||
enabled = !Core::System::GetInstance().IsPoweredOn();
|
enabled = !Core::System::GetInstance().IsPoweredOn();
|
||||||
item_model->removeRows(0, item_model->rowCount());
|
item_model->removeRows(0, item_model->rowCount());
|
||||||
list_items.clear();
|
list_items.clear();
|
||||||
|
@ -164,9 +164,10 @@ void ConfigureProfileManager::UpdateCurrentUser() {
|
||||||
ui->current_user_username->setText(username);
|
ui->current_user_username->setText(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureProfileManager::applyConfiguration() {
|
void ConfigureProfileManager::ApplyConfiguration() {
|
||||||
if (!enabled)
|
if (!enabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,11 @@ public:
|
||||||
explicit ConfigureProfileManager(QWidget* parent = nullptr);
|
explicit ConfigureProfileManager(QWidget* parent = nullptr);
|
||||||
~ConfigureProfileManager() override;
|
~ConfigureProfileManager() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void setConfiguration();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetConfiguration();
|
||||||
|
|
||||||
void PopulateUserList();
|
void PopulateUserList();
|
||||||
void UpdateCurrentUser();
|
void UpdateCurrentUser();
|
||||||
|
|
||||||
|
|
|
@ -23,22 +23,24 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
|
||||||
|
|
||||||
connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
|
connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
|
||||||
ui->rng_seed_edit->setEnabled(checked);
|
ui->rng_seed_edit->setEnabled(checked);
|
||||||
if (!checked)
|
if (!checked) {
|
||||||
ui->rng_seed_edit->setText(QStringLiteral("00000000"));
|
ui->rng_seed_edit->setText(QStringLiteral("00000000"));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
|
connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
|
||||||
ui->custom_rtc_edit->setEnabled(checked);
|
ui->custom_rtc_edit->setEnabled(checked);
|
||||||
if (!checked)
|
if (!checked) {
|
||||||
ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime());
|
ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureSystem::~ConfigureSystem() = default;
|
ConfigureSystem::~ConfigureSystem() = default;
|
||||||
|
|
||||||
void ConfigureSystem::setConfiguration() {
|
void ConfigureSystem::SetConfiguration() {
|
||||||
enabled = !Core::System::GetInstance().IsPoweredOn();
|
enabled = !Core::System::GetInstance().IsPoweredOn();
|
||||||
|
|
||||||
ui->combo_language->setCurrentIndex(Settings::values.language_index);
|
ui->combo_language->setCurrentIndex(Settings::values.language_index);
|
||||||
|
@ -61,22 +63,25 @@ void ConfigureSystem::setConfiguration() {
|
||||||
|
|
||||||
void ConfigureSystem::ReadSystemSettings() {}
|
void ConfigureSystem::ReadSystemSettings() {}
|
||||||
|
|
||||||
void ConfigureSystem::applyConfiguration() {
|
void ConfigureSystem::ApplyConfiguration() {
|
||||||
if (!enabled)
|
if (!enabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Settings::values.language_index = ui->combo_language->currentIndex();
|
Settings::values.language_index = ui->combo_language->currentIndex();
|
||||||
|
|
||||||
if (ui->rng_seed_checkbox->isChecked())
|
if (ui->rng_seed_checkbox->isChecked()) {
|
||||||
Settings::values.rng_seed = ui->rng_seed_edit->text().toULongLong(nullptr, 16);
|
Settings::values.rng_seed = ui->rng_seed_edit->text().toULongLong(nullptr, 16);
|
||||||
else
|
} else {
|
||||||
Settings::values.rng_seed = std::nullopt;
|
Settings::values.rng_seed = std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
if (ui->custom_rtc_checkbox->isChecked())
|
if (ui->custom_rtc_checkbox->isChecked()) {
|
||||||
Settings::values.custom_rtc =
|
Settings::values.custom_rtc =
|
||||||
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
|
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
|
||||||
else
|
} else {
|
||||||
Settings::values.custom_rtc = std::nullopt;
|
Settings::values.custom_rtc = std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
@ -89,8 +94,10 @@ void ConfigureSystem::RefreshConsoleID() {
|
||||||
"if you use an outdated config savegame. Continue?");
|
"if you use an outdated config savegame. Continue?");
|
||||||
reply = QMessageBox::critical(this, tr("Warning"), warning_text,
|
reply = QMessageBox::critical(this, tr("Warning"), warning_text,
|
||||||
QMessageBox::No | QMessageBox::Yes);
|
QMessageBox::No | QMessageBox::Yes);
|
||||||
if (reply == QMessageBox::No)
|
if (reply == QMessageBox::No) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
u64 console_id{};
|
u64 console_id{};
|
||||||
ui->label_console_id->setText(
|
ui->label_console_id->setText(
|
||||||
tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
|
tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
|
||||||
|
|
|
@ -20,10 +20,11 @@ public:
|
||||||
explicit ConfigureSystem(QWidget* parent = nullptr);
|
explicit ConfigureSystem(QWidget* parent = nullptr);
|
||||||
~ConfigureSystem() override;
|
~ConfigureSystem() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void setConfiguration();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetConfiguration();
|
||||||
|
|
||||||
void ReadSystemSettings();
|
void ReadSystemSettings();
|
||||||
|
|
||||||
void RefreshConsoleID();
|
void RefreshConsoleID();
|
||||||
|
|
|
@ -12,29 +12,29 @@ ConfigureTouchscreenAdvanced::ConfigureTouchscreenAdvanced(QWidget* parent)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
||||||
&ConfigureTouchscreenAdvanced::restoreDefaults);
|
&ConfigureTouchscreenAdvanced::RestoreDefaults);
|
||||||
|
|
||||||
loadConfiguration();
|
LoadConfiguration();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureTouchscreenAdvanced::~ConfigureTouchscreenAdvanced() = default;
|
ConfigureTouchscreenAdvanced::~ConfigureTouchscreenAdvanced() = default;
|
||||||
|
|
||||||
void ConfigureTouchscreenAdvanced::applyConfiguration() {
|
void ConfigureTouchscreenAdvanced::ApplyConfiguration() {
|
||||||
Settings::values.touchscreen.finger = ui->finger_box->value();
|
Settings::values.touchscreen.finger = ui->finger_box->value();
|
||||||
Settings::values.touchscreen.diameter_x = ui->diameter_x_box->value();
|
Settings::values.touchscreen.diameter_x = ui->diameter_x_box->value();
|
||||||
Settings::values.touchscreen.diameter_y = ui->diameter_y_box->value();
|
Settings::values.touchscreen.diameter_y = ui->diameter_y_box->value();
|
||||||
Settings::values.touchscreen.rotation_angle = ui->angle_box->value();
|
Settings::values.touchscreen.rotation_angle = ui->angle_box->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureTouchscreenAdvanced::loadConfiguration() {
|
void ConfigureTouchscreenAdvanced::LoadConfiguration() {
|
||||||
ui->finger_box->setValue(Settings::values.touchscreen.finger);
|
ui->finger_box->setValue(Settings::values.touchscreen.finger);
|
||||||
ui->diameter_x_box->setValue(Settings::values.touchscreen.diameter_x);
|
ui->diameter_x_box->setValue(Settings::values.touchscreen.diameter_x);
|
||||||
ui->diameter_y_box->setValue(Settings::values.touchscreen.diameter_y);
|
ui->diameter_y_box->setValue(Settings::values.touchscreen.diameter_y);
|
||||||
ui->angle_box->setValue(Settings::values.touchscreen.rotation_angle);
|
ui->angle_box->setValue(Settings::values.touchscreen.rotation_angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureTouchscreenAdvanced::restoreDefaults() {
|
void ConfigureTouchscreenAdvanced::RestoreDefaults() {
|
||||||
ui->finger_box->setValue(0);
|
ui->finger_box->setValue(0);
|
||||||
ui->diameter_x_box->setValue(15);
|
ui->diameter_x_box->setValue(15);
|
||||||
ui->diameter_y_box->setValue(15);
|
ui->diameter_y_box->setValue(15);
|
||||||
|
|
|
@ -18,13 +18,13 @@ public:
|
||||||
explicit ConfigureTouchscreenAdvanced(QWidget* parent);
|
explicit ConfigureTouchscreenAdvanced(QWidget* parent);
|
||||||
~ConfigureTouchscreenAdvanced() override;
|
~ConfigureTouchscreenAdvanced() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
/// Restore all buttons to their default values.
|
/// Restore all buttons to their default values.
|
||||||
void restoreDefaults();
|
void RestoreDefaults();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureTouchscreenAdvanced> ui;
|
std::unique_ptr<Ui::ConfigureTouchscreenAdvanced> ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,12 +22,12 @@ ConfigureWeb::ConfigureWeb(QWidget* parent)
|
||||||
#ifndef USE_DISCORD_PRESENCE
|
#ifndef USE_DISCORD_PRESENCE
|
||||||
ui->discord_group->setVisible(false);
|
ui->discord_group->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureWeb::~ConfigureWeb() = default;
|
ConfigureWeb::~ConfigureWeb() = default;
|
||||||
|
|
||||||
void ConfigureWeb::setConfiguration() {
|
void ConfigureWeb::SetConfiguration() {
|
||||||
ui->web_credentials_disclaimer->setWordWrap(true);
|
ui->web_credentials_disclaimer->setWordWrap(true);
|
||||||
ui->telemetry_learn_more->setOpenExternalLinks(true);
|
ui->telemetry_learn_more->setOpenExternalLinks(true);
|
||||||
ui->telemetry_learn_more->setText(
|
ui->telemetry_learn_more->setText(
|
||||||
|
@ -56,7 +56,7 @@ void ConfigureWeb::setConfiguration() {
|
||||||
ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence);
|
ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureWeb::applyConfiguration() {
|
void ConfigureWeb::ApplyConfiguration() {
|
||||||
Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked();
|
Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked();
|
||||||
UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked();
|
UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked();
|
||||||
if (user_verified) {
|
if (user_verified) {
|
||||||
|
@ -121,6 +121,6 @@ void ConfigureWeb::OnLoginVerified() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureWeb::retranslateUi() {
|
void ConfigureWeb::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ public:
|
||||||
explicit ConfigureWeb(QWidget* parent = nullptr);
|
explicit ConfigureWeb(QWidget* parent = nullptr);
|
||||||
~ConfigureWeb() override;
|
~ConfigureWeb() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RefreshTelemetryID();
|
void RefreshTelemetryID();
|
||||||
|
@ -28,7 +28,7 @@ private:
|
||||||
void VerifyLogin();
|
void VerifyLogin();
|
||||||
void OnLoginVerified();
|
void OnLoginVerified();
|
||||||
|
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
bool user_verified = true;
|
bool user_verified = true;
|
||||||
QFutureWatcher<bool> verify_watcher;
|
QFutureWatcher<bool> verify_watcher;
|
||||||
|
|
|
@ -1289,10 +1289,10 @@ void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurePerGameGeneral dialog(this, title_id);
|
ConfigurePerGameGeneral dialog(this, title_id);
|
||||||
dialog.loadFromFile(v_file);
|
dialog.LoadFromFile(v_file);
|
||||||
auto result = dialog.exec();
|
auto result = dialog.exec();
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
dialog.applyConfiguration();
|
dialog.ApplyConfiguration();
|
||||||
|
|
||||||
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
||||||
if (reload) {
|
if (reload) {
|
||||||
|
@ -1683,17 +1683,23 @@ void GMainWindow::ToggleWindowMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
ConfigureDialog configureDialog(this, hotkey_registry);
|
const auto old_theme = UISettings::values.theme;
|
||||||
auto old_theme = UISettings::values.theme;
|
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
auto result = configureDialog.exec();
|
|
||||||
if (result == QDialog::Accepted) {
|
ConfigureDialog configure_dialog(this, hotkey_registry);
|
||||||
configureDialog.applyConfiguration();
|
const auto result = configure_dialog.exec();
|
||||||
|
if (result != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_dialog.ApplyConfiguration();
|
||||||
InitializeHotkeys();
|
InitializeHotkeys();
|
||||||
if (UISettings::values.theme != old_theme)
|
if (UISettings::values.theme != old_theme) {
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
if (UISettings::values.enable_discord_presence != old_discord_presence)
|
}
|
||||||
|
if (UISettings::values.enable_discord_presence != old_discord_presence) {
|
||||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
||||||
|
}
|
||||||
|
|
||||||
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
||||||
if (reload) {
|
if (reload) {
|
||||||
|
@ -1702,7 +1708,6 @@ void GMainWindow::OnConfigure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnLoadAmiibo() {
|
void GMainWindow::OnLoadAmiibo() {
|
||||||
|
|
Loading…
Reference in a new issue