using the save and close buttons, everything works fine, but when using the X button it doesn't work very well...
This commit is contained in:
DanielSvoboda 2025-02-21 13:26:31 -03:00
parent 3110876afe
commit 4f6f652d52
2 changed files with 4 additions and 8 deletions

View File

@ -129,6 +129,10 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
Config::save(config_dir / "config.toml");
LoadValuesFromConfig();
} else if (button == ui->buttonBox->button(QDialogButtonBox::Close)) {
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
ResetInstallFolders();
}
if (Common::Log::IsActive()) {
@ -338,13 +342,6 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
ui->copyGPUBuffersCheckBox->installEventFilter(this);
}
}
void SettingsDialog::closeEvent(QCloseEvent* event) {
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() {

View File

@ -36,7 +36,6 @@ signals:
void BackgroundOpacityChanged(int opacity);
private:
void closeEvent(QCloseEvent* event) override;
void LoadValuesFromConfig();
void UpdateSettings();
void ResetInstallFolders();