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,
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
||||||
[this, config_dir](QAbstractButton* button) {
|
[this, config_dir](QAbstractButton* button) {
|
||||||
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
||||||
|
is_saving = true;
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
Config::save(config_dir / "config.toml");
|
Config::save(config_dir / "config.toml");
|
||||||
QWidget::close();
|
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() {
|
void SettingsDialog::LoadValuesFromConfig() {
|
||||||
|
|
||||||
std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||||
|
@ -42,6 +42,7 @@ private:
|
|||||||
void InitializeEmulatorLanguages();
|
void InitializeEmulatorLanguages();
|
||||||
void OnLanguageChanged(int index);
|
void OnLanguageChanged(int index);
|
||||||
void OnCursorStateChanged(s16 index);
|
void OnCursorStateChanged(s16 index);
|
||||||
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
std::unique_ptr<Ui::SettingsDialog> ui;
|
std::unique_ptr<Ui::SettingsDialog> ui;
|
||||||
|
|
||||||
@ -50,4 +51,6 @@ private:
|
|||||||
QString defaultTextEdit;
|
QString defaultTextEdit;
|
||||||
|
|
||||||
int initialHeight;
|
int initialHeight;
|
||||||
|
|
||||||
|
bool is_saving = false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user