mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
sfx to login mousearea/hiding desktop toolbar
This commit is contained in:
parent
cdee10d0b8
commit
d12655ed7b
7 changed files with 60 additions and 37 deletions
|
@ -14,6 +14,7 @@ import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
|||
|
||||
import controlsUit 1.0 as HifiControlsUit
|
||||
import stylesUit 1.0 as HifiStylesUit
|
||||
import TabletScriptingInterface 1.0
|
||||
|
||||
Item {
|
||||
id: completeProfileBody
|
||||
|
@ -150,11 +151,14 @@ Item {
|
|||
MouseArea {
|
||||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
}
|
||||
TextMetrics {
|
||||
id: profileButtonTextMetrics
|
||||
|
|
|
@ -15,6 +15,7 @@ import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
|||
|
||||
import controlsUit 1.0 as HifiControlsUit
|
||||
import stylesUit 1.0 as HifiStylesUit
|
||||
import TabletScriptingInterface 1.0
|
||||
|
||||
Item {
|
||||
id: linkAccountBody
|
||||
|
@ -240,7 +241,12 @@ Item {
|
|||
id: dismissMouseArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
if (loginDialog.getLoginDialogPoppedUp()) {
|
||||
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
|
||||
var data = {
|
||||
|
|
|
@ -409,7 +409,14 @@ Item {
|
|||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: {
|
||||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import QtQuick.Controls 1.4
|
|||
|
||||
import controlsUit 1.0 as HifiControlsUit
|
||||
import stylesUit 1.0 as HifiStylesUit
|
||||
import TabletScriptingInterface 1.0
|
||||
|
||||
Item {
|
||||
id: usernameCollisionBody
|
||||
|
@ -202,7 +203,12 @@ Item {
|
|||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,10 +87,6 @@ FocusScope {
|
|||
id: bodyLoader
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
loginKeyboard.raised = false;
|
||||
KeyboardScriptingInterface.raised = false;
|
||||
}
|
||||
|
||||
Image {
|
||||
|
@ -143,6 +139,7 @@ FocusScope {
|
|||
|
||||
Component.onDestruction: {
|
||||
loginKeyboard.raised = false;
|
||||
KeyboardScriptingInterface.raised = false;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
|
@ -1322,12 +1322,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
// display mode changed. Don't allow auto-switch to work after this session.
|
||||
_firstRun.set(false);
|
||||
}
|
||||
if (_loginDialogOverlayID.isNull()) {
|
||||
// HMD mode.
|
||||
if (isHMDMode()) {
|
||||
dialogsManager->hideLoginDialog();
|
||||
createLoginDialogOverlay();
|
||||
} else {
|
||||
// Desktop mode.
|
||||
QVariantMap properties{
|
||||
{ "parentID", QUuid() }
|
||||
};
|
||||
|
@ -1335,6 +1333,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
||||
_loginDialogOverlayID = OverlayID();
|
||||
_loginStateManager.tearDown();
|
||||
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
toolbar->writeProperty("visible", false);
|
||||
dialogsManager->showLoginDialog();
|
||||
}
|
||||
}
|
||||
|
@ -2946,6 +2946,10 @@ void Application::showLoginScreen() {
|
|||
auto accountManager = DependencyManager::get<AccountManager>();
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
if (!accountManager->isLoggedIn()) {
|
||||
if (!isHMDMode()) {
|
||||
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
toolbar->writeProperty("visible", false);
|
||||
}
|
||||
_loginDialogPoppedUp = true;
|
||||
dialogsManager->showLoginDialog();
|
||||
QJsonObject loginData = {};
|
||||
|
@ -5302,6 +5306,8 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
|||
return;
|
||||
}
|
||||
|
||||
updateSystemTabletMode();
|
||||
|
||||
getMyAvatar()->setEnableMeshVisible(true);
|
||||
|
||||
const auto& nodeList = DependencyManager::get<NodeList>();
|
||||
|
@ -6257,33 +6263,7 @@ void Application::update(float deltaTime) {
|
|||
}
|
||||
if (!_loginDialogOverlayID.isNull()) {
|
||||
_loginStateManager.update(getMyAvatar()->getDominantHand());
|
||||
}
|
||||
|
||||
if (!_loginDialogOverlayID.isNull()) {
|
||||
auto overlayPosition = getOverlays().getProperty(_loginDialogOverlayID, "position");
|
||||
auto overlayPositionVec = vec3FromVariant(overlayPosition.value);
|
||||
//auto avatarHeadPosition = myAvatar->getHeadPosition();
|
||||
//auto avatarHeadOrientation = myAvatar->getHeadOrientation();
|
||||
//auto headLookVec = avatarHeadOrientation * Vectors::FRONT;
|
||||
//auto overlayToHeadVec = positionVec - avatarHeadPosition;
|
||||
auto cameraPositionVec = _myCamera.getPosition();
|
||||
auto cameraOrientation = _myCamera.getOrientation();
|
||||
auto headLookVec = (cameraOrientation * Vectors::FRONT);
|
||||
auto overlayToHeadVec = overlayPositionVec - cameraPositionVec;
|
||||
//auto lookAtQuat = glm::inverse(glm::quat_cast(glm::lookAt(positionVec, avatarHeadPosition, avatarHeadOrientation * Vectors::UNIT_Y)));
|
||||
auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);
|
||||
auto upVec = myAvatar->getWorldOrientation() * Vectors::UNIT_Y;
|
||||
auto offset = headLookVec * 0.7f;
|
||||
auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f);
|
||||
auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
|
||||
|
||||
if (pointAngle > 30.0f) {
|
||||
QVariantMap properties {
|
||||
{"position", vec3toVariant(newOverlayPositionVec)},
|
||||
{"orientation", quatToVariant(newOverlayOrientation)}
|
||||
};
|
||||
getOverlays().editOverlay(_loginDialogOverlayID, properties);
|
||||
}
|
||||
updateLoginDialogOverlayPosition();
|
||||
}
|
||||
|
||||
// Update _viewFrustum with latest camera and view frustum data...
|
||||
|
@ -8677,6 +8657,28 @@ void Application::createLoginDialogOverlay() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::updateLoginDialogOverlayPosition() {
|
||||
auto overlayPosition = getOverlays().getProperty(_loginDialogOverlayID, "position");
|
||||
auto overlayPositionVec = vec3FromVariant(overlayPosition.value);
|
||||
auto cameraPositionVec = _myCamera.getPosition();
|
||||
auto cameraOrientation = _myCamera.getOrientation();
|
||||
auto headLookVec = (cameraOrientation * Vectors::FRONT);
|
||||
auto overlayToHeadVec = overlayPositionVec - cameraPositionVec;
|
||||
auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);
|
||||
auto upVec = getMyAvatar()->getWorldOrientation() * Vectors::UNIT_Y;
|
||||
auto offset = headLookVec * 0.7f;
|
||||
auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f);
|
||||
auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
|
||||
|
||||
if (pointAngle > 30.0f) {
|
||||
QVariantMap properties {
|
||||
{"position", vec3toVariant(newOverlayPositionVec)},
|
||||
{"orientation", quatToVariant(newOverlayOrientation)}
|
||||
};
|
||||
getOverlays().editOverlay(_loginDialogOverlayID, properties);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::onDismissedLoginDialog() {
|
||||
_loginDialogPoppedUp = false;
|
||||
loginDialogPoppedUp.set(false);
|
||||
|
@ -8846,7 +8848,7 @@ void Application::updateThreadPoolCount() const {
|
|||
}
|
||||
|
||||
void Application::updateSystemTabletMode() {
|
||||
if (_settingsLoaded) {
|
||||
if (_settingsLoaded && !getLoginDialogPoppedUp()) {
|
||||
qApp->setProperty(hifi::properties::HMD, isHMDMode());
|
||||
if (isHMDMode()) {
|
||||
DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getHmdTabletBecomesToolbarSetting());
|
||||
|
|
|
@ -324,6 +324,7 @@ public:
|
|||
|
||||
bool getLoginDialogPoppedUp() const { return _loginDialogPoppedUp; }
|
||||
void createLoginDialogOverlay();
|
||||
void updateLoginDialogOverlayPosition();
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
void beforeEnterBackground();
|
||||
|
|
Loading…
Reference in a new issue