mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
yuzu/configuration: Make function naming consistent
This commit is contained in:
parent
cae913d3d5
commit
ba6eb5285d
@ -30,7 +30,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
|||||||
ui->emulation_combo_box->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->emulation_combo_box->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
|
|
||||||
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
||||||
&ConfigureAudio::setVolumeIndicatorText);
|
&ConfigureAudio::SetVolumeIndicatorText);
|
||||||
|
|
||||||
ui->input_device_combo_box->clear();
|
ui->input_device_combo_box->clear();
|
||||||
ui->input_device_combo_box->addItem(tr("Default"));
|
ui->input_device_combo_box->addItem(tr("Default"));
|
||||||
@ -40,26 +40,26 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
connect(ui->input_type_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
connect(ui->input_type_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureAudio::updateAudioInputDevices);
|
&ConfigureAudio::UpdateAudioInputDevices);
|
||||||
|
|
||||||
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::updateAudioOutputDevices);
|
&ConfigureAudio::UpdateAudioOutputDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureAudio::~ConfigureAudio() {}
|
ConfigureAudio::~ConfigureAudio() {}
|
||||||
|
|
||||||
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.
|
||||||
updateAudioOutputDevices(ui->output_sink_combo_box->currentIndex());
|
UpdateAudioOutputDevices(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());
|
||||||
|
|
||||||
int selection;
|
int selection;
|
||||||
if (Settings::values.enable_dsp_lle) {
|
if (Settings::values.enable_dsp_lle) {
|
||||||
@ -77,10 +77,10 @@ void ConfigureAudio::setConfiguration() {
|
|||||||
ui->input_type_combo_box->setCurrentIndex(index);
|
ui->input_type_combo_box->setCurrentIndex(index);
|
||||||
ui->input_device_combo_box->setCurrentText(
|
ui->input_device_combo_box->setCurrentText(
|
||||||
QString::fromStdString(Settings::values.mic_input_device));
|
QString::fromStdString(Settings::values.mic_input_device));
|
||||||
updateAudioInputDevices(index);
|
UpdateAudioInputDevices(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -94,7 +94,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);
|
||||||
@ -108,11 +108,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();
|
||||||
@ -129,7 +129,7 @@ void ConfigureAudio::applyConfiguration() {
|
|||||||
Settings::values.mic_input_device = ui->input_device_combo_box->currentText().toStdString();
|
Settings::values.mic_input_device = ui->input_device_combo_box->currentText().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::updateAudioOutputDevices(int sink_index) {
|
void ConfigureAudio::UpdateAudioOutputDevices(int sink_index) {
|
||||||
ui->audio_device_combo_box->clear();
|
ui->audio_device_combo_box->clear();
|
||||||
ui->audio_device_combo_box->addItem(AudioCore::auto_device_name);
|
ui->audio_device_combo_box->addItem(AudioCore::auto_device_name);
|
||||||
|
|
||||||
@ -139,8 +139,8 @@ void ConfigureAudio::updateAudioOutputDevices(int sink_index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::updateAudioInputDevices(int index) {}
|
void ConfigureAudio::UpdateAudioInputDevices(int index) {}
|
||||||
|
|
||||||
void ConfigureAudio::retranslateUi() {
|
void ConfigureAudio::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,17 @@ public:
|
|||||||
explicit ConfigureAudio(QWidget* parent = nullptr);
|
explicit ConfigureAudio(QWidget* parent = nullptr);
|
||||||
~ConfigureAudio() override;
|
~ConfigureAudio() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateAudioOutputDevices(int sink_index);
|
void UpdateAudioOutputDevices(int sink_index);
|
||||||
void updateAudioInputDevices(int index);
|
void UpdateAudioInputDevices(int index);
|
||||||
|
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
@ -32,27 +32,27 @@ ConfigureCamera::ConfigureCamera(QWidget* parent)
|
|||||||
for (const QCameraInfo& cameraInfo : cameras) {
|
for (const QCameraInfo& cameraInfo : cameras) {
|
||||||
ui->system_camera->addItem(cameraInfo.deviceName());
|
ui->system_camera->addItem(cameraInfo.deviceName());
|
||||||
}
|
}
|
||||||
updateCameraMode();
|
UpdateCameraMode();
|
||||||
setConfiguration();
|
SetConfiguration();
|
||||||
connectEvents();
|
ConnectEvents();
|
||||||
ui->preview_box->setHidden(true);
|
ui->preview_box->setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureCamera::~ConfigureCamera() {
|
ConfigureCamera::~ConfigureCamera() {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::connectEvents() {
|
void ConfigureCamera::ConnectEvents() {
|
||||||
connect(ui->image_source,
|
connect(ui->image_source,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
updateImageSourceUI();
|
UpdateImageSourceUI();
|
||||||
});
|
});
|
||||||
connect(ui->camera_selection,
|
connect(ui->camera_selection,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
if (getCameraSelection() != current_selected) {
|
if (GetCameraSelection() != current_selected) {
|
||||||
recordConfig();
|
RecordConfig();
|
||||||
}
|
}
|
||||||
if (ui->camera_selection->currentIndex() == 1) {
|
if (ui->camera_selection->currentIndex() == 1) {
|
||||||
ui->camera_mode->setCurrentIndex(1); // Double
|
ui->camera_mode->setCurrentIndex(1); // Double
|
||||||
@ -60,26 +60,26 @@ void ConfigureCamera::connectEvents() {
|
|||||||
ui->camera_mode->setCurrentIndex(0); // Single
|
ui->camera_mode->setCurrentIndex(0); // Single
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateCameraMode();
|
UpdateCameraMode();
|
||||||
setConfiguration();
|
SetConfiguration();
|
||||||
});
|
});
|
||||||
connect(ui->camera_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->camera_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, [this] {
|
this, [this] {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
ui->camera_position_label->setVisible(ui->camera_mode->currentIndex() == 1);
|
ui->camera_position_label->setVisible(ui->camera_mode->currentIndex() == 1);
|
||||||
ui->camera_position->setVisible(ui->camera_mode->currentIndex() == 1);
|
ui->camera_position->setVisible(ui->camera_mode->currentIndex() == 1);
|
||||||
current_selected = getCameraSelection();
|
current_selected = GetCameraSelection();
|
||||||
});
|
});
|
||||||
connect(ui->camera_position,
|
connect(ui->camera_position,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
if (getCameraSelection() != current_selected) {
|
if (GetCameraSelection() != current_selected) {
|
||||||
recordConfig();
|
RecordConfig();
|
||||||
}
|
}
|
||||||
setConfiguration();
|
SetConfiguration();
|
||||||
});
|
});
|
||||||
connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::onToolButtonClicked);
|
connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::OnToolButtonClicked);
|
||||||
connect(ui->preview_button, &QPushButton::clicked, this, [=] { startPreviewing(); });
|
connect(ui->preview_button, &QPushButton::clicked, this, [=] { StartPreviewing(); });
|
||||||
connect(ui->prompt_before_load, &QCheckBox::stateChanged, this, [this](int state) {
|
connect(ui->prompt_before_load, &QCheckBox::stateChanged, this, [this](int state) {
|
||||||
ui->camera_file->setDisabled(state == Qt::Checked);
|
ui->camera_file->setDisabled(state == Qt::Checked);
|
||||||
ui->toolButton->setDisabled(state == Qt::Checked);
|
ui->toolButton->setDisabled(state == Qt::Checked);
|
||||||
@ -87,16 +87,16 @@ void ConfigureCamera::connectEvents() {
|
|||||||
ui->camera_file->setText("");
|
ui->camera_file->setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->camera_file, &QLineEdit::textChanged, this, [=] { stopPreviewing(); });
|
connect(ui->camera_file, &QLineEdit::textChanged, this, [=] { StopPreviewing(); });
|
||||||
connect(ui->system_camera,
|
connect(ui->system_camera,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
[=] { stopPreviewing(); });
|
[=] { StopPreviewing(); });
|
||||||
connect(ui->camera_flip, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->camera_flip, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, [=] { stopPreviewing(); });
|
this, [=] { StopPreviewing(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::updateCameraMode() {
|
void ConfigureCamera::UpdateCameraMode() {
|
||||||
CameraPosition pos = getCameraSelection();
|
CameraPosition pos = GetCameraSelection();
|
||||||
// Set the visibility of the camera mode selection widgets
|
// Set the visibility of the camera mode selection widgets
|
||||||
if (pos == CameraPosition::RearBoth) {
|
if (pos == CameraPosition::RearBoth) {
|
||||||
ui->camera_position->setHidden(true);
|
ui->camera_position->setHidden(true);
|
||||||
@ -111,7 +111,7 @@ void ConfigureCamera::updateCameraMode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::updateImageSourceUI() {
|
void ConfigureCamera::UpdateImageSourceUI() {
|
||||||
int image_source = ui->image_source->currentIndex();
|
int image_source = ui->image_source->currentIndex();
|
||||||
switch (image_source) {
|
switch (image_source) {
|
||||||
case 0: /* blank */
|
case 0: /* blank */
|
||||||
@ -128,7 +128,7 @@ void ConfigureCamera::updateImageSourceUI() {
|
|||||||
ui->camera_file_label->setHidden(false);
|
ui->camera_file_label->setHidden(false);
|
||||||
ui->camera_file->setHidden(false);
|
ui->camera_file->setHidden(false);
|
||||||
ui->toolButton->setHidden(false);
|
ui->toolButton->setHidden(false);
|
||||||
if (camera_config[getSelectedCameraIndex()].empty()) {
|
if (camera_config[GetSelectedCameraIndex()].empty()) {
|
||||||
ui->prompt_before_load->setChecked(true);
|
ui->prompt_before_load->setChecked(true);
|
||||||
ui->camera_file->setDisabled(true);
|
ui->camera_file->setDisabled(true);
|
||||||
ui->toolButton->setDisabled(true);
|
ui->toolButton->setDisabled(true);
|
||||||
@ -147,7 +147,7 @@ void ConfigureCamera::updateImageSourceUI() {
|
|||||||
ui->camera_flip->setHidden(image_source == 0);
|
ui->camera_flip->setHidden(image_source == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::recordConfig() {
|
void ConfigureCamera::RecordConfig() {
|
||||||
std::string implementation = Implementations[ui->image_source->currentIndex()];
|
std::string implementation = Implementations[ui->image_source->currentIndex()];
|
||||||
int image_source = ui->image_source->currentIndex();
|
int image_source = ui->image_source->currentIndex();
|
||||||
std::string config;
|
std::string config;
|
||||||
@ -170,14 +170,14 @@ void ConfigureCamera::recordConfig() {
|
|||||||
camera_config[index] = config;
|
camera_config[index] = config;
|
||||||
camera_flip[index] = ui->camera_flip->currentIndex();
|
camera_flip[index] = ui->camera_flip->currentIndex();
|
||||||
}
|
}
|
||||||
current_selected = getCameraSelection();
|
current_selected = GetCameraSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::startPreviewing() {
|
void ConfigureCamera::StartPreviewing() {
|
||||||
current_selected = getCameraSelection();
|
current_selected = GetCameraSelection();
|
||||||
recordConfig();
|
RecordConfig();
|
||||||
int camera_selection = getSelectedCameraIndex();
|
int camera_selection = GetSelectedCameraIndex();
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
// Init preview box
|
// Init preview box
|
||||||
ui->preview_box->setHidden(false);
|
ui->preview_box->setHidden(false);
|
||||||
ui->preview_button->setHidden(true);
|
ui->preview_button->setHidden(true);
|
||||||
@ -190,7 +190,7 @@ void ConfigureCamera::startPreviewing() {
|
|||||||
camera_name[camera_selection], camera_config[camera_selection], preview_width,
|
camera_name[camera_selection], camera_config[camera_selection], preview_width,
|
||||||
preview_height, static_cast<Service::CAM::Flip>(camera_flip[camera_selection]));
|
preview_height, static_cast<Service::CAM::Flip>(camera_flip[camera_selection]));
|
||||||
if (!previewing_camera) {
|
if (!previewing_camera) {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previewing_camera->SetResolution(
|
previewing_camera->SetResolution(
|
||||||
@ -204,7 +204,7 @@ void ConfigureCamera::startPreviewing() {
|
|||||||
timer_id = startTimer(1000 / 30);
|
timer_id = startTimer(1000 / 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::stopPreviewing() {
|
void ConfigureCamera::StopPreviewing() {
|
||||||
ui->preview_box->setHidden(true);
|
ui->preview_box->setHidden(true);
|
||||||
ui->preview_button->setHidden(false);
|
ui->preview_button->setHidden(false);
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ void ConfigureCamera::timerEvent(QTimerEvent* event) {
|
|||||||
int width = ui->preview_box->size().width();
|
int width = ui->preview_box->size().width();
|
||||||
int height = width * 0.75;
|
int height = width * 0.75;
|
||||||
if (width != preview_width || height != preview_height) {
|
if (width != preview_width || height != preview_height) {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QImage image(width, height, QImage::Format::Format_RGB16);
|
QImage image(width, height, QImage::Format::Format_RGB16);
|
||||||
@ -239,8 +239,8 @@ void ConfigureCamera::timerEvent(QTimerEvent* event) {
|
|||||||
ui->preview_box->setPixmap(QPixmap::fromImage(image));
|
ui->preview_box->setPixmap(QPixmap::fromImage(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::setConfiguration() {
|
void ConfigureCamera::SetConfiguration() {
|
||||||
int index = getSelectedCameraIndex();
|
int index = GetSelectedCameraIndex();
|
||||||
for (int i = 0; i < Implementations.size(); i++) {
|
for (int i = 0; i < Implementations.size(); i++) {
|
||||||
if (Implementations[i] == camera_name[index]) {
|
if (Implementations[i] == camera_name[index]) {
|
||||||
ui->image_source->setCurrentIndex(i);
|
ui->image_source->setCurrentIndex(i);
|
||||||
@ -262,11 +262,11 @@ void ConfigureCamera::setConfiguration() {
|
|||||||
ui->camera_file->setText(QString::fromStdString(camera_config[index]));
|
ui->camera_file->setText(QString::fromStdString(camera_config[index]));
|
||||||
}
|
}
|
||||||
ui->camera_flip->setCurrentIndex(camera_flip[index]);
|
ui->camera_flip->setCurrentIndex(camera_flip[index]);
|
||||||
updateImageSourceUI();
|
UpdateImageSourceUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::onToolButtonClicked() {
|
void ConfigureCamera::OnToolButtonClicked() {
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
QList<QByteArray> types = QImageReader::supportedImageFormats();
|
QList<QByteArray> types = QImageReader::supportedImageFormats();
|
||||||
QList<QString> temp_filters;
|
QList<QString> temp_filters;
|
||||||
for (const QByteArray& type : types) {
|
for (const QByteArray& type : types) {
|
||||||
@ -279,15 +279,15 @@ void ConfigureCamera::onToolButtonClicked() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::applyConfiguration() {
|
void ConfigureCamera::ApplyConfiguration() {
|
||||||
recordConfig();
|
RecordConfig();
|
||||||
stopPreviewing();
|
StopPreviewing();
|
||||||
Settings::values.camera_name = camera_name;
|
Settings::values.camera_name = camera_name;
|
||||||
Settings::values.camera_config = camera_config;
|
Settings::values.camera_config = camera_config;
|
||||||
Settings::values.camera_flip = camera_flip;
|
Settings::values.camera_flip = camera_flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureCamera::CameraPosition ConfigureCamera::getCameraSelection() {
|
ConfigureCamera::CameraPosition ConfigureCamera::GetCameraSelection() {
|
||||||
switch (ui->camera_selection->currentIndex()) {
|
switch (ui->camera_selection->currentIndex()) {
|
||||||
case 0: // Front
|
case 0: // Front
|
||||||
return CameraPosition::Front;
|
return CameraPosition::Front;
|
||||||
@ -306,8 +306,8 @@ ConfigureCamera::CameraPosition ConfigureCamera::getCameraSelection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigureCamera::getSelectedCameraIndex() {
|
int ConfigureCamera::GetSelectedCameraIndex() {
|
||||||
CameraPosition pos = getCameraSelection();
|
CameraPosition pos = GetCameraSelection();
|
||||||
int camera_selection = static_cast<int>(pos);
|
int camera_selection = static_cast<int>(pos);
|
||||||
if (pos == CameraPosition::RearBoth) { // Single Mode
|
if (pos == CameraPosition::RearBoth) { // Single Mode
|
||||||
camera_selection = 0; // Either camera is the same, so we return RearRight
|
camera_selection = 0; // Either camera is the same, so we return RearRight
|
||||||
@ -315,6 +315,6 @@ int ConfigureCamera::getSelectedCameraIndex() {
|
|||||||
return camera_selection;
|
return camera_selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureCamera::retranslateUi() {
|
void ConfigureCamera::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -18,30 +18,30 @@ public:
|
|||||||
explicit ConfigureCamera(QWidget* parent = nullptr);
|
explicit ConfigureCamera(QWidget* parent = nullptr);
|
||||||
~ConfigureCamera() override;
|
~ConfigureCamera() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
void timerEvent(QTimerEvent*) override;
|
void timerEvent(QTimerEvent*) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/// recordConfig() and updateUiDisplay()
|
/// RecordConfig() and UpdateUiDisplay()
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void onToolButtonClicked();
|
void OnToolButtonClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class CameraPosition { RearRight, Front, RearLeft, RearBoth, Null };
|
enum class CameraPosition { RearRight, Front, RearLeft, RearBoth, Null };
|
||||||
static const std::array<std::string, 3> Implementations;
|
static const std::array<std::string, 3> Implementations;
|
||||||
/// Record the current configuration
|
/// Record the current configuration
|
||||||
void recordConfig();
|
void RecordConfig();
|
||||||
/// Updates camera mode
|
/// Updates camera mode
|
||||||
void updateCameraMode();
|
void UpdateCameraMode();
|
||||||
/// Updates image source
|
/// Updates image source
|
||||||
void updateImageSourceUI();
|
void UpdateImageSourceUI();
|
||||||
void startPreviewing();
|
void StartPreviewing();
|
||||||
void stopPreviewing();
|
void StopPreviewing();
|
||||||
void connectEvents();
|
void ConnectEvents();
|
||||||
CameraPosition getCameraSelection();
|
CameraPosition GetCameraSelection();
|
||||||
int getSelectedCameraIndex();
|
int GetSelectedCameraIndex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureCamera> ui;
|
std::unique_ptr<Ui::ConfigureCamera> ui;
|
||||||
|
@ -17,7 +17,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));
|
||||||
@ -27,7 +28,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->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -49,6 +50,6 @@ void ConfigureDebug::applyConfiguration() {
|
|||||||
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
|
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDebug::retranslateUi() {
|
void ConfigureDebug::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ public:
|
|||||||
explicit ConfigureDebug(QWidget* parent = nullptr);
|
explicit ConfigureDebug(QWidget* parent = nullptr);
|
||||||
~ConfigureDebug() override;
|
~ConfigureDebug() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureDebug> ui;
|
std::unique_ptr<Ui::ConfigureDebug> ui;
|
||||||
};
|
};
|
||||||
|
@ -16,11 +16,11 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool
|
|||||||
ui->hotkeysTab->Populate(registry);
|
ui->hotkeysTab->Populate(registry);
|
||||||
ui->webTab->SetWebServiceConfigEnabled(enable_web_config);
|
ui->webTab->SetWebServiceConfigEnabled(enable_web_config);
|
||||||
|
|
||||||
this->PopulateSelectionList();
|
PopulateSelectionList();
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
connect(ui->uiTab, &ConfigureUi::languageChanged, this, &ConfigureDialog::onLanguageChanged);
|
connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
|
||||||
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
||||||
&ConfigureDialog::UpdateVisibleTabs);
|
&ConfigureDialog::UpdateVisibleTabs);
|
||||||
|
|
||||||
@ -40,30 +40,30 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool
|
|||||||
|
|
||||||
ConfigureDialog::~ConfigureDialog() = default;
|
ConfigureDialog::~ConfigureDialog() = default;
|
||||||
|
|
||||||
void ConfigureDialog::setConfiguration() {
|
void ConfigureDialog::SetConfiguration() {
|
||||||
ui->generalTab->setConfiguration();
|
ui->generalTab->SetConfiguration();
|
||||||
ui->systemTab->setConfiguration();
|
ui->systemTab->SetConfiguration();
|
||||||
ui->inputTab->loadConfiguration();
|
ui->inputTab->LoadConfiguration();
|
||||||
ui->graphicsTab->setConfiguration();
|
ui->graphicsTab->SetConfiguration();
|
||||||
ui->audioTab->setConfiguration();
|
ui->audioTab->SetConfiguration();
|
||||||
ui->cameraTab->setConfiguration();
|
ui->cameraTab->SetConfiguration();
|
||||||
ui->debugTab->setConfiguration();
|
ui->debugTab->SetConfiguration();
|
||||||
ui->webTab->setConfiguration();
|
ui->webTab->SetConfiguration();
|
||||||
ui->uiTab->setConfiguration();
|
ui->uiTab->SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::applyConfiguration() {
|
void ConfigureDialog::ApplyConfiguration() {
|
||||||
ui->generalTab->applyConfiguration();
|
ui->generalTab->ApplyConfiguration();
|
||||||
ui->systemTab->applyConfiguration();
|
ui->systemTab->ApplyConfiguration();
|
||||||
ui->inputTab->applyConfiguration();
|
ui->inputTab->ApplyConfiguration();
|
||||||
ui->inputTab->ApplyProfile();
|
ui->inputTab->ApplyProfile();
|
||||||
ui->hotkeysTab->applyConfiguration(registry);
|
ui->hotkeysTab->ApplyConfiguration(registry);
|
||||||
ui->graphicsTab->applyConfiguration();
|
ui->graphicsTab->ApplyConfiguration();
|
||||||
ui->audioTab->applyConfiguration();
|
ui->audioTab->ApplyConfiguration();
|
||||||
ui->cameraTab->applyConfiguration();
|
ui->cameraTab->ApplyConfiguration();
|
||||||
ui->debugTab->applyConfiguration();
|
ui->debugTab->ApplyConfiguration();
|
||||||
ui->webTab->applyConfiguration();
|
ui->webTab->ApplyConfiguration();
|
||||||
ui->uiTab->applyConfiguration();
|
ui->uiTab->ApplyConfiguration();
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
Settings::LogSettings();
|
Settings::LogSettings();
|
||||||
}
|
}
|
||||||
@ -86,15 +86,15 @@ void ConfigureDialog::PopulateSelectionList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::onLanguageChanged(const QString& locale) {
|
void ConfigureDialog::OnLanguageChanged(const QString& locale) {
|
||||||
emit languageChanged(locale);
|
emit LanguageChanged(locale);
|
||||||
// first apply the configuration, and then restore the display
|
// first apply the configuration, and then restore the display
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
retranslateUi();
|
RetranslateUI();
|
||||||
setConfiguration();
|
SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::retranslateUi() {
|
void ConfigureDialog::RetranslateUI() {
|
||||||
int old_row = ui->selectorList->currentRow();
|
int old_row = ui->selectorList->currentRow();
|
||||||
int old_index = ui->tabWidget->currentIndex();
|
int old_index = ui->tabWidget->currentIndex();
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
@ -103,16 +103,16 @@ void ConfigureDialog::retranslateUi() {
|
|||||||
ui->selectorList->setCurrentRow(old_row);
|
ui->selectorList->setCurrentRow(old_row);
|
||||||
ui->tabWidget->setCurrentIndex(old_index);
|
ui->tabWidget->setCurrentIndex(old_index);
|
||||||
|
|
||||||
ui->generalTab->retranslateUi();
|
ui->generalTab->RetranslateUI();
|
||||||
ui->systemTab->retranslateUi();
|
ui->systemTab->RetranslateUI();
|
||||||
ui->inputTab->retranslateUi();
|
ui->inputTab->RetranslateUI();
|
||||||
ui->hotkeysTab->retranslateUi();
|
ui->hotkeysTab->RetranslateUI();
|
||||||
ui->graphicsTab->retranslateUi();
|
ui->graphicsTab->RetranslateUI();
|
||||||
ui->audioTab->retranslateUi();
|
ui->audioTab->RetranslateUI();
|
||||||
ui->cameraTab->retranslateUi();
|
ui->cameraTab->RetranslateUI();
|
||||||
ui->debugTab->retranslateUi();
|
ui->debugTab->RetranslateUI();
|
||||||
ui->webTab->retranslateUi();
|
ui->webTab->RetranslateUI();
|
||||||
ui->uiTab->retranslateUi();
|
ui->uiTab->RetranslateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::UpdateVisibleTabs() {
|
void ConfigureDialog::UpdateVisibleTabs() {
|
||||||
|
@ -21,17 +21,17 @@ public:
|
|||||||
bool enable_web_config = true);
|
bool enable_web_config = true);
|
||||||
~ConfigureDialog() override;
|
~ConfigureDialog() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLanguageChanged(const QString& locale);
|
void OnLanguageChanged(const QString& locale);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void languageChanged(const QString& locale);
|
void LanguageChanged(const QString& locale);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void UpdateVisibleTabs();
|
void UpdateVisibleTabs();
|
||||||
void PopulateSelectionList();
|
void PopulateSelectionList();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
|||||||
: QWidget(parent), ui(new Ui::ConfigureGeneral) {
|
: QWidget(parent), ui(new Ui::ConfigureGeneral) {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
ui->updateBox->setVisible(UISettings::values.updater_found);
|
ui->updateBox->setVisible(UISettings::values.updater_found);
|
||||||
connect(ui->button_reset_defaults, &QPushButton::clicked, this,
|
connect(ui->button_reset_defaults, &QPushButton::clicked, this,
|
||||||
@ -22,7 +22,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
|||||||
|
|
||||||
ConfigureGeneral::~ConfigureGeneral() = default;
|
ConfigureGeneral::~ConfigureGeneral() = default;
|
||||||
|
|
||||||
void ConfigureGeneral::setConfiguration() {
|
void ConfigureGeneral::SetConfiguration() {
|
||||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
||||||
|
|
||||||
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
|
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
|
||||||
@ -45,7 +45,7 @@ void ConfigureGeneral::ResetDefaults() {
|
|||||||
std::exit(0);
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGeneral::applyConfiguration() {
|
void ConfigureGeneral::ApplyConfiguration() {
|
||||||
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
||||||
|
|
||||||
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
|
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
|
||||||
@ -54,6 +54,6 @@ void ConfigureGeneral::applyConfiguration() {
|
|||||||
Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
|
Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGeneral::retranslateUi() {
|
void ConfigureGeneral::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ public:
|
|||||||
~ConfigureGeneral() override;
|
~ConfigureGeneral() override;
|
||||||
|
|
||||||
void ResetDefaults();
|
void ResetDefaults();
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
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);
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||||||
|
|
||||||
ConfigureGraphics::~ConfigureGraphics() = default;
|
ConfigureGraphics::~ConfigureGraphics() = default;
|
||||||
|
|
||||||
void ConfigureGraphics::setConfiguration() {
|
void ConfigureGraphics::SetConfiguration() {
|
||||||
ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
|
ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
|
||||||
ui->toggle_hw_shader->setChecked(Settings::values.use_hw_shader);
|
ui->toggle_hw_shader->setChecked(Settings::values.use_hw_shader);
|
||||||
ui->toggle_accurate_gs->setChecked(Settings::values.shaders_accurate_gs);
|
ui->toggle_accurate_gs->setChecked(Settings::values.shaders_accurate_gs);
|
||||||
@ -75,7 +75,7 @@ void ConfigureGraphics::setConfiguration() {
|
|||||||
ui->bg_button->setIcon(color_icon);
|
ui->bg_button->setIcon(color_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::applyConfiguration() {
|
void ConfigureGraphics::ApplyConfiguration() {
|
||||||
Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
|
Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
|
||||||
Settings::values.use_hw_shader = ui->toggle_hw_shader->isChecked();
|
Settings::values.use_hw_shader = ui->toggle_hw_shader->isChecked();
|
||||||
Settings::values.shaders_accurate_gs = ui->toggle_accurate_gs->isChecked();
|
Settings::values.shaders_accurate_gs = ui->toggle_accurate_gs->isChecked();
|
||||||
@ -95,6 +95,6 @@ void ConfigureGraphics::applyConfiguration() {
|
|||||||
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
|
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::retranslateUi() {
|
void ConfigureGraphics::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ public:
|
|||||||
explicit ConfigureGraphics(QWidget* parent = nullptr);
|
explicit ConfigureGraphics(QWidget* parent = nullptr);
|
||||||
~ConfigureGraphics() override;
|
~ConfigureGraphics() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
QColor bg_color;
|
QColor bg_color;
|
||||||
|
@ -99,7 +99,7 @@ bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
|
|||||||
return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence);
|
return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
QStandardItem* parent = model->item(key_id, 0);
|
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++) {
|
||||||
@ -120,6 +120,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();
|
~ConfigureHotkeys();
|
||||||
|
|
||||||
void applyConfiguration(HotkeyRegistry& registry);
|
void ApplyConfiguration(HotkeyRegistry& registry);
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
void EmitHotkeysChanged();
|
void EmitHotkeysChanged();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM>
|
|||||||
"modifier",
|
"modifier",
|
||||||
}};
|
}};
|
||||||
|
|
||||||
static QString getKeyName(int key_code) {
|
static QString GetKeyName(int key_code) {
|
||||||
switch (key_code) {
|
switch (key_code) {
|
||||||
case Qt::Key_Shift:
|
case Qt::Key_Shift:
|
||||||
return QObject::tr("Shift");
|
return QObject::tr("Shift");
|
||||||
@ -53,7 +53,7 @@ static QString ButtonToText(const Common::ParamPackage& param) {
|
|||||||
if (!param.Has("engine")) {
|
if (!param.Has("engine")) {
|
||||||
return QObject::tr("[not set]");
|
return QObject::tr("[not set]");
|
||||||
} else if (param.Get("engine", "") == "keyboard") {
|
} else if (param.Get("engine", "") == "keyboard") {
|
||||||
return getKeyName(param.Get("code", 0));
|
return GetKeyName(param.Get("code", 0));
|
||||||
} else if (param.Get("engine", "") == "sdl") {
|
} else if (param.Get("engine", "") == "sdl") {
|
||||||
if (param.Has("hat")) {
|
if (param.Has("hat")) {
|
||||||
return QString(QObject::tr("Hat %1 %2"))
|
return QString(QObject::tr("Hat %1 %2"))
|
||||||
@ -137,12 +137,12 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
continue;
|
continue;
|
||||||
button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu);
|
button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button_map[button_id], &QPushButton::released, [=]() {
|
connect(button_map[button_id], &QPushButton::released, [=]() {
|
||||||
handleClick(button_map[button_id],
|
HandleClick(button_map[button_id],
|
||||||
[=](const Common::ParamPackage& params) {
|
[=](const Common::ParamPackage& params) {
|
||||||
buttons_param[button_id] = params;
|
buttons_param[button_id] = params;
|
||||||
// If the user closes the dialog, the changes are reverted in
|
// If the user closes the dialog, the changes are reverted in
|
||||||
// `GMainWindow::OnConfigure()`
|
// `GMainWindow::OnConfigure()`
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
},
|
},
|
||||||
InputCommon::Polling::DeviceType::Button);
|
InputCommon::Polling::DeviceType::Button);
|
||||||
@ -153,14 +153,14 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
context_menu.addAction(tr("Clear"), [&] {
|
context_menu.addAction(tr("Clear"), [&] {
|
||||||
buttons_param[button_id].Clear();
|
buttons_param[button_id].Clear();
|
||||||
button_map[button_id]->setText(tr("[not set]"));
|
button_map[button_id]->setText(tr("[not set]"));
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
});
|
});
|
||||||
context_menu.addAction(tr("Restore Default"), [&] {
|
context_menu.addAction(tr("Restore Default"), [&] {
|
||||||
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])};
|
||||||
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
|
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
});
|
});
|
||||||
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
||||||
@ -174,11 +174,11 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(
|
analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(
|
||||||
Qt::CustomContextMenu);
|
Qt::CustomContextMenu);
|
||||||
connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() {
|
connect(analog_map_buttons[analog_id][sub_button_id], &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]);
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
},
|
},
|
||||||
InputCommon::Polling::DeviceType::Button);
|
InputCommon::Polling::DeviceType::Button);
|
||||||
@ -189,7 +189,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
context_menu.addAction(tr("Clear"), [&] {
|
context_menu.addAction(tr("Clear"), [&] {
|
||||||
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
|
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
|
||||||
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
|
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
});
|
});
|
||||||
context_menu.addAction(tr("Restore Default"), [&] {
|
context_menu.addAction(tr("Restore Default"), [&] {
|
||||||
@ -199,7 +199,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
analog_sub_buttons[sub_button_id]);
|
analog_sub_buttons[sub_button_id]);
|
||||||
analog_map_buttons[analog_id][sub_button_id]->setText(AnalogToText(
|
analog_map_buttons[analog_id][sub_button_id]->setText(AnalogToText(
|
||||||
analogs_param[analog_id], analog_sub_buttons[sub_button_id]));
|
analogs_param[analog_id], analog_sub_buttons[sub_button_id]));
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
});
|
});
|
||||||
context_menu.exec(analog_map_buttons[analog_id][sub_button_id]->mapToGlobal(
|
context_menu.exec(analog_map_buttons[analog_id][sub_button_id]->mapToGlobal(
|
||||||
@ -210,10 +210,10 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
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(analog_map_stick[analog_id],
|
HandleClick(analog_map_stick[analog_id],
|
||||||
[=](const Common::ParamPackage& params) {
|
[=](const Common::ParamPackage& params) {
|
||||||
analogs_param[analog_id] = params;
|
analogs_param[analog_id] = params;
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
},
|
},
|
||||||
InputCommon::Polling::DeviceType::Analog);
|
InputCommon::Polling::DeviceType::Analog);
|
||||||
@ -228,34 +228,34 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
||||||
|
|
||||||
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(); });
|
||||||
connect(ui->buttonNew, &QPushButton::released, [this] { NewProfile(); });
|
connect(ui->buttonNew, &QPushButton::released, [this] { NewProfile(); });
|
||||||
connect(ui->buttonDelete, &QPushButton::released, [this] { DeleteProfile(); });
|
connect(ui->buttonDelete, &QPushButton::released, [this] { DeleteProfile(); });
|
||||||
connect(ui->buttonRename, &QPushButton::released, [this] { RenameProfile(); });
|
connect(ui->buttonRename, &QPushButton::released, [this] { RenameProfile(); });
|
||||||
|
|
||||||
connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
[this](int i) {
|
[this](int i) {
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(Settings::values.current_input_profile_index);
|
Settings::SaveProfile(Settings::values.current_input_profile_index);
|
||||||
Settings::LoadProfile(i);
|
Settings::LoadProfile(i);
|
||||||
loadConfiguration();
|
LoadConfiguration();
|
||||||
});
|
});
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->loadConfiguration();
|
LoadConfiguration();
|
||||||
|
|
||||||
// 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);
|
||||||
@ -263,7 +263,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
|
|
||||||
ConfigureInput::~ConfigureInput() = default;
|
ConfigureInput::~ConfigureInput() = default;
|
||||||
|
|
||||||
void ConfigureInput::applyConfiguration() {
|
void ConfigureInput::ApplyConfiguration() {
|
||||||
std::transform(buttons_param.begin(), buttons_param.end(),
|
std::transform(buttons_param.begin(), buttons_param.end(),
|
||||||
Settings::values.current_input_profile.buttons.begin(),
|
Settings::values.current_input_profile.buttons.begin(),
|
||||||
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
||||||
@ -300,17 +300,17 @@ QList<QKeySequence> ConfigureInput::GetUsedKeyboardKeys() {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::loadConfiguration() {
|
void ConfigureInput::LoadConfiguration() {
|
||||||
std::transform(Settings::values.current_input_profile.buttons.begin(),
|
std::transform(Settings::values.current_input_profile.buttons.begin(),
|
||||||
Settings::values.current_input_profile.buttons.end(), buttons_param.begin(),
|
Settings::values.current_input_profile.buttons.end(), buttons_param.begin(),
|
||||||
[](const std::string& str) { return Common::ParamPackage(str); });
|
[](const std::string& str) { return Common::ParamPackage(str); });
|
||||||
std::transform(Settings::values.current_input_profile.analogs.begin(),
|
std::transform(Settings::values.current_input_profile.analogs.begin(),
|
||||||
Settings::values.current_input_profile.analogs.end(), analogs_param.begin(),
|
Settings::values.current_input_profile.analogs.end(), analogs_param.begin(),
|
||||||
[](const std::string& str) { return Common::ParamPackage(str); });
|
[](const std::string& str) { return Common::ParamPackage(str); });
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::restoreDefaults() {
|
void ConfigureInput::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])};
|
||||||
@ -323,7 +323,7 @@ void ConfigureInput::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 ConfigureInput::ClearAll() {
|
void ConfigureInput::ClearAll() {
|
||||||
@ -338,10 +338,10 @@ void ConfigureInput::ClearAll() {
|
|||||||
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
|
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::updateButtonLabels() {
|
void ConfigureInput::UpdateButtonLabels() {
|
||||||
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
|
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
|
||||||
if (button_map[button])
|
if (button_map[button])
|
||||||
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
button_map[button]->setText(ButtonToText(buttons_param[button]));
|
||||||
@ -360,7 +360,7 @@ void ConfigureInput::updateButtonLabels() {
|
|||||||
EmitInputKeysChanged();
|
EmitInputKeysChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::handleClick(QPushButton* button,
|
void ConfigureInput::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) {
|
||||||
previous_key_code = QKeySequence(button->text())[0];
|
previous_key_code = QKeySequence(button->text())[0];
|
||||||
@ -384,7 +384,7 @@ void ConfigureInput::handleClick(QPushButton* button,
|
|||||||
poll_timer->start(200); // Check for new inputs every 200ms
|
poll_timer->start(200); // Check for new inputs every 200ms
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::setPollingResult(const Common::ParamPackage& params, bool abort) {
|
void ConfigureInput::SetPollingResult(const Common::ParamPackage& params, bool abort) {
|
||||||
releaseKeyboard();
|
releaseKeyboard();
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
timeout_timer->stop();
|
timeout_timer->stop();
|
||||||
@ -397,7 +397,7 @@ void ConfigureInput::setPollingResult(const Common::ParamPackage& params, bool a
|
|||||||
(*input_setter)(params);
|
(*input_setter)(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtonLabels();
|
UpdateButtonLabels();
|
||||||
input_setter.reset();
|
input_setter.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,12 +410,12 @@ void ConfigureInput::keyPressEvent(QKeyEvent* event) {
|
|||||||
// Check if key is already bound
|
// Check if key is already bound
|
||||||
if (hotkey_list.contains(QKeySequence(event->key())) ||
|
if (hotkey_list.contains(QKeySequence(event->key())) ||
|
||||||
GetUsedKeyboardKeys().contains(QKeySequence(event->key()))) {
|
GetUsedKeyboardKeys().contains(QKeySequence(event->key()))) {
|
||||||
setPollingResult({}, true);
|
SetPollingResult({}, true);
|
||||||
QMessageBox::critical(this, tr("Error!"),
|
QMessageBox::critical(this, tr("Error!"),
|
||||||
tr("You're using a key that's already bound."));
|
tr("You're using a key that's already bound."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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
|
// Escape key wasn't pressed and we don't want any keyboard keys, so don't stop
|
||||||
@ -423,11 +423,11 @@ void ConfigureInput::keyPressEvent(QKeyEvent* event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPollingResult({}, true);
|
SetPollingResult({}, true);
|
||||||
previous_key_code = 0;
|
previous_key_code = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::retranslateUi() {
|
void ConfigureInput::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,12 +442,12 @@ void ConfigureInput::NewProfile() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyConfiguration();
|
ApplyConfiguration();
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
Settings::CreateProfile(name.toStdString());
|
Settings::CreateProfile(name.toStdString());
|
||||||
ui->profile->addItem(name);
|
ui->profile->addItem(name);
|
||||||
ui->profile->setCurrentIndex(Settings::values.current_input_profile_index);
|
ui->profile->setCurrentIndex(Settings::values.current_input_profile_index);
|
||||||
loadConfiguration();
|
LoadConfiguration();
|
||||||
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ void ConfigureInput::DeleteProfile() {
|
|||||||
ui->profile->removeItem(index);
|
ui->profile->removeItem(index);
|
||||||
ui->profile->setCurrentIndex(0);
|
ui->profile->setCurrentIndex(0);
|
||||||
Settings::DeleteProfile(index);
|
Settings::DeleteProfile(index);
|
||||||
loadConfiguration();
|
LoadConfiguration();
|
||||||
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ public:
|
|||||||
~ConfigureInput() override;
|
~ConfigureInput() override;
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
/// Load configuration settings.
|
/// Load configuration settings.
|
||||||
void loadConfiguration();
|
void LoadConfiguration();
|
||||||
void EmitInputKeysChanged();
|
void EmitInputKeysChanged();
|
||||||
|
|
||||||
/// Save the current input profile index
|
/// Save the current input profile index
|
||||||
@ -94,15 +94,15 @@ private:
|
|||||||
QList<QKeySequence> GetUsedKeyboardKeys();
|
QList<QKeySequence> GetUsedKeyboardKeys();
|
||||||
|
|
||||||
/// 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);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ private:
|
|||||||
int previous_key_code;
|
int previous_key_code;
|
||||||
|
|
||||||
/// 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;
|
||||||
|
@ -94,14 +94,14 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent)
|
|||||||
"using-a-controller-or-android-phone-for-motion-or-touch-input'><span "
|
"using-a-controller-or-android-phone-for-motion-or-touch-input'><span "
|
||||||
"style=\"text-decoration: underline; color:#039be5;\">Learn More</span></a>"));
|
"style=\"text-decoration: underline; color:#039be5;\">Learn More</span></a>"));
|
||||||
|
|
||||||
setConfiguration();
|
SetConfiguration();
|
||||||
updateUiDisplay();
|
UpdateUiDisplay();
|
||||||
connectEvents();
|
ConnectEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureMotionTouch::~ConfigureMotionTouch() = default;
|
ConfigureMotionTouch::~ConfigureMotionTouch() = default;
|
||||||
|
|
||||||
void ConfigureMotionTouch::setConfiguration() {
|
void ConfigureMotionTouch::SetConfiguration() {
|
||||||
Common::ParamPackage motion_param(Settings::values.current_input_profile.motion_device);
|
Common::ParamPackage motion_param(Settings::values.current_input_profile.motion_device);
|
||||||
Common::ParamPackage touch_param(Settings::values.current_input_profile.touch_device);
|
Common::ParamPackage touch_param(Settings::values.current_input_profile.touch_device);
|
||||||
std::string motion_engine = motion_param.Get("engine", "motion_emu");
|
std::string motion_engine = motion_param.Get("engine", "motion_emu");
|
||||||
@ -124,7 +124,7 @@ void ConfigureMotionTouch::setConfiguration() {
|
|||||||
ui->udp_pad_index->setCurrentIndex(Settings::values.current_input_profile.udp_pad_index);
|
ui->udp_pad_index->setCurrentIndex(Settings::values.current_input_profile.udp_pad_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMotionTouch::updateUiDisplay() {
|
void ConfigureMotionTouch::UpdateUiDisplay() {
|
||||||
std::string motion_engine = ui->motion_provider->currentData().toString().toStdString();
|
std::string motion_engine = ui->motion_provider->currentData().toString().toStdString();
|
||||||
std::string touch_engine = ui->touch_provider->currentData().toString().toStdString();
|
std::string touch_engine = ui->touch_provider->currentData().toString().toStdString();
|
||||||
|
|
||||||
@ -156,13 +156,13 @@ void ConfigureMotionTouch::updateUiDisplay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMotionTouch::connectEvents() {
|
void ConfigureMotionTouch::ConnectEvents() {
|
||||||
connect(ui->motion_provider,
|
connect(ui->motion_provider,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
[this](int index) { updateUiDisplay(); });
|
[this](int index) { UpdateUiDisplay(); });
|
||||||
connect(ui->touch_provider,
|
connect(ui->touch_provider,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
[this](int index) { updateUiDisplay(); });
|
[this](int index) { UpdateUiDisplay(); });
|
||||||
connect(ui->udp_test, &QPushButton::clicked, this, &ConfigureMotionTouch::OnCemuhookUDPTest);
|
connect(ui->udp_test, &QPushButton::clicked, this, &ConfigureMotionTouch::OnCemuhookUDPTest);
|
||||||
connect(ui->touch_calibration_config, &QPushButton::clicked, this,
|
connect(ui->touch_calibration_config, &QPushButton::clicked, this,
|
||||||
&ConfigureMotionTouch::OnConfigureTouchCalibration);
|
&ConfigureMotionTouch::OnConfigureTouchCalibration);
|
||||||
@ -204,7 +204,7 @@ void ConfigureMotionTouch::OnConfigureTouchCalibration() {
|
|||||||
LOG_INFO(Frontend,
|
LOG_INFO(Frontend,
|
||||||
"UDP touchpad calibration config success: min_x={}, min_y={}, max_x={}, max_y={}",
|
"UDP touchpad calibration config success: min_x={}, min_y={}, max_x={}, max_y={}",
|
||||||
min_x, min_y, max_x, max_y);
|
min_x, min_y, max_x, max_y);
|
||||||
updateUiDisplay();
|
UpdateUiDisplay();
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Frontend, "UDP touchpad calibration config failed");
|
LOG_ERROR(Frontend, "UDP touchpad calibration config failed");
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ bool ConfigureMotionTouch::CanCloseDialog() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMotionTouch::applyConfiguration() {
|
void ConfigureMotionTouch::ApplyConfiguration() {
|
||||||
if (!CanCloseDialog())
|
if (!CanCloseDialog())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
~ConfigureMotionTouch() override;
|
~ConfigureMotionTouch() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnCemuhookUDPTest();
|
void OnCemuhookUDPTest();
|
||||||
@ -58,9 +58,9 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent* event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
Q_INVOKABLE void ShowUDPTestResult(bool result);
|
Q_INVOKABLE void ShowUDPTestResult(bool result);
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void updateUiDisplay();
|
void UpdateUiDisplay();
|
||||||
void connectEvents();
|
void ConnectEvents();
|
||||||
bool CanCloseDialog();
|
bool CanCloseDialog();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureMotionTouch> ui;
|
std::unique_ptr<Ui::ConfigureMotionTouch> ui;
|
||||||
|
@ -237,7 +237,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
|
|||||||
|
|
||||||
ConfigureSystem::~ConfigureSystem() = default;
|
ConfigureSystem::~ConfigureSystem() = default;
|
||||||
|
|
||||||
void ConfigureSystem::setConfiguration() {
|
void ConfigureSystem::SetConfiguration() {
|
||||||
enabled = !Core::System::GetInstance().IsPoweredOn();
|
enabled = !Core::System::GetInstance().IsPoweredOn();
|
||||||
|
|
||||||
ui->combo_init_clock->setCurrentIndex(static_cast<u8>(Settings::values.init_clock));
|
ui->combo_init_clock->setCurrentIndex(static_cast<u8>(Settings::values.init_clock));
|
||||||
@ -297,9 +297,10 @@ void ConfigureSystem::ReadSystemSettings() {
|
|||||||
ui->spinBox_play_coins->setValue(play_coin);
|
ui->spinBox_play_coins->setValue(play_coin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureSystem::applyConfiguration() {
|
void ConfigureSystem::ApplyConfiguration() {
|
||||||
if (!enabled)
|
if (!enabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
@ -349,8 +350,9 @@ void ConfigureSystem::applyConfiguration() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the config savegame if any item is modified.
|
// update the config savegame if any item is modified.
|
||||||
if (modified)
|
if (modified) {
|
||||||
cfg->UpdateConfigNANDSavegame();
|
cfg->UpdateConfigNANDSavegame();
|
||||||
|
}
|
||||||
|
|
||||||
Settings::values.init_clock =
|
Settings::values.init_clock =
|
||||||
static_cast<Settings::InitClock>(ui->combo_init_clock->currentIndex());
|
static_cast<Settings::InitClock>(ui->combo_init_clock->currentIndex());
|
||||||
@ -389,7 +391,7 @@ void ConfigureSystem::ConfigureTime() {
|
|||||||
dt.fromString("2000-01-01 00:00:01", "yyyy-MM-dd hh:mm:ss");
|
dt.fromString("2000-01-01 00:00:01", "yyyy-MM-dd hh:mm:ss");
|
||||||
ui->edit_init_time->setMinimumDateTime(dt);
|
ui->edit_init_time->setMinimumDateTime(dt);
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
UpdateInitTime(ui->combo_init_clock->currentIndex());
|
UpdateInitTime(ui->combo_init_clock->currentIndex());
|
||||||
}
|
}
|
||||||
@ -409,8 +411,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;
|
||||||
|
}
|
||||||
|
|
||||||
u32 random_number;
|
u32 random_number;
|
||||||
u64 console_id;
|
u64 console_id;
|
||||||
cfg->GenerateConsoleUniqueId(random_number, console_id);
|
cfg->GenerateConsoleUniqueId(random_number, console_id);
|
||||||
@ -420,6 +424,6 @@ void ConfigureSystem::RefreshConsoleID() {
|
|||||||
tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
|
tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureSystem::retranslateUi() {
|
void ConfigureSystem::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ public:
|
|||||||
explicit ConfigureSystem(QWidget* parent = nullptr);
|
explicit ConfigureSystem(QWidget* parent = nullptr);
|
||||||
~ConfigureSystem() override;
|
~ConfigureSystem() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReadSystemSettings();
|
void ReadSystemSettings();
|
||||||
|
@ -25,18 +25,18 @@ ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::Configur
|
|||||||
// retranslating when passing back.
|
// retranslating when passing back.
|
||||||
connect(ui->language_combobox,
|
connect(ui->language_combobox,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureUi::onLanguageChanged);
|
&ConfigureUi::OnLanguageChanged);
|
||||||
|
|
||||||
for (const auto& theme : UISettings::themes) {
|
for (const auto& theme : UISettings::themes) {
|
||||||
ui->theme_combobox->addItem(theme.first, theme.second);
|
ui->theme_combobox->addItem(theme.first, theme.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setConfiguration();
|
SetConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureUi::~ConfigureUi() = default;
|
ConfigureUi::~ConfigureUi() = default;
|
||||||
|
|
||||||
void ConfigureUi::setConfiguration() {
|
void ConfigureUi::SetConfiguration() {
|
||||||
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
||||||
ui->language_combobox->setCurrentIndex(
|
ui->language_combobox->setCurrentIndex(
|
||||||
ui->language_combobox->findData(UISettings::values.language));
|
ui->language_combobox->findData(UISettings::values.language));
|
||||||
@ -48,7 +48,7 @@ void ConfigureUi::setConfiguration() {
|
|||||||
ui->toggle_hide_no_icon->setChecked(UISettings::values.game_list_hide_no_icon);
|
ui->toggle_hide_no_icon->setChecked(UISettings::values.game_list_hide_no_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureUi::applyConfiguration() {
|
void ConfigureUi::ApplyConfiguration() {
|
||||||
UISettings::values.theme =
|
UISettings::values.theme =
|
||||||
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
|
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
|
||||||
UISettings::values.game_list_icon_size =
|
UISettings::values.game_list_icon_size =
|
||||||
@ -60,13 +60,13 @@ void ConfigureUi::applyConfiguration() {
|
|||||||
UISettings::values.game_list_hide_no_icon = ui->toggle_hide_no_icon->isChecked();
|
UISettings::values.game_list_hide_no_icon = ui->toggle_hide_no_icon->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureUi::onLanguageChanged(int index) {
|
void ConfigureUi::OnLanguageChanged(int index) {
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
emit languageChanged(ui->language_combobox->itemData(index).toString());
|
emit LanguageChanged(ui->language_combobox->itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureUi::retranslateUi() {
|
void ConfigureUi::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,15 @@ public:
|
|||||||
explicit ConfigureUi(QWidget* parent = nullptr);
|
explicit ConfigureUi(QWidget* parent = nullptr);
|
||||||
~ConfigureUi() override;
|
~ConfigureUi() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLanguageChanged(int index);
|
void OnLanguageChanged(int index);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void languageChanged(const QString& locale);
|
void LanguageChanged(const QString& locale);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureUi> ui;
|
std::unique_ptr<Ui::ConfigureUi> 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(tr("<a "
|
ui->telemetry_learn_more->setText(tr("<a "
|
||||||
@ -58,7 +58,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) {
|
||||||
@ -115,7 +115,7 @@ void ConfigureWeb::OnLoginVerified() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureWeb::retranslateUi() {
|
void ConfigureWeb::RetranslateUI() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ public:
|
|||||||
explicit ConfigureWeb(QWidget* parent = nullptr);
|
explicit ConfigureWeb(QWidget* parent = nullptr);
|
||||||
~ConfigureWeb() override;
|
~ConfigureWeb() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void ApplyConfiguration();
|
||||||
void retranslateUi();
|
void RetranslateUI();
|
||||||
void setConfiguration();
|
void SetConfiguration();
|
||||||
void SetWebServiceConfigEnabled(bool enabled);
|
void SetWebServiceConfigEnabled(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1339,7 +1339,7 @@ void GMainWindow::OnCheats() {
|
|||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
ConfigureDialog configureDialog(this, hotkey_registry,
|
ConfigureDialog configureDialog(this, hotkey_registry,
|
||||||
!multiplayer_state->IsHostingPublicRoom());
|
!multiplayer_state->IsHostingPublicRoom());
|
||||||
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
connect(&configureDialog, &ConfigureDialog::LanguageChanged, this,
|
||||||
&GMainWindow::OnLanguageChanged);
|
&GMainWindow::OnLanguageChanged);
|
||||||
auto old_theme = UISettings::values.theme;
|
auto old_theme = UISettings::values.theme;
|
||||||
const int old_input_profile_index = Settings::values.current_input_profile_index;
|
const int old_input_profile_index = Settings::values.current_input_profile_index;
|
||||||
@ -1347,7 +1347,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
auto result = configureDialog.exec();
|
auto result = configureDialog.exec();
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
configureDialog.applyConfiguration();
|
configureDialog.ApplyConfiguration();
|
||||||
InitializeHotkeys();
|
InitializeHotkeys();
|
||||||
if (UISettings::values.theme != old_theme)
|
if (UISettings::values.theme != old_theme)
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
|
Loading…
Reference in New Issue
Block a user