mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 13:47:23 +02:00
getting dominant hand laser + sign up working
This commit is contained in:
parent
4d55081184
commit
cdee10d0b8
7 changed files with 65 additions and 23 deletions
|
@ -28,12 +28,6 @@ Item {
|
|||
|
||||
property bool withSteam: false
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
onKeyboardRaisedChanged: d.resize();
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property int minWidth: 480
|
||||
|
@ -55,8 +49,7 @@ Item {
|
|||
parent.width = root.width = newWidth;
|
||||
}
|
||||
|
||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + hifi.dimensions.contentSpacing.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,6 +257,9 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.keyboardEnabled = false;
|
||||
root.keyboardRaised = false;
|
||||
KeyboardScriptingInterface.raised = false;
|
||||
d.resize();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
|
|
|
@ -230,7 +230,7 @@ Item {
|
|||
// Alignment
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
visible: loggingInBody.withSteam;
|
||||
visible: false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,19 +262,20 @@ Item {
|
|||
|
||||
onHandleLoginFailed: {
|
||||
console.log("Login Failed")
|
||||
loggingInSpinner.visible = false;
|
||||
var errorString = "";
|
||||
if (loggingInBody.withSteam && loggingInBody.fromBody === "LinkAccountBody") {
|
||||
loggingInGlyph.visible = false;
|
||||
loggingInText.text = "Your Steam authentication has failed. Please make sure you are logged into Steam and try again."
|
||||
loggingInText.width = loggingInBody.width;
|
||||
loggingInText.wrapMode = Text.WordWrap;
|
||||
loggingInText.anchors.centerIn = loggingInHeader;
|
||||
loggingInText.anchors.bottom = loggingInHeader.bottom;
|
||||
steamFailureTimer.start();
|
||||
} else if (loggingInBody.withSteam) {
|
||||
errorString = "Your Steam authentication has failed. Please make sure you are logged into Steam and try again.";
|
||||
bodyLoader.setSource("UsernameCollisionBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": errorString });
|
||||
} else {
|
||||
errorString = loginDialog.isLogIn ? "Username or password is incorrect." : "Failed to sign up. Please try again.";
|
||||
errorString = "Username or password is incorrect.";
|
||||
if (loginDialog.isLogIn && loginDialog.isSteamRunning()) {
|
||||
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
} else {
|
||||
|
|
|
@ -65,7 +65,8 @@ Item {
|
|||
if (loginDialog.isLogIn) {
|
||||
loginDialog.login(emailField.text, passwordField.text);
|
||||
} else {
|
||||
loginDialog.signup(usernameField.text, emailField.text, passwordField.text);
|
||||
loginDialog.signup(emailField.text, usernameField.text, passwordField.text);
|
||||
return;
|
||||
}
|
||||
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "fromBody": "" });
|
||||
}
|
||||
|
@ -484,4 +485,23 @@ Item {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: loginDialog
|
||||
onHandleSignupCompleted: {
|
||||
console.log("Sign Up Completed");
|
||||
|
||||
loginDialog.login(usernameField.text, passwordField.text);
|
||||
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "fromBody": "" });
|
||||
}
|
||||
onHandleSignupFailed: {
|
||||
console.log("Sign Up Failed")
|
||||
|
||||
loginErrorMessage.visible = (errorString !== "");
|
||||
if (errorString !== "") {
|
||||
loginErrorMessage.text = errorString;
|
||||
errorContainer.anchors.bottom = loginDialog.isLogIn ? emailField.top : usernameField.top;
|
||||
errorContainer.anchors.left = emailField.left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1316,6 +1316,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateSystemTabletMode);
|
||||
connect(this, &Application::activeDisplayPluginChanged, this, [&](){
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
auto keyboard = DependencyManager::get<Keyboard>();
|
||||
if (getLoginDialogPoppedUp()) {
|
||||
if (_firstRun.get()) {
|
||||
// display mode changed. Don't allow auto-switch to work after this session.
|
||||
|
@ -1327,6 +1328,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
createLoginDialogOverlay();
|
||||
} else {
|
||||
// Desktop mode.
|
||||
QVariantMap properties{
|
||||
{ "parentID", QUuid() }
|
||||
};
|
||||
getOverlays().editOverlay(keyboard->getAnchorID(), properties);
|
||||
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
||||
_loginDialogOverlayID = OverlayID();
|
||||
_loginStateManager.tearDown();
|
||||
|
@ -6251,7 +6256,7 @@ void Application::update(float deltaTime) {
|
|||
_overlays.update(deltaTime);
|
||||
}
|
||||
if (!_loginDialogOverlayID.isNull()) {
|
||||
_loginStateManager.update();
|
||||
_loginStateManager.update(getMyAvatar()->getDominantHand());
|
||||
}
|
||||
|
||||
if (!_loginDialogOverlayID.isNull()) {
|
||||
|
@ -8662,7 +8667,7 @@ void Application::createLoginDialogOverlay() {
|
|||
QVariantMap properties {
|
||||
{ "parentID", _loginDialogOverlayID },
|
||||
{ "localPosition", vec3toVariant(glm::vec3(-0.3f, -0.3f, 0.2f)) },
|
||||
{ "localOrientation", quatToVariant(glm::quat(0.0f, 0.0, 1.0f, 0.0f)) }
|
||||
{ "localOrientation", quatToVariant(glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
||||
};
|
||||
getOverlays().editOverlay(keyboard->getAnchorID(), properties);
|
||||
keyboard->setResetKeyboardPositionOnRaise(false);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "controllers/StateController.h"
|
||||
#include "controllers/UserInputMapper.h"
|
||||
#include "raypick/PointerScriptingInterface.h"
|
||||
#include "raypick/RayPickScriptingInterface.h"
|
||||
#include "raypick/PickScriptingInterface.h"
|
||||
#include "scripting/ControllerScriptingInterface.h"
|
||||
|
||||
|
@ -209,15 +210,29 @@ void LoginStateManager::setUp() {
|
|||
pointers->enablePointer(_rightLoginPointerID);
|
||||
}
|
||||
|
||||
void LoginStateManager::update() {
|
||||
void LoginStateManager::update(const QString dominantHand) {
|
||||
if (!isSetUp()) {
|
||||
return;
|
||||
}
|
||||
if (_dominantHand != dominantHand) {
|
||||
_dominantHand = dominantHand;
|
||||
}
|
||||
auto pointers = DependencyManager::get<PointerScriptingInterface>();
|
||||
if (pointers) {
|
||||
auto raypicks = DependencyManager::get<RayPickScriptingInterface>();
|
||||
if (pointers && raypicks) {
|
||||
QString mode = "full";
|
||||
|
||||
if (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) {
|
||||
auto rightObjectID = raypicks->getPrevRayPickResult(_rightLoginPointerID)["objectID"].toUuid();
|
||||
auto leftObjectID = raypicks->getPrevRayPickResult(_leftLoginPointerID)["objectID"].toUuid();
|
||||
if (_dominantHand == "left" && !leftObjectID.isNull()) {
|
||||
// dominant is left.
|
||||
pointers->setRenderState(_rightLoginPointerID, "");
|
||||
pointers->setRenderState(_leftLoginPointerID, mode);
|
||||
} else if (_dominantHand == "right" && !rightObjectID.isNull()) {
|
||||
// dominant is right.
|
||||
pointers->setRenderState(_leftLoginPointerID, "");
|
||||
pointers->setRenderState(_rightLoginPointerID, mode);
|
||||
} else {
|
||||
pointers->setRenderState(_leftLoginPointerID, mode);
|
||||
}
|
||||
if (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID) {
|
||||
pointers->setRenderState(_rightLoginPointerID, mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,12 @@ public:
|
|||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
void update();
|
||||
void update(const QString dominantHand);
|
||||
|
||||
bool isSetUp() const { return (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) && (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID); }
|
||||
|
||||
private:
|
||||
QString _dominantHand;
|
||||
QList<QVariant> _renderStates {};
|
||||
QList<QVariant> _defaultRenderStates {};
|
||||
unsigned int _leftLoginPointerID { PointerEvent::INVALID_POINTER_ID };
|
||||
|
|
|
@ -196,13 +196,17 @@ void LoginDialog::openUrl(const QString& url) const {
|
|||
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||
newObject->setProperty("url", url);
|
||||
});
|
||||
LoginDialog::hide();
|
||||
if (!qApp->getLoginDialogPoppedUp()) {
|
||||
LoginDialog::hide();
|
||||
}
|
||||
} else {
|
||||
if (!hmd->getShouldShowTablet() && !qApp->isHMDMode()) {
|
||||
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||
newObject->setProperty("url", url);
|
||||
});
|
||||
LoginDialog::hide();
|
||||
if (!qApp->getLoginDialogPoppedUp()) {
|
||||
LoginDialog::hide();
|
||||
}
|
||||
} else {
|
||||
tablet->gotoWebScreen(url);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue