mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 03:57:04 +02:00
first simple pass at using marketplace windows in preferences
This commit is contained in:
parent
3ed097ff86
commit
d68143675a
5 changed files with 48 additions and 14 deletions
|
@ -3724,22 +3724,27 @@ bool Application::askToSetAvatarUrl(const QString& url) {
|
|||
_myAvatar->setFaceModelURL(url);
|
||||
UserActivityLogger::getInstance().changedModel("head", url);
|
||||
_myAvatar->sendIdentityPacket();
|
||||
emit faceURLChanged(url);
|
||||
} else if (msgBox.clickedButton() == bodyButton) {
|
||||
qDebug() << "Chose to use for body: " << url;
|
||||
_myAvatar->setSkeletonModelURL(url);
|
||||
// if the head is empty, reset it to the default head.
|
||||
if (_myAvatar->getFaceModelURLString().isEmpty()) {
|
||||
_myAvatar->setFaceModelURL(DEFAULT_HEAD_MODEL_URL);
|
||||
emit faceURLChanged(DEFAULT_HEAD_MODEL_URL.toString());
|
||||
UserActivityLogger::getInstance().changedModel("head", DEFAULT_HEAD_MODEL_URL.toString());
|
||||
}
|
||||
UserActivityLogger::getInstance().changedModel("skeleton", url);
|
||||
_myAvatar->sendIdentityPacket();
|
||||
emit skeletonURLChanged(url);
|
||||
} else if (msgBox.clickedButton() == bodyAndHeadButton) {
|
||||
qDebug() << "Chose to use for body + head: " << url;
|
||||
_myAvatar->setFaceModelURL(QString());
|
||||
_myAvatar->setSkeletonModelURL(url);
|
||||
UserActivityLogger::getInstance().changedModel("skeleton", url);
|
||||
_myAvatar->sendIdentityPacket();
|
||||
emit faceURLChanged(QString());
|
||||
emit skeletonURLChanged(url);
|
||||
} else {
|
||||
qDebug() << "Declined to use the avatar: " << url;
|
||||
}
|
||||
|
|
|
@ -336,6 +336,9 @@ signals:
|
|||
void checkBackgroundDownloads();
|
||||
void domainConnectionRefused(const QString& reason);
|
||||
|
||||
void faceURLChanged(const QString& newValue);
|
||||
void skeletonURLChanged(const QString& newValue);
|
||||
|
||||
public slots:
|
||||
void domainChanged(const QString& domainHostname);
|
||||
void updateWindowTitle();
|
||||
|
|
|
@ -54,6 +54,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
|||
|
||||
_windowWidget = dockWidget;
|
||||
} else {
|
||||
|
||||
_windowWidget = new QWidget(Application::getInstance()->getWindow(), Qt::Window);
|
||||
_windowWidget->setWindowTitle(title);
|
||||
_windowWidget->setMinimumSize(width, height);
|
||||
|
@ -89,24 +90,24 @@ void WebWindowClass::setVisible(bool visible) {
|
|||
if (visible) {
|
||||
if (_isToolWindow) {
|
||||
QMetaObject::invokeMethod(
|
||||
Application::getInstance()->getToolWindow(), "setVisible", Qt::BlockingQueuedConnection, Q_ARG(bool, visible));
|
||||
Application::getInstance()->getToolWindow(), "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
||||
} else {
|
||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::BlockingQueuedConnection);
|
||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::AutoConnection);
|
||||
}
|
||||
}
|
||||
QMetaObject::invokeMethod(_windowWidget, "setVisible", Qt::BlockingQueuedConnection, Q_ARG(bool, visible));
|
||||
QMetaObject::invokeMethod(_windowWidget, "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
||||
}
|
||||
|
||||
void WebWindowClass::setURL(const QString& url) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setURL", Qt::BlockingQueuedConnection, Q_ARG(QString, url));
|
||||
QMetaObject::invokeMethod(this, "setURL", Qt::AutoConnection, Q_ARG(QString, url));
|
||||
return;
|
||||
}
|
||||
_webView->setUrl(url);
|
||||
}
|
||||
|
||||
void WebWindowClass::raise() {
|
||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::BlockingQueuedConnection);
|
||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::AutoConnection);
|
||||
}
|
||||
|
||||
QScriptValue WebWindowClass::constructor(QScriptContext* context, QScriptEngine* engine) {
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
#include "MainWindow.h"
|
||||
#include "LODManager.h"
|
||||
#include "Menu.h"
|
||||
#include "ModelsBrowser.h"
|
||||
#include "PreferencesDialog.h"
|
||||
#include "Snapshot.h"
|
||||
#include "UserActivityLogger.h"
|
||||
#include "UIUtil.h"
|
||||
|
||||
|
||||
const int PREFERENCES_HEIGHT_PADDING = 20;
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
||||
|
@ -46,6 +46,11 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
|||
connect(ui.buttonBrowseScriptsLocation, &QPushButton::clicked, this, &PreferencesDialog::openScriptsLocationBrowser);
|
||||
connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked,
|
||||
Application::getInstance(), &Application::loadDefaultScripts);
|
||||
|
||||
|
||||
connect(Application::getInstance(), &Application::faceURLChanged, this, &PreferencesDialog::faceURLChanged);
|
||||
connect(Application::getInstance(), &Application::skeletonURLChanged, this, &PreferencesDialog::skeletonURLChanged);
|
||||
|
||||
// move dialog to left side
|
||||
move(parentWidget()->geometry().topLeft());
|
||||
setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING);
|
||||
|
@ -53,9 +58,19 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
|||
UIUtil::scaleWidgetFontSizes(this);
|
||||
}
|
||||
|
||||
void PreferencesDialog::faceURLChanged(const QString& newValue) {
|
||||
ui.faceURLEdit->setText(newValue);
|
||||
}
|
||||
|
||||
void PreferencesDialog::skeletonURLChanged(const QString& newValue) {
|
||||
ui.skeletonURLEdit->setText(newValue);
|
||||
}
|
||||
|
||||
void PreferencesDialog::accept() {
|
||||
savePreferences();
|
||||
close();
|
||||
delete _marketplaceWindow;
|
||||
_marketplaceWindow = NULL;
|
||||
}
|
||||
|
||||
void PreferencesDialog::setHeadUrl(QString modelUrl) {
|
||||
|
@ -67,15 +82,19 @@ void PreferencesDialog::setSkeletonUrl(QString modelUrl) {
|
|||
}
|
||||
|
||||
void PreferencesDialog::openHeadModelBrowser() {
|
||||
ModelsBrowser modelBrowser(FSTReader::HEAD_MODEL);
|
||||
connect(&modelBrowser, &ModelsBrowser::selected, this, &PreferencesDialog::setHeadUrl);
|
||||
modelBrowser.browse();
|
||||
auto MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace?category=avatars";
|
||||
if (!_marketplaceWindow) {
|
||||
_marketplaceWindow = new WebWindowClass("Marketplace", MARKETPLACE_URL, 900, 700, false);
|
||||
}
|
||||
_marketplaceWindow->setVisible(true);
|
||||
}
|
||||
|
||||
void PreferencesDialog::openBodyModelBrowser() {
|
||||
ModelsBrowser modelBrowser(FSTReader::HEAD_AND_BODY_MODEL);
|
||||
connect(&modelBrowser, &ModelsBrowser::selected, this, &PreferencesDialog::setSkeletonUrl);
|
||||
modelBrowser.browse();
|
||||
auto MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace?category=avatars";
|
||||
if (!_marketplaceWindow) {
|
||||
_marketplaceWindow = new WebWindowClass("Marketplace", MARKETPLACE_URL, 900, 700, false);
|
||||
}
|
||||
_marketplaceWindow->setVisible(true);
|
||||
}
|
||||
|
||||
void PreferencesDialog::openSnapshotLocationBrowser() {
|
||||
|
@ -196,7 +215,7 @@ void PreferencesDialog::savePreferences() {
|
|||
QUrl faceModelURL(ui.faceURLEdit->text());
|
||||
QString faceModelURLString = faceModelURL.toString();
|
||||
if (faceModelURLString != _faceURLString) {
|
||||
if (faceModelURLString.isEmpty() || faceModelURLString.toLower().endsWith(".fst")) {
|
||||
if (faceModelURLString.isEmpty() || faceModelURLString.toLower().contains(".fst")) {
|
||||
// change the faceModelURL in the profile, it will also update this user's BlendFace
|
||||
myAvatar->setFaceModelURL(faceModelURL);
|
||||
UserActivityLogger::getInstance().changedModel("head", faceModelURLString);
|
||||
|
@ -209,7 +228,7 @@ void PreferencesDialog::savePreferences() {
|
|||
QUrl skeletonModelURL(ui.skeletonURLEdit->text());
|
||||
QString skeletonModelURLString = skeletonModelURL.toString();
|
||||
if (skeletonModelURLString != _skeletonURLString) {
|
||||
if (skeletonModelURLString.isEmpty() || skeletonModelURLString.toLower().endsWith(".fst")) {
|
||||
if (skeletonModelURLString.isEmpty() || skeletonModelURLString.toLower().contains(".fst")) {
|
||||
// change the skeletonModelURL in the profile, it will also update this user's Body
|
||||
myAvatar->setSkeletonModelURL(skeletonModelURL);
|
||||
UserActivityLogger::getInstance().changedModel("skeleton", skeletonModelURLString);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include <QDialog>
|
||||
#include <QString>
|
||||
|
||||
#include "scripting/WebWindowClass.h"
|
||||
|
||||
class PreferencesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -36,6 +38,8 @@ private:
|
|||
QString _faceURLString;
|
||||
QString _skeletonURLString;
|
||||
QString _displayNameString;
|
||||
|
||||
WebWindowClass* _marketplaceWindow = NULL;
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
|
@ -43,6 +47,8 @@ private slots:
|
|||
void setSkeletonUrl(QString modelUrl);
|
||||
void openSnapshotLocationBrowser();
|
||||
void openScriptsLocationBrowser();
|
||||
void faceURLChanged(const QString& newValue);
|
||||
void skeletonURLChanged(const QString& newValue);
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue