diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index ca059a53da..e0f2ba14ff 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -24,11 +24,12 @@ #include #include #include -#include +#include #include #include #include +#include #include "Application.h" #include "Menu.h" @@ -36,6 +37,7 @@ #include "Util.h" #include "InfoView.h" #include "ui/MetavoxelEditor.h" +#include "ModelBrowser.h" Menu* Menu::_instance = NULL; @@ -692,6 +694,9 @@ void Menu::loginForCurrentDomain() { void Menu::editPreferences() { Application* applicationInstance = Application::getInstance(); + ModelBrowser browser; + + const QString BROWSE_BUTTON_TEXT = "Browse"; QDialog dialog(applicationInstance->getWindow()); dialog.setWindowTitle("Interface Preferences"); @@ -702,17 +707,33 @@ void Menu::editPreferences() { QFormLayout* form = new QFormLayout(); layout->addLayout(form, 1); + + QHBoxLayout headModelLayout; QString faceURLString = applicationInstance->getAvatar()->getHead()->getFaceModel().getURL().toString(); - QLineEdit* faceURLEdit = new QLineEdit(faceURLString); - faceURLEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); - faceURLEdit->setPlaceholderText(DEFAULT_HEAD_MODEL_URL.toString()); - form->addRow("Face URL:", faceURLEdit); - + QLineEdit headURLEdit(faceURLString); + QPushButton headBrowseButton(BROWSE_BUTTON_TEXT); + connect(&headBrowseButton, SIGNAL(clicked()), &browser, SLOT(browseHead())); + connect(&browser, SIGNAL(selectedHead(QString)), &headURLEdit, SLOT(setText(QString))); + headURLEdit.setReadOnly(true); + headURLEdit.setMinimumWidth(QLINE_MINIMUM_WIDTH); + headURLEdit.setPlaceholderText(DEFAULT_HEAD_MODEL_URL.toString()); + headModelLayout.addWidget(&headURLEdit); + headModelLayout.addWidget(&headBrowseButton); + form->addRow("Head URL:", &headModelLayout); + + QHBoxLayout skeletonModelLayout; QString skeletonURLString = applicationInstance->getAvatar()->getSkeletonModel().getURL().toString(); - QLineEdit* skeletonURLEdit = new QLineEdit(skeletonURLString); - skeletonURLEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); - skeletonURLEdit->setPlaceholderText(DEFAULT_BODY_MODEL_URL.toString()); - form->addRow("Skeleton URL:", skeletonURLEdit); + QLineEdit skeletonURLEdit(skeletonURLString); + QPushButton SkeletonBrowseButton(BROWSE_BUTTON_TEXT); + connect(&SkeletonBrowseButton, SIGNAL(clicked()), &browser, SLOT(browseSkeleton())); + connect(&browser, SIGNAL(selectedSkeleton(QString)), &skeletonURLEdit, SLOT(setText(QString))); + skeletonURLEdit.setReadOnly(true); + skeletonURLEdit.setMinimumWidth(QLINE_MINIMUM_WIDTH); + skeletonURLEdit.setPlaceholderText(DEFAULT_BODY_MODEL_URL.toString()); + skeletonModelLayout.addWidget(&skeletonURLEdit); + skeletonModelLayout.addWidget(&SkeletonBrowseButton); + form->addRow("Skeleton URL:", &skeletonModelLayout); + QString displayNameString = applicationInstance->getAvatar()->getDisplayName(); QLineEdit* displayNameEdit = new QLineEdit(displayNameString); @@ -774,21 +795,17 @@ void Menu::editPreferences() { int ret = dialog.exec(); if (ret == QDialog::Accepted) { - QUrl faceModelURL(faceURLEdit->text()); - bool shouldDispatchIdentityPacket = false; - if (faceModelURL.toString() != faceURLString) { + if (headURLEdit.text() != faceURLString && !headURLEdit.text().isEmpty()) { // change the faceModelURL in the profile, it will also update this user's BlendFace - applicationInstance->getAvatar()->setFaceModelURL(faceModelURL); + applicationInstance->getAvatar()->setFaceModelURL(QUrl(headURLEdit.text())); shouldDispatchIdentityPacket = true; } - QUrl skeletonModelURL(skeletonURLEdit->text()); - - if (skeletonModelURL.toString() != skeletonURLString) { + if (skeletonURLEdit.text() != skeletonURLString && !skeletonURLEdit.text().isEmpty()) { // change the skeletonModelURL in the profile, it will also update this user's Body - applicationInstance->getAvatar()->setSkeletonModelURL(skeletonModelURL); + applicationInstance->getAvatar()->setSkeletonModelURL(QUrl(skeletonURLEdit.text())); shouldDispatchIdentityPacket = true; }