mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +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 controlsUit 1.0 as HifiControlsUit
|
||||||
import stylesUit 1.0 as HifiStylesUit
|
import stylesUit 1.0 as HifiStylesUit
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: completeProfileBody
|
id: completeProfileBody
|
||||||
|
@ -150,11 +151,14 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: cancelArea
|
id: cancelArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
hoverEnabled: true
|
||||||
|
onEntered: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: profileButtonTextMetrics
|
id: profileButtonTextMetrics
|
||||||
|
|
|
@ -15,6 +15,7 @@ import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
||||||
|
|
||||||
import controlsUit 1.0 as HifiControlsUit
|
import controlsUit 1.0 as HifiControlsUit
|
||||||
import stylesUit 1.0 as HifiStylesUit
|
import stylesUit 1.0 as HifiStylesUit
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: linkAccountBody
|
id: linkAccountBody
|
||||||
|
@ -240,7 +241,12 @@ Item {
|
||||||
id: dismissMouseArea
|
id: dismissMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
if (loginDialog.getLoginDialogPoppedUp()) {
|
if (loginDialog.getLoginDialogPoppedUp()) {
|
||||||
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
|
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
|
||||||
var data = {
|
var data = {
|
||||||
|
|
|
@ -409,7 +409,14 @@ Item {
|
||||||
id: cancelArea
|
id: cancelArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
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 controlsUit 1.0 as HifiControlsUit
|
||||||
import stylesUit 1.0 as HifiStylesUit
|
import stylesUit 1.0 as HifiStylesUit
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: usernameCollisionBody
|
id: usernameCollisionBody
|
||||||
|
@ -202,7 +203,12 @@ Item {
|
||||||
id: cancelArea
|
id: cancelArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,10 +87,6 @@ FocusScope {
|
||||||
id: bodyLoader
|
id: bodyLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
loginKeyboard.raised = false;
|
|
||||||
KeyboardScriptingInterface.raised = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
@ -143,6 +139,7 @@ FocusScope {
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
loginKeyboard.raised = false;
|
loginKeyboard.raised = false;
|
||||||
|
KeyboardScriptingInterface.raised = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
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.
|
// display mode changed. Don't allow auto-switch to work after this session.
|
||||||
_firstRun.set(false);
|
_firstRun.set(false);
|
||||||
}
|
}
|
||||||
if (_loginDialogOverlayID.isNull()) {
|
if (isHMDMode()) {
|
||||||
// HMD mode.
|
|
||||||
dialogsManager->hideLoginDialog();
|
dialogsManager->hideLoginDialog();
|
||||||
createLoginDialogOverlay();
|
createLoginDialogOverlay();
|
||||||
} else {
|
} else {
|
||||||
// Desktop mode.
|
|
||||||
QVariantMap properties{
|
QVariantMap properties{
|
||||||
{ "parentID", QUuid() }
|
{ "parentID", QUuid() }
|
||||||
};
|
};
|
||||||
|
@ -1335,6 +1333,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
||||||
_loginDialogOverlayID = OverlayID();
|
_loginDialogOverlayID = OverlayID();
|
||||||
_loginStateManager.tearDown();
|
_loginStateManager.tearDown();
|
||||||
|
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||||
|
toolbar->writeProperty("visible", false);
|
||||||
dialogsManager->showLoginDialog();
|
dialogsManager->showLoginDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2946,6 +2946,10 @@ void Application::showLoginScreen() {
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||||
if (!accountManager->isLoggedIn()) {
|
if (!accountManager->isLoggedIn()) {
|
||||||
|
if (!isHMDMode()) {
|
||||||
|
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||||
|
toolbar->writeProperty("visible", false);
|
||||||
|
}
|
||||||
_loginDialogPoppedUp = true;
|
_loginDialogPoppedUp = true;
|
||||||
dialogsManager->showLoginDialog();
|
dialogsManager->showLoginDialog();
|
||||||
QJsonObject loginData = {};
|
QJsonObject loginData = {};
|
||||||
|
@ -5302,6 +5306,8 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSystemTabletMode();
|
||||||
|
|
||||||
getMyAvatar()->setEnableMeshVisible(true);
|
getMyAvatar()->setEnableMeshVisible(true);
|
||||||
|
|
||||||
const auto& nodeList = DependencyManager::get<NodeList>();
|
const auto& nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -6257,33 +6263,7 @@ void Application::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
if (!_loginDialogOverlayID.isNull()) {
|
if (!_loginDialogOverlayID.isNull()) {
|
||||||
_loginStateManager.update(getMyAvatar()->getDominantHand());
|
_loginStateManager.update(getMyAvatar()->getDominantHand());
|
||||||
}
|
updateLoginDialogOverlayPosition();
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update _viewFrustum with latest camera and view frustum data...
|
// 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() {
|
void Application::onDismissedLoginDialog() {
|
||||||
_loginDialogPoppedUp = false;
|
_loginDialogPoppedUp = false;
|
||||||
loginDialogPoppedUp.set(false);
|
loginDialogPoppedUp.set(false);
|
||||||
|
@ -8846,7 +8848,7 @@ void Application::updateThreadPoolCount() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateSystemTabletMode() {
|
void Application::updateSystemTabletMode() {
|
||||||
if (_settingsLoaded) {
|
if (_settingsLoaded && !getLoginDialogPoppedUp()) {
|
||||||
qApp->setProperty(hifi::properties::HMD, isHMDMode());
|
qApp->setProperty(hifi::properties::HMD, isHMDMode());
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getHmdTabletBecomesToolbarSetting());
|
DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getHmdTabletBecomesToolbarSetting());
|
||||||
|
|
|
@ -324,6 +324,7 @@ public:
|
||||||
|
|
||||||
bool getLoginDialogPoppedUp() const { return _loginDialogPoppedUp; }
|
bool getLoginDialogPoppedUp() const { return _loginDialogPoppedUp; }
|
||||||
void createLoginDialogOverlay();
|
void createLoginDialogOverlay();
|
||||||
|
void updateLoginDialogOverlayPosition();
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
void beforeEnterBackground();
|
void beforeEnterBackground();
|
||||||
|
|
Loading…
Reference in a new issue