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"); Config::save(config_dir / "config.toml");
LoadValuesFromConfig(); LoadValuesFromConfig();
} else if (button == ui->buttonBox->button(QDialogButtonBox::Close)) { } 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(); ResetInstallFolders();
} }
if (Common::Log::IsActive()) { if (Common::Log::IsActive()) {
@ -338,13 +342,6 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
ui->copyGPUBuffersCheckBox->installEventFilter(this); 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() { void SettingsDialog::LoadValuesFromConfig() {

View File

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