overlay HMD implementation

This commit is contained in:
Wayne Chen 2018-10-31 15:26:49 -07:00
parent 67539bc87a
commit f62c8ae87a
15 changed files with 268 additions and 268 deletions

View file

@ -132,7 +132,7 @@ Windows.Window {
import QtQuick 2.3;
import QtQuick.Window 2.3;
Window {
Windows.Window {
id: root;
Rectangle {
color: hifi.colors.baseGray

View file

@ -17,16 +17,11 @@ import "windows" as Windows
import "LoginDialog"
Rectangle {
FocusScope {
id: root
HifiStylesUit.HifiConstants { id: hifi }
objectName: "LoginDialog"
// implicitWidth: 520
// implicitHeight: 320
// destroyOnCloseButton: true
// destroyOnHidden: true
visible: true
// frame: Item {}
anchors.fill: parent
@ -87,5 +82,4 @@ Rectangle {
Component.onCompleted: {
bodyLoader.setSource("LoginDialog/LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
}
}

View file

@ -18,8 +18,8 @@ import "qrc:////qml//styles-uit" as HifiStylesUit
Item {
id: completeProfileBody
clip: true
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
readonly property string termsContainerText: qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service")
readonly property string fontFamily: "Cairo"
readonly property int fontSize: 24
@ -40,17 +40,17 @@ Item {
if (root.isTablet === false) {
var targetWidth = Math.max(Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth,
termsContainer.contentWidth)), mainContainer.width)
parent.width = root.pane.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
}
var targetHeight = Math.max(5 * hifi.dimensions.contentSpacing.y + d.minHeightButton + additionalTextContainer.height + termsContainer.height, d.maxHeight)
parent.height = root.pane.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
}
}
Item {
id: mainContainer
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize();
Rectangle {

View file

@ -40,15 +40,17 @@ Item {
id: d
readonly property int minWidth: 480
readonly property int minWidthButton: !root.isTablet ? 256 : 174
property int maxWidth: root.isTablet ? 1280 : Window.innerWidth
// property int maxWidth: root.isTablet ? 1280 : Window.innerWidth
property int maxWidth: root.isTablet ? 1280 : root.width
readonly property int minHeight: 120
readonly property int minHeightButton: !root.isTablet ? 56 : 42
property int maxHeight: root.isTablet ? 720 : Window.innerHeight
// property int maxHeight: root.isTablet ? 720 : Window.innerHeight
property int maxHeight: root.isTablet ? 720 : root.height
function resize() {
maxWidth = root.isTablet ? 1280 : Window.innerWidth;
maxHeight = root.isTablet ? 720 : Window.innerHeight;
var targetWidth = Math.max(Math.max(titleWidth, topContainer.width), bottomContainer.width);
maxWidth = root.isTablet ? 1280 : root.width;
maxHeight = root.isTablet ? 720 : root.height;
var targetWidth = Math.max(titleWidth, topContainer.width);
var targetHeight = hifi.dimensions.contentSpacing.y + topContainer.height + bottomContainer.height +
4 * hifi.dimensions.contentSpacing.y;
@ -73,199 +75,203 @@ Item {
bodyLoader.setSource("SignInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": "" });
}
}
Item {
id: topContainer
width: root.width
height: 0.6 * root.height
id: mainContainer
anchors.fill: parent
onHeightChanged: d.resize(); onWidthChanged: d.resize();
anchors {
top: parent.top
left: parent.left
right: parent.right
}
Rectangle {
id: topOpaqueRect
height: parent.height
width: parent.width
opacity: 0.9
color: "black"
visible: false
}
Item {
id: bannerContainer
width: parent.width
height: banner.height
id: topContainer
width: root.width
height: 0.6 * root.height
anchors {
top: parent.top
topMargin: 85
}
Image {
id: banner
anchors.centerIn: parent
source: "../../images/high-fidelity-banner.svg"
horizontalAlignment: Image.AlignHCenter
}
}
Item {
id: splashContainer
width: parent.width
anchors.fill: parent
visible: true
Text {
id: flavorText
text: qsTr("BE ANYWHERE, WITH ANYONE RIGHT NOW")
width: 0.48 * parent.width
anchors.centerIn: parent
anchors {
top: banner.bottom
topMargin: 0.1 * parent.height
}
wrapMode: Text.WordWrap
lineHeight: 0.5
color: "white"
font.family: linkAccountBody.fontFamily
font.pixelSize: !root.isTablet ? 2 * linkAccountBody.fontSize : linkAccountBody.fontSize
font.bold: linkAccountBody.fontBold
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
left: parent.left
right: parent.right
}
HifiControlsUit.Button {
id: signUpButton
text: qsTr("Sign Up")
width: d.minWidthButton
height: d.minHeightButton
color: hifi.buttons.blue
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
anchors {
bottom: parent.bottom
bottomMargin: 0.1 * parent.height
left: parent.left
leftMargin: (parent.width - d.minWidthButton) / 2
}
onClicked: {
linkAccountBody.withSteam = false;
toggleSignIn(false);
}
Rectangle {
id: topOpaqueRect
height: parent.height
width: parent.width
opacity: 0.9
color: "black"
visible: false
}
}
}
Item {
id: bottomContainer
width: root.width
height: 0.4 * root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize();
anchors {
top: topContainer.bottom
left: parent.left
right: parent.right
}
Rectangle {
id: bottomOpaqueRect
height: parent.height
width: parent.width
opacity: 0.9
color: "black"
}
Item {
id: bottomButtonsContainer
width: parent.width
height: parent.height
HifiControlsUit.Button {
id: loginButton
width: d.minWidthButton
height: d.minHeightButton
text: qsTr("Log In")
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
Item {
id: bannerContainer
width: parent.width
height: banner.height
anchors {
top: parent.top
topMargin: (parent.height / 2) - loginButton.height
left: parent.left
leftMargin: (parent.width - loginButton.width) / 2
topMargin: 85
}
Image {
id: banner
anchors.centerIn: parent
source: "../../images/high-fidelity-banner.svg"
horizontalAlignment: Image.AlignHCenter
}
}
Item {
id: splashContainer
width: parent.width
anchors.fill: parent
visible: true
Text {
id: flavorText
text: qsTr("BE ANYWHERE, WITH ANYONE RIGHT NOW")
width: 0.48 * parent.width
anchors.centerIn: parent
anchors {
top: banner.bottom
topMargin: 0.1 * parent.height
}
wrapMode: Text.WordWrap
lineHeight: 0.5
// TODO change back to white when background is chosen
// color: "white"
color: "black"
font.family: linkAccountBody.fontFamily
font.pixelSize: !root.isTablet ? 2 * linkAccountBody.fontSize : linkAccountBody.fontSize
font.bold: linkAccountBody.fontBold
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
}
onClicked: {
linkAccountBody.withSteam = false;
toggleSignIn(true);
HifiControlsUit.Button {
id: signUpButton
text: qsTr("Sign Up")
width: d.minWidthButton
height: d.minHeightButton
color: hifi.buttons.blue
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
anchors {
bottom: parent.bottom
bottomMargin: 0.1 * parent.height
left: parent.left
leftMargin: (parent.width - d.minWidthButton) / 2
}
onClicked: {
linkAccountBody.withSteam = false;
toggleSignIn(false);
}
}
}
TextMetrics {
id: steamLoginButtonTextMetrics
font: dismissText.font
text: qsTr("STEAM LOG IN")
}
HifiControlsUit.Button {
id: steamLoginButton;
// textWidth + size of glyph + rightMargin
width: Math.max(d.minWidthButton, steamLoginButtonTextMetrics.width + 34 + buttonGlyphRightMargin + 2 * hifi.dimensions.contentSpacing.x);
height: d.minHeightButton
color: hifi.buttons.black;
anchors {
top: loginButton.bottom
topMargin: hifi.dimensions.contentSpacing.y
left: parent.left
leftMargin: (parent.width - steamLoginButton.width) / 2
}
text: qsTr("Steam Log In")
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
buttonGlyph: hifi.glyphs.steamSquare
buttonGlyphRightMargin: 10
onClicked: {
linkAccountBody.withSteam = true;
toggleSignIn(true);
}
visible: loginDialog.isSteamRunning();
}
}
Item {
id: dismissTextContainer
width: dismissText.width
height: dismissText.height
id: bottomContainer
width: root.width
height: 0.4 * root.height
anchors {
bottom: parent.bottom
top: topContainer.bottom
left: parent.left
right: parent.right
margins: 10
}
visible: !root.isTablet && !HMD.active
Text {
id: dismissText
text: qsTr("No thanks, take me in-world! >")
lineHeight: 1
color: "white"
font.family: linkAccountBody.fontFamily
font.pixelSize: linkAccountBody.fontSize
font.bold: linkAccountBody.fontBold
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
Rectangle {
id: bottomOpaqueRect
height: parent.height
width: parent.width
opacity: 0.9
color: "black"
}
MouseArea {
id: dismissMouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
if (loginDialog.getLoginDialogPoppedUp()) {
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
var data = {
"action": "user dismissed login screen"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
loginDialog.dismissLoginDialog();
Item {
id: bottomButtonsContainer
width: parent.width
height: parent.height
HifiControlsUit.Button {
id: loginButton
width: d.minWidthButton
height: d.minHeightButton
text: qsTr("Log In")
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
anchors {
top: parent.top
topMargin: (parent.height / 2) - loginButton.height
left: parent.left
leftMargin: (parent.width - loginButton.width) / 2
}
onClicked: {
linkAccountBody.withSteam = false;
toggleSignIn(true);
}
}
TextMetrics {
id: steamLoginButtonTextMetrics
font: dismissText.font
text: qsTr("STEAM LOG IN")
}
HifiControlsUit.Button {
id: steamLoginButton;
// textWidth + size of glyph + rightMargin
width: Math.max(d.minWidthButton, steamLoginButtonTextMetrics.width + 34 + buttonGlyphRightMargin + 2 * hifi.dimensions.contentSpacing.x);
height: d.minHeightButton
color: hifi.buttons.black;
anchors {
top: loginButton.bottom
topMargin: hifi.dimensions.contentSpacing.y
left: parent.left
leftMargin: (parent.width - steamLoginButton.width) / 2
}
text: qsTr("Steam Log In")
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
buttonGlyph: hifi.glyphs.steamSquare
buttonGlyphRightMargin: 10
onClicked: {
linkAccountBody.withSteam = true;
toggleSignIn(true);
}
visible: loginDialog.isSteamRunning();
}
}
Item {
id: dismissTextContainer
width: dismissText.width
height: dismissText.height
anchors {
bottom: parent.bottom
right: parent.right
margins: 10
}
visible: !root.isTablet
Text {
id: dismissText
text: qsTr("No thanks, take me in-world! >")
lineHeight: 1
color: "white"
font.family: linkAccountBody.fontFamily
font.pixelSize: linkAccountBody.fontSize
font.bold: linkAccountBody.fontBold
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
}
MouseArea {
id: dismissMouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
if (loginDialog.getLoginDialogPoppedUp()) {
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
var data = {
"action": "user dismissed login screen"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
loginDialog.dismissLoginDialog();
}
root.tryDestroy();
}
root.tryDestroy();
}
}
}

View file

@ -45,10 +45,10 @@ Item {
var newWidth = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
if (!isNaN(newWidth)) {
parent.width = root.pane.width = newWidth;
parent.width = root.width = newWidth;
}
parent.height = root.pane.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + hifi.dimensions.contentSpacing.y;
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + hifi.dimensions.contentSpacing.y;
}
}
@ -102,13 +102,13 @@ Item {
loggingInText.text = "You are now logged in!";
}
successTimer.start();
loginDialog.resumeLoading();
loginDialog.dismissLoginDialog();
}
Item {
id: mainContainer
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize();
Rectangle {

View file

@ -21,8 +21,8 @@ import TabletScriptingInterface 1.0
Item {
id: signInBody
clip: true
height: root.pane.height
width: root.pane.width
height: root.height
width: root.width
property int textFieldHeight: 31
property string fontFamily: "Cairo"
property int fontSize: 24
@ -40,14 +40,18 @@ Item {
id: d
readonly property int minWidth: 480
readonly property int minWidthButton: !root.isTablet ? 256 : 174
property int maxWidth: root.isTablet ? 1280 : Window.innerWidth
// property int maxWidth: root.isTablet ? 1280 : Window.innerWidth
property int maxWidth: root.isTablet ? 1280 : root.width
readonly property int minHeight: 120
readonly property int minHeightButton: !root.isTablet ? 56 : 42
property int maxHeight: root.isTablet ? 720 : Window.innerHeight
// property int maxHeight: root.isTablet ? 720 : Window.innerHeight
property int maxHeight: root.isTablet ? 720 : root.height
function resize() {
maxWidth = root.isTablet ? 1280 : Window.innerWidth;
maxHeight = root.isTablet ? 720 : Window.innerHeight;
// maxWidth = root.isTablet ? 1280 : Window.innerWidth;
maxWidth = root.isTablet ? 1280 : root.width;
// maxHeight = root.isTablet ? 720 : Window.innerHeight;
maxHeight = root.isTablet ? 720 : root.height;
var targetWidth = Math.max(titleWidth, mainContainer.width);
var targetHeight = hifi.dimensions.contentSpacing.y + mainContainer.height +
4 * hifi.dimensions.contentSpacing.y;
@ -86,10 +90,11 @@ Item {
loginButtonAtSignIn.text = "Log In";
loginButtonAtSignIn.color = hifi.buttons.black;
emailField.placeholderText = "Username or Email";
var savedUsername = Settings.getValue("wallet/savedUsername", "");
// var savedUsername = Settings.getValue("wallet/savedUsername", "");
var savedUsername = "";
emailField.text = savedUsername === "Unknown user" ? "" : savedUsername;
emailField.anchors.top = loginContainer.top;
emailField.anchors.topMargin = !root.isTablet ? 0.2 * root.pane.height : 0.24 * root.pane.height;
emailField.anchors.topMargin = !root.isTablet ? 0.2 * root.height : 0.24 * root.height;
cantAccessContainer.anchors.topMargin = !root.isTablet ? 3.5 * hifi.dimensions.contentSpacing.y : hifi.dimensions.contentSpacing.y;
} else {
loginButtonAtSignIn.text = "Sign Up";
@ -106,8 +111,8 @@ Item {
Item {
id: mainContainer
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize();
Rectangle {
@ -191,7 +196,8 @@ Item {
width: banner.width
height: signInBody.textFieldHeight
font.family: signInBody.fontFamily
text: Settings.getValue("wallet/savedUsername", "");
// text: Settings.getValue("wallet/savedUsername", "");
text: "";
anchors {
top: parent.top
left: parent.left
@ -200,7 +206,6 @@ Item {
focus: loginDialog.isLogIn
placeholderText: "Username or Email"
activeFocusOnPress: true
onHeightChanged: d.resize(); onWidthChanged: d.resize();
}
HifiControlsUit.TextField {
id: passwordField

View file

@ -18,8 +18,8 @@ import "qrc:////qml//styles-uit" as HifiStylesUit
Item {
id: usernameCollisionBody
clip: true
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
readonly property string fontFamily: "Cairo"
readonly property int fontSize: 24
readonly property bool fontBold: true
@ -55,16 +55,16 @@ Item {
hifi.dimensions.contentSpacing.y + textField.height +
hifi.dimensions.contentSpacing.y + buttons.height;
parent.width = root.pane.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
parent.height = root.pane.height = Math.max(Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)), mainContainer.height +
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
parent.height = root.height = Math.max(Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)), mainContainer.height +
(keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y));
}
}
Item {
id: mainContainer
width: root.pane.width
height: root.pane.height
width: root.width
height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize();
anchors.fill: parent

View file

@ -79,18 +79,6 @@ FocusScope {
}
}
HifiControlsUit.Keyboard {
id: loginKeyboard
raised: root.keyboardEnabled && root.keyboardRaised
numeric: root.punctuationMode
password: root.isPassword
anchors {
left: bodyLoader.left
right: bodyLoader.right
top: bodyLoader.bottom
}
}
Keys.onPressed: {
if (!visible) {
return

View file

@ -1,6 +1,6 @@
import QtQuick 2.7
import QtWebEngine 1.5;
import Qt.labs.settings 1.0
import Qt.labs.settings 1.0 as QtSettings
import QtQuick.Controls 2.3
@ -74,7 +74,7 @@ OriginalDesktop.Desktop {
shown: tablet.toolbarMode;
}
Settings {
QtSettings.Settings {
id: settings;
category: "toolbar";
property bool constrainToolbarToCenterX: true;

View file

@ -15,10 +15,10 @@ import Qt.labs.settings 1.0
import "../../styles-uit"
import "../../controls-uit" as HifiControls
import "../../windows"
import "../../windows" as Windows
import "../"
ScrollingWindow {
Windows.ScrollingWindow {
id: root
objectName: "RunningScripts"
title: "Running Scripts"
@ -45,7 +45,7 @@ ScrollingWindow {
Component {
id: letterBoxMessage
Window {
Windows.Window {
implicitWidth: 400
implicitHeight: 300
minSize: Qt.vector2d(424, 300)

View file

@ -378,6 +378,7 @@ static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStanda
Setting::Handle<int> maxOctreePacketsPerSecond{"maxOctreePPS", DEFAULT_MAX_OCTREE_PPS};
Setting::Handle<bool> loginDialogPoppedUp{"loginDialogPoppedUp", false};
static const QUrl OVERLAY_LOGIN_DIALOG_URL(PathUtils::qmlUrl("LoginDialog.qml"));
static const QString MARKETPLACE_CDN_HOSTNAME = "mpassets.highfidelity.com";
static const int INTERVAL_TO_CHECK_HMD_WORN_STATUS = 500; // milliseconds
@ -5194,14 +5195,15 @@ void Application::pauseUntilLoginDetermined() {
myAvatar->setEnableMeshVisible(false);
const auto& nodeList = DependencyManager::get<NodeList>();
// save interstitial mode setting until resuming.
_interstitialModeEnabled = nodeList->getDomainHandler().getInterstitialModeEnabled();
nodeList->getDomainHandler().setInterstitialModeEnabled(false);
// disconnect domain handler.
nodeList->getDomainHandler().disconnect();
Menu::getInstance()->setIsOptionChecked(MenuOption::Stats, false);
Menu::getInstance()->setVisible(false);
{
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
scriptEngines->reloadLocalFiles();
scriptEngines->loadControllerScripts();
}
}
@ -5260,6 +5262,7 @@ void Application::resumeAfterLoginDialogActionTaken() {
const auto& nodeList = DependencyManager::get<NodeList>();
// disconnect domain handler.
nodeList->getDomainHandler().setInterstitialModeEnabled(_interstitialModeEnabled);
nodeList->getDomainHandler().resetting();
Menu::getInstance()->setVisible(true);
@ -8495,9 +8498,36 @@ void Application::setShowBulletConstraintLimits(bool value) {
_physicsEngine->setShowBulletConstraintLimits(value);
}
void Application::createLoginDialogOverlay() {
auto avatarManager = DependencyManager::get<AvatarManager>();
auto myAvatar = avatarManager->getMyAvatar();
Overlays& overlays = qApp->getOverlays();
// DEFAULT_DPI / tablet scale percentage
float overlayDpi = 31.0f / (60 / 100.0f);
QVariantMap overlayProperties {
{ "name", "pleasework" },
{ "url", OVERLAY_LOGIN_DIALOG_URL },
{ "position", vec3toVariant(myAvatar->getHeadPosition() - glm::vec3(0.0f, -0.1f, 1.0f)) },
{ "orientation", quatToVariant(myAvatar->getWorldOrientation()) },
{ "isSolid", true },
{ "grabbable", false },
{ "ignorePickIntersection", false },
{ "alpha", 1.0 },
{ "dpi", overlayDpi },
{ "visible", true }
};
_loginDialogOverlayID = overlays.addOverlay("web3d", overlayProperties);
}
void Application::onDismissedLoginDialog() {
_loginDialogPoppedUp = false;
loginDialogPoppedUp.set(false);
if (!_loginDialogOverlayID.isNull()) {
// deleting overlay.
qDebug() << "Deleting overlay";
getOverlays().deleteOverlay(_loginDialogOverlayID);
}
resumeAfterLoginDialogActionTaken();
}

View file

@ -320,6 +320,7 @@ public:
void setOtherAvatarsReplicaCount(int count) { DependencyManager::get<AvatarHashMap>()->setReplicaCount(count); }
bool getLoginDialogPoppedUp() const { return _loginDialogPoppedUp; }
void createLoginDialogOverlay();
#if defined(Q_OS_ANDROID)
void beforeEnterBackground();
@ -682,6 +683,8 @@ private:
int _maxOctreePPS = DEFAULT_MAX_OCTREE_PPS;
bool _loginDialogPoppedUp = false;
bool _interstitialModeEnabled{ false };
OverlayID _loginDialogOverlayID;
quint64 _lastFaceTrackerUpdate;

View file

@ -29,12 +29,12 @@
#include "avatar/AvatarManager.h"
#include "scripting/HMDScriptingInterface.h"
#include "ui/overlays/Overlays.h"
#include "ui/overlays/Web3DOverlay.h"
#include "Constants.h"
HIFI_QML_DEF(LoginDialog)
static const QUrl TABLET_LOGIN_DIALOG_URL("dialogs/TabletLoginDialog.qml");
static const QUrl OVERLAY_LOGIN_DIALOG_URL("../LoginDialog.qml");
LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
auto accountManager = DependencyManager::get<AccountManager>();
@ -69,7 +69,7 @@ void LoginDialog::showWithSelection() {
} else {
if (qApp->getLoginDialogPoppedUp()) {
// pop up those overlay things.
createLoginDialogOverlay();
qApp->createLoginDialogOverlay();
return;
} else {
tablet->initialScreen(TABLET_LOGIN_DIALOG_URL);
@ -257,24 +257,6 @@ bool LoginDialog::getLoginDialogPoppedUp() const {
return qApp->getLoginDialogPoppedUp();
}
void LoginDialog::createLoginDialogOverlay() {
Overlays& overlays = qApp->getOverlays();
auto avatarManager = DependencyManager::get<AvatarManager>();
auto myAvatar = avatarManager->getMyAvatar();
QVariantMap overlayProperties {
{ "name", "" },
{ "visible", true },
{ "grabbable", false },
{ "ignoreRayIntersection", false },
{ "url", OVERLAY_LOGIN_DIALOG_URL },
{ "dimensions", myAvatar->getSessionUUID().toString() },
{}
};
overlays.addOverlay("web3d", overlayProperties);
}
QString errorStringFromAPIObject(const QJsonValue& apiObject) {
if (apiObject.isArray()) {
return apiObject.toArray()[0].toString();

View file

@ -14,13 +14,12 @@
#ifndef hifi_LoginDialog_h
#define hifi_LoginDialog_h
#include <QtCore/QUuid>
#include <OffscreenQmlDialog.h>
#include <SettingHandle.h>
#include "ui/overlays/Web3DOverlay.h"
class QNetworkReply;
class Web3DOverlay;
class LoginDialog : public OffscreenQmlDialog {
Q_OBJECT
@ -45,7 +44,7 @@ signals:
void handleCreateCompleted();
void handleCreateFailed(QString error);
void handleSignupCompleted();
void handleSignupFailed(QString errorString);
@ -58,7 +57,7 @@ public slots:
void createCompleted(QNetworkReply* reply);
void createFailed(QNetworkReply* reply);
void signupCompleted(QNetworkReply* reply);
void signupFailed(QNetworkReply* reply);
@ -71,7 +70,7 @@ protected slots:
Q_INVOKABLE void loginThroughSteam();
Q_INVOKABLE void linkSteam();
Q_INVOKABLE void createAccountFromSteam(QString username = QString());
Q_INVOKABLE void signup(const QString& email, const QString& username, const QString& password);
Q_INVOKABLE void openUrl(const QString& url) const;
@ -79,15 +78,10 @@ protected slots:
Q_INVOKABLE bool getLoginDialogPoppedUp() const;
private:
// for HMD mode on pop up.
static void createLoginDialogOverlay();
bool getIsLogIn() const { return _isLogIn; }
void setIsLogIn(const bool isLogIn) { _isLogIn = isLogIn; }
bool _isLogIn { false };
Web3DOverlay _loginDialogOverlay;
bool _isLogIn{ false };
};
#endif // hifi_LoginDialog_h
#endif // hifi_LoginDialog_h

View file

@ -229,8 +229,7 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) {
_webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
_webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
//_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
//_webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
if (isTablet) {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
@ -262,7 +261,6 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) {
_webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
_webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
_webSurface->getSurfaceContext()->setContextProperty("Render", AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get());
_webSurface->getSurfaceContext()->setContextProperty("Workload", qApp->getGameWorkload()._engine->getConfiguration().get());