mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
fix close (X) without saving
This commit is contained in:
parent
4f6f652d52
commit
e0914eaec8
@ -118,6 +118,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
||||
[this, config_dir](QAbstractButton* button) {
|
||||
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
||||
is_saving = true;
|
||||
UpdateSettings();
|
||||
Config::save(config_dir / "config.toml");
|
||||
QWidget::close();
|
||||
@ -343,6 +344,16 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::closeEvent(QCloseEvent* event) {
|
||||
if (!is_saving) {
|
||||
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
||||
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
|
||||
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
|
||||
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
|
||||
}
|
||||
QDialog::closeEvent(event);
|
||||
}
|
||||
|
||||
void SettingsDialog::LoadValuesFromConfig() {
|
||||
|
||||
std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
void InitializeEmulatorLanguages();
|
||||
void OnLanguageChanged(int index);
|
||||
void OnCursorStateChanged(s16 index);
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
std::unique_ptr<Ui::SettingsDialog> ui;
|
||||
|
||||
@ -50,4 +51,6 @@ private:
|
||||
QString defaultTextEdit;
|
||||
|
||||
int initialHeight;
|
||||
|
||||
bool is_saving = false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user