more tweaks to preferences UI

This commit is contained in:
ZappoMan 2015-04-14 12:38:29 -07:00
parent 9262585bab
commit 174e9f2133
7 changed files with 46 additions and 17 deletions

View file

@ -943,6 +943,29 @@ void MyAvatar::clearJointAnimationPriorities() {
} }
} }
QString MyAvatar::getModelDescription() const {
QString result;
if (_useFullAvatar) {
if (!getFullAvartarModelName().isEmpty()) {
result = "Full Avatar \"" + getFullAvartarModelName() + "\"";
} else {
result = "Full Avatar \"" + _fullAvatarURLFromPreferences.fileName() + "\"";
}
} else {
if (!getHeadModelName().isEmpty()) {
result = "Head \"" + getHeadModelName() + "\"";
} else {
result = "Head \"" + _headURLFromPreferences.fileName() + "\"";
}
if (!getBodyModelName().isEmpty()) {
result += " and Body \"" + getBodyModelName() + "\"";
} else {
result += " and Body \"" + _skeletonURLFromPreferences.fileName() + "\"";
}
}
return result;
}
void MyAvatar::setFaceModelURL(const QUrl& faceModelURL) { void MyAvatar::setFaceModelURL(const QUrl& faceModelURL) {
Avatar::setFaceModelURL(faceModelURL); Avatar::setFaceModelURL(faceModelURL);
_billboardValid = false; _billboardValid = false;

View file

@ -131,6 +131,8 @@ public:
const QString& getBodyModelName() const { return _bodyModelName; } const QString& getBodyModelName() const { return _bodyModelName; }
const QString& getFullAvartarModelName() const { return _fullAvatarModelName; } const QString& getFullAvartarModelName() const { return _fullAvatarModelName; }
QString getModelDescription() const;
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData); virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData);
virtual glm::vec3 getSkeletonPosition() const; virtual glm::vec3 getSkeletonPosition() const;

View file

@ -26,9 +26,8 @@
#include "Snapshot.h" #include "Snapshot.h"
#include "UserActivityLogger.h" #include "UserActivityLogger.h"
#include "UIUtil.h" #include "UIUtil.h"
#include "ui/DialogsManager.h"
#include "ui/PreferencesDialog.h"
const int PREFERENCES_HEIGHT_PADDING = 20;
AvatarAppearanceDialog::AvatarAppearanceDialog(QWidget* parent) : AvatarAppearanceDialog::AvatarAppearanceDialog(QWidget* parent) :
QDialog(parent) { QDialog(parent) {
@ -52,10 +51,6 @@ AvatarAppearanceDialog::AvatarAppearanceDialog(QWidget* parent) :
connect(Application::getInstance(), &Application::bodyURLChanged, this, &AvatarAppearanceDialog::bodyURLChanged); connect(Application::getInstance(), &Application::bodyURLChanged, this, &AvatarAppearanceDialog::bodyURLChanged);
connect(Application::getInstance(), &Application::fullAvatarURLChanged, this, &AvatarAppearanceDialog::fullAvatarURLChanged); connect(Application::getInstance(), &Application::fullAvatarURLChanged, this, &AvatarAppearanceDialog::fullAvatarURLChanged);
// move dialog to left side
//move(parentWidget()->geometry().topLeft());
//setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING);
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
ui.bodyNameLabel->setText("Body - " + myAvatar->getBodyModelName()); ui.bodyNameLabel->setText("Body - " + myAvatar->getBodyModelName());
@ -66,18 +61,16 @@ AvatarAppearanceDialog::AvatarAppearanceDialog(QWidget* parent) :
} }
void AvatarAppearanceDialog::useSeparateBodyAndHead(bool checked) { void AvatarAppearanceDialog::useSeparateBodyAndHead(bool checked) {
setUseFullAvatar(!checked);
QUrl headURL(ui.faceURLEdit->text()); QUrl headURL(ui.faceURLEdit->text());
QUrl bodyURL(ui.skeletonURLEdit->text()); QUrl bodyURL(ui.skeletonURLEdit->text());
DependencyManager::get<AvatarManager>()->getMyAvatar()->useHeadAndBodyURLs(headURL, bodyURL); DependencyManager::get<AvatarManager>()->getMyAvatar()->useHeadAndBodyURLs(headURL, bodyURL);
setUseFullAvatar(!checked);
} }
void AvatarAppearanceDialog::useFullAvatar(bool checked) { void AvatarAppearanceDialog::useFullAvatar(bool checked) {
setUseFullAvatar(checked);
QUrl fullAvatarURL(ui.fullAvatarURLEdit->text()); QUrl fullAvatarURL(ui.fullAvatarURLEdit->text());
DependencyManager::get<AvatarManager>()->getMyAvatar()->useFullAvatarURL(fullAvatarURL); DependencyManager::get<AvatarManager>()->getMyAvatar()->useFullAvatarURL(fullAvatarURL);
setUseFullAvatar(checked);
} }
void AvatarAppearanceDialog::setUseFullAvatar(bool useFullAvatar) { void AvatarAppearanceDialog::setUseFullAvatar(bool useFullAvatar) {
@ -88,6 +81,8 @@ void AvatarAppearanceDialog::setUseFullAvatar(bool useFullAvatar) {
ui.useFullAvatar->setChecked(_useFullAvatar); ui.useFullAvatar->setChecked(_useFullAvatar);
ui.useSeparateBodyAndHead->setChecked(!_useFullAvatar); ui.useSeparateBodyAndHead->setChecked(!_useFullAvatar);
DependencyManager::get<DialogsManager>()->getPreferencesDialog()->avatarDescriptionChanged();
} }
void AvatarAppearanceDialog::headURLChanged(const QString& newValue, const QString& modelName) { void AvatarAppearanceDialog::headURLChanged(const QString& newValue, const QString& modelName) {
@ -110,6 +105,9 @@ void AvatarAppearanceDialog::fullAvatarURLChanged(const QString& newValue, const
void AvatarAppearanceDialog::accept() { void AvatarAppearanceDialog::accept() {
saveAvatarAppearance(); saveAvatarAppearance();
DependencyManager::get<DialogsManager>()->getPreferencesDialog()->avatarDescriptionChanged();
close(); close();
delete _marketplaceWindow; delete _marketplaceWindow;
_marketplaceWindow = NULL; _marketplaceWindow = NULL;

View file

@ -58,6 +58,7 @@ private slots:
void useSeparateBodyAndHead(bool checked); void useSeparateBodyAndHead(bool checked);
void useFullAvatar(bool checked); void useFullAvatar(bool checked);
}; };
#endif // hifi_AvatarAppearanceDialog_h #endif // hifi_AvatarAppearanceDialog_h

View file

@ -44,6 +44,7 @@ public:
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; } QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; } QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; } QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
public slots: public slots:
void toggleAddressBar(); void toggleAddressBar();

View file

@ -57,23 +57,25 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
move(parentWidget()->geometry().topLeft()); move(parentWidget()->geometry().topLeft());
setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING);
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); ui.apperanceDescription->setText(DependencyManager::get<AvatarManager>()->getMyAvatar()->getModelDescription());
ui.apperanceDescription->setText("Body - " + myAvatar->getBodyModelName());
UIUtil::scaleWidgetFontSizes(this); UIUtil::scaleWidgetFontSizes(this);
} }
void PreferencesDialog::avatarDescriptionChanged() {
ui.apperanceDescription->setText(DependencyManager::get<AvatarManager>()->getMyAvatar()->getModelDescription());
}
void PreferencesDialog::headURLChanged(const QString& newValue, const QString& modelName) { void PreferencesDialog::headURLChanged(const QString& newValue, const QString& modelName) {
ui.apperanceDescription->setText("Head - " + modelName); ui.apperanceDescription->setText(DependencyManager::get<AvatarManager>()->getMyAvatar()->getModelDescription());
} }
void PreferencesDialog::bodyURLChanged(const QString& newValue, const QString& modelName) { void PreferencesDialog::bodyURLChanged(const QString& newValue, const QString& modelName) {
ui.apperanceDescription->setText("Body - " + modelName); ui.apperanceDescription->setText(DependencyManager::get<AvatarManager>()->getMyAvatar()->getModelDescription());
} }
void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QString& modelName) { void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QString& modelName) {
ui.apperanceDescription->setText("Full Avatar - " + modelName); ui.apperanceDescription->setText(DependencyManager::get<AvatarManager>()->getMyAvatar()->getModelDescription());
} }
void PreferencesDialog::accept() { void PreferencesDialog::accept() {

View file

@ -25,6 +25,8 @@ class PreferencesDialog : public QDialog {
public: public:
PreferencesDialog(QWidget* parent = nullptr); PreferencesDialog(QWidget* parent = nullptr);
void avatarDescriptionChanged();
protected: protected:
void resizeEvent(QResizeEvent* resizeEvent); void resizeEvent(QResizeEvent* resizeEvent);