From 4a0c6eebd888c4be43cd088866134fe3c88e4ff3 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 7 Dec 2015 16:17:59 -0800 Subject: [PATCH 1/2] change avatar URL when typing completed or accepted --- interface/src/ui/PreferencesDialog.cpp | 23 +++++++++++++++++------ interface/src/ui/PreferencesDialog.h | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 89c82a1c97..a25f868172 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -33,8 +33,8 @@ const int PREFERENCES_HEIGHT_PADDING = 20; PreferencesDialog::PreferencesDialog(QWidget* parent) : - QDialog(parent) { - + QDialog(parent) +{ setAttribute(Qt::WA_DeleteOnClose); ui.setupUi(this); @@ -48,10 +48,8 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked, qApp, &Application::loadDefaultScripts); connect(ui.buttonChangeAppearance, &QPushButton::clicked, this, &PreferencesDialog::openFullAvatarModelBrowser); - connect(ui.appearanceDescription, &QLineEdit::textChanged, this, [this](const QString& url) { - DependencyManager::get()->getMyAvatar()->useFullAvatarURL(url, ""); - this->fullAvatarURLChanged(url, ""); - }); + connect(ui.appearanceDescription, &QLineEdit::editingFinished, this, &PreferencesDialog::changeFullAvatarURL); + connect(qApp, &Application::fullAvatarURLChanged, this, &PreferencesDialog::fullAvatarURLChanged); // move dialog to left side @@ -61,6 +59,11 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : UIUtil::scaleWidgetFontSizes(this); } +void PreferencesDialog::changeFullAvatarURL() { + DependencyManager::get()->getMyAvatar()->useFullAvatarURL(ui.appearanceDescription->text(), ""); + this->fullAvatarURLChanged(ui.appearanceDescription->text(), ""); +} + void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QString& modelName) { ui.appearanceDescription->setText(newValue); const QString APPEARANCE_LABEL_TEXT("Appearance: "); @@ -69,9 +72,17 @@ void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QStr void PreferencesDialog::accept() { MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); + + // if there is an attempted change to the full avatar URL, apply it now + if (QUrl(ui.appearanceDescription->text()) != myAvatar->getFullAvatarURLFromPreferences()) { + changeFullAvatarURL(); + } + _lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences(); _lastGoodAvatarName = myAvatar->getFullAvatarModelName(); + savePreferences(); + close(); delete _marketplaceWindow; _marketplaceWindow = NULL; diff --git a/interface/src/ui/PreferencesDialog.h b/interface/src/ui/PreferencesDialog.h index 6d7a87b97c..1536eca3ee 100644 --- a/interface/src/ui/PreferencesDialog.h +++ b/interface/src/ui/PreferencesDialog.h @@ -49,6 +49,7 @@ private slots: void openFullAvatarModelBrowser(); void openSnapshotLocationBrowser(); void openScriptsLocationBrowser(); + void changeFullAvatarURL(); void fullAvatarURLChanged(const QString& newValue, const QString& modelName); }; From 6dbff93bbda38fd7e2eea4403d0259f04d0ba4b5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 7 Dec 2015 16:24:26 -0800 Subject: [PATCH 2/2] fix assert on model URL change from _renderItemsSet --- libraries/render-utils/src/Model.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index f566d0879d..193f3c04b5 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -544,6 +544,7 @@ void Model::removeFromScene(std::shared_ptr scene, render::Pendin pendingChanges.removeItem(item); } _renderItems.clear(); + _renderItemsSet.clear(); _readyWhenAdded = false; }