mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 00:13:10 +02:00
change avatar URL when typing completed or accepted
This commit is contained in:
parent
f71d2d00d2
commit
4a0c6eebd8
2 changed files with 18 additions and 6 deletions
|
@ -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<AvatarManager>()->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<AvatarManager>()->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<AvatarManager>()->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;
|
||||
|
|
|
@ -49,6 +49,7 @@ private slots:
|
|||
void openFullAvatarModelBrowser();
|
||||
void openSnapshotLocationBrowser();
|
||||
void openScriptsLocationBrowser();
|
||||
void changeFullAvatarURL();
|
||||
void fullAvatarURLChanged(const QString& newValue, const QString& modelName);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue