mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-02 00:15:06 +01:00
Merge pull request #4300 from FearlessTobi/port-1429-1431
Port yuzu-emu/yuzu#1429 and yuzu-emu/yuzu#1431: Minor configuration changes
This commit is contained in:
commit
cdf8d80c87
@ -19,9 +19,8 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
|||||||
ui->output_sink_combo_box->addItem(sink_detail.id);
|
ui->output_sink_combo_box->addItem(sink_detail.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->volume_slider, &QSlider::valueChanged, [this] {
|
connect(ui->volume_slider, &QSlider::valueChanged, this,
|
||||||
ui->volume_indicator->setText(tr("%1 %").arg(ui->volume_slider->sliderPosition()));
|
&ConfigureAudio::setVolumeIndicatorText);
|
||||||
});
|
|
||||||
|
|
||||||
this->setConfiguration();
|
this->setConfiguration();
|
||||||
connect(ui->output_sink_combo_box,
|
connect(ui->output_sink_combo_box,
|
||||||
@ -32,32 +31,48 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
|||||||
ConfigureAudio::~ConfigureAudio() {}
|
ConfigureAudio::~ConfigureAudio() {}
|
||||||
|
|
||||||
void ConfigureAudio::setConfiguration() {
|
void ConfigureAudio::setConfiguration() {
|
||||||
|
setOutputSinkFromSinkID();
|
||||||
|
|
||||||
|
// The device list cannot be pre-populated (nor listed) until the output sink is known.
|
||||||
|
updateAudioDevices(ui->output_sink_combo_box->currentIndex());
|
||||||
|
|
||||||
|
setAudioDeviceFromDeviceID();
|
||||||
|
|
||||||
|
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
|
||||||
|
ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum());
|
||||||
|
setVolumeIndicatorText(ui->volume_slider->sliderPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureAudio::setOutputSinkFromSinkID() {
|
||||||
int new_sink_index = 0;
|
int new_sink_index = 0;
|
||||||
|
|
||||||
|
const QString sink_id = QString::fromStdString(Settings::values.sink_id);
|
||||||
for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
|
for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
|
||||||
if (ui->output_sink_combo_box->itemText(index).toStdString() == Settings::values.sink_id) {
|
if (ui->output_sink_combo_box->itemText(index) == sink_id) {
|
||||||
new_sink_index = index;
|
new_sink_index = index;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
|
ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
|
||||||
|
}
|
||||||
|
|
||||||
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
|
void ConfigureAudio::setAudioDeviceFromDeviceID() {
|
||||||
|
|
||||||
// The device list cannot be pre-populated (nor listed) until the output sink is known.
|
|
||||||
updateAudioDevices(new_sink_index);
|
|
||||||
|
|
||||||
int new_device_index = -1;
|
int new_device_index = -1;
|
||||||
|
|
||||||
|
const QString device_id = QString::fromStdString(Settings::values.audio_device_id);
|
||||||
for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
|
for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
|
||||||
if (ui->audio_device_combo_box->itemText(index).toStdString() ==
|
if (ui->audio_device_combo_box->itemText(index) == device_id) {
|
||||||
Settings::values.audio_device_id) {
|
|
||||||
new_device_index = index;
|
new_device_index = index;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->audio_device_combo_box->setCurrentIndex(new_device_index);
|
|
||||||
|
|
||||||
ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum());
|
ui->audio_device_combo_box->setCurrentIndex(new_device_index);
|
||||||
ui->volume_indicator->setText(tr("%1 %").arg(ui->volume_slider->sliderPosition()));
|
}
|
||||||
|
|
||||||
|
void ConfigureAudio::setVolumeIndicatorText(int percentage) {
|
||||||
|
ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAudio::applyConfiguration() {
|
void ConfigureAudio::applyConfiguration() {
|
||||||
@ -76,10 +91,10 @@ void ConfigureAudio::updateAudioDevices(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);
|
||||||
|
|
||||||
std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
|
const std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
|
||||||
std::vector<std::string> device_list = AudioCore::GetSinkDetails(sink_id).list_devices();
|
const std::vector<std::string> device_list = AudioCore::GetSinkDetails(sink_id).list_devices();
|
||||||
for (const auto& device : device_list) {
|
for (const auto& device : device_list) {
|
||||||
ui->audio_device_combo_box->addItem(device.c_str());
|
ui->audio_device_combo_box->addItem(QString::fromStdString(device));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,9 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
void setOutputSinkFromSinkID();
|
||||||
|
void setAudioDeviceFromDeviceID();
|
||||||
|
void setVolumeIndicatorText(int percentage);
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureAudio> ui;
|
std::unique_ptr<Ui::ConfigureAudio> ui;
|
||||||
};
|
};
|
||||||
|
@ -184,9 +184,9 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
connect(analog_map_stick[analog_id], &QPushButton::released, [=]() {
|
connect(analog_map_stick[analog_id], &QPushButton::released, [=]() {
|
||||||
QMessageBox::information(
|
QMessageBox::information(this, tr("Information"),
|
||||||
this, "Information",
|
tr("After pressing OK, first move your joystick horizontally, "
|
||||||
"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; },
|
||||||
|
Loading…
Reference in New Issue
Block a user