mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
fix close without saving
This commit is contained in:
parent
948516d0ca
commit
1eba390d1e
@ -63,6 +63,9 @@ QMap<QString, QString> logTypeMap;
|
|||||||
QMap<QString, QString> fullscreenModeMap;
|
QMap<QString, QString> fullscreenModeMap;
|
||||||
QMap<QString, QString> chooseHomeTabMap;
|
QMap<QString, QString> chooseHomeTabMap;
|
||||||
|
|
||||||
|
int backgroundImageOpacitySlider_backup;
|
||||||
|
int bgm_volume_backup;
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||||
QWidget* parent)
|
QWidget* parent)
|
||||||
@ -110,7 +113,14 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||||||
defaultTextEdit = tr("Point your mouse at an option to display its description.");
|
defaultTextEdit = tr("Point your mouse at an option to display its description.");
|
||||||
ui->descriptionText->setText(defaultTextEdit);
|
ui->descriptionText->setText(defaultTextEdit);
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [this]() {
|
||||||
|
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
||||||
|
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
|
||||||
|
|
||||||
|
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
|
||||||
|
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
|
||||||
|
this->close();
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
||||||
[this, config_dir](QAbstractButton* button) {
|
[this, config_dir](QAbstractButton* button) {
|
||||||
@ -335,6 +345,13 @@ 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() {
|
||||||
|
|
||||||
@ -466,6 +483,9 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||||||
ResetInstallFolders();
|
ResetInstallFolders();
|
||||||
ui->backgroundImageOpacitySlider->setValue(Config::getBackgroundImageOpacity());
|
ui->backgroundImageOpacitySlider->setValue(Config::getBackgroundImageOpacity());
|
||||||
ui->showBackgroundImageCheckBox->setChecked(Config::getShowBackgroundImage());
|
ui->showBackgroundImageCheckBox->setChecked(Config::getShowBackgroundImage());
|
||||||
|
|
||||||
|
backgroundImageOpacitySlider_backup = Config::getBackgroundImageOpacity();
|
||||||
|
bgm_volume_backup = Config::getBGMvolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::InitializeEmulatorLanguages() {
|
void SettingsDialog::InitializeEmulatorLanguages() {
|
||||||
|
@ -36,6 +36,7 @@ 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();
|
||||||
|
Loading…
Reference in New Issue
Block a user