mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Undo avatar choice if the whole preferences dialog is cancelled.
This commit is contained in:
parent
722c024f61
commit
63608d8012
2 changed files with 24 additions and 3 deletions
|
@ -68,12 +68,24 @@ void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QStr
|
|||
}
|
||||
|
||||
void PreferencesDialog::accept() {
|
||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
_lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences();
|
||||
_lastGoodAvatarName = myAvatar->getFullAvatarModelName();
|
||||
savePreferences();
|
||||
close();
|
||||
delete _marketplaceWindow;
|
||||
_marketplaceWindow = NULL;
|
||||
}
|
||||
|
||||
void PreferencesDialog::restoreLastGoodAvatar() {
|
||||
fullAvatarURLChanged(_lastGoodAvatarURL.toString(), _lastGoodAvatarName);
|
||||
}
|
||||
|
||||
void PreferencesDialog::reject() {
|
||||
restoreLastGoodAvatar();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void PreferencesDialog::openSnapshotLocationBrowser() {
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Snapshots Location"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
|
||||
|
@ -127,8 +139,9 @@ void PreferencesDialog::loadPreferences() {
|
|||
|
||||
ui.collisionSoundURLEdit->setText(myAvatar->getCollisionSoundURL());
|
||||
|
||||
fullAvatarURLChanged(myAvatar->getFullAvatarURLFromPreferences().toString(),
|
||||
myAvatar->getFullAvatarModelName());
|
||||
_lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences();
|
||||
_lastGoodAvatarName = myAvatar->getFullAvatarModelName();
|
||||
fullAvatarURLChanged(_lastGoodAvatarURL.toString(), _lastGoodAvatarName);
|
||||
|
||||
ui.sendDataCheckBox->setChecked(!menuInstance->isOptionChecked(MenuOption::DisableActivityLogger));
|
||||
|
||||
|
@ -211,7 +224,11 @@ void PreferencesDialog::savePreferences() {
|
|||
}
|
||||
|
||||
myAvatar->setCollisionSoundURL(ui.collisionSoundURLEdit->text());
|
||||
// avatar model url is already persisted by fullAvatarURLChanged()
|
||||
|
||||
// MyAvatar persists its own data. If it doesn't agree with what the user has explicitly accepted, set it back to old values.
|
||||
if (_lastGoodAvatarURL != myAvatar->getFullAvatarURLFromPreferences()) {
|
||||
restoreLastGoodAvatar();
|
||||
}
|
||||
|
||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger)
|
||||
!= ui.sendDataCheckBox->isChecked()) {
|
||||
|
|
|
@ -33,6 +33,9 @@ protected:
|
|||
private:
|
||||
void loadPreferences();
|
||||
void savePreferences();
|
||||
QUrl _lastGoodAvatarURL;
|
||||
QString _lastGoodAvatarName;
|
||||
void restoreLastGoodAvatar();
|
||||
|
||||
Ui_PreferencesDialog ui;
|
||||
|
||||
|
@ -42,6 +45,7 @@ private:
|
|||
|
||||
private slots:
|
||||
void accept();
|
||||
void reject();
|
||||
void openFullAvatarModelBrowser();
|
||||
void openSnapshotLocationBrowser();
|
||||
void openScriptsLocationBrowser();
|
||||
|
|
Loading…
Reference in a new issue