mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-19 18:29:24 +02:00
202 lines
5.4 KiB
QML
202 lines
5.4 KiB
QML
//
|
|
// TabletLoginDialog.qml
|
|
//
|
|
// Created by Vlad Stelmahovsky on 15 Mar 2017
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
import Hifi 1.0
|
|
import QtQuick 2.5
|
|
import QtQuick.Controls 1.4
|
|
|
|
import "../controls-uit"
|
|
import "../styles-uit"
|
|
import "../windows"
|
|
|
|
import "../LoginDialog"
|
|
|
|
TabletModalWindow {
|
|
id: realRoot
|
|
objectName: "LoginDialog"
|
|
|
|
signal sendToScript(var message);
|
|
property bool isHMD: false
|
|
property bool gotoPreviousApp: false;
|
|
color: hifi.colors.baseGray
|
|
title: qsTr("Sign in to High Fidelity")
|
|
property alias titleWidth: root.titleWidth
|
|
|
|
//fake root for shared components expecting root here
|
|
property var root: QtObject {
|
|
id: root
|
|
property alias title: realRoot.title
|
|
|
|
property real width: realRoot.width
|
|
property real height: realRoot.height
|
|
|
|
property int titleWidth: 0
|
|
property string iconText: hifi.glyphs.avatar
|
|
property int iconSize: 35
|
|
|
|
property var pane: QtObject {
|
|
property real width: root.width
|
|
property real height: root.height
|
|
}
|
|
|
|
function tryDestroy() {
|
|
canceled()
|
|
}
|
|
}
|
|
|
|
//property int colorScheme: hifi.colorSchemes.dark
|
|
|
|
MouseArea {
|
|
width: realRoot.width
|
|
height: realRoot.height
|
|
}
|
|
|
|
property bool keyboardOverride: true
|
|
|
|
property var items;
|
|
property string label: ""
|
|
|
|
//onTitleWidthChanged: d.resize();
|
|
|
|
property bool keyboardEnabled: false
|
|
property bool keyboardRaised: false
|
|
property bool punctuationMode: false
|
|
|
|
//onKeyboardRaisedChanged: d.resize();
|
|
|
|
signal canceled();
|
|
|
|
property alias bodyLoader: bodyLoader
|
|
property alias loginDialog: loginDialog
|
|
property alias hifi: hifi
|
|
|
|
HifiConstants { id: hifi }
|
|
|
|
onCanceled: {
|
|
if (bodyLoader.active === true) {
|
|
bodyLoader.active = false
|
|
}
|
|
if (gotoPreviousApp) {
|
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
|
tablet.returnToPreviousApp();
|
|
} else {
|
|
Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
|
|
}
|
|
}
|
|
|
|
|
|
TabletModalFrame {
|
|
id: mfRoot
|
|
|
|
width: root.width
|
|
height: root.height + frameMarginTop
|
|
|
|
anchors {
|
|
horizontalCenter: parent.horizontalCenter
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
onHeightChanged: console.log("tablet mf h:", height)
|
|
|
|
LoginDialog {
|
|
id: loginDialog
|
|
|
|
anchors {
|
|
fill: parent
|
|
topMargin: parent.frameMarginTop
|
|
leftMargin: hifi.dimensions.contentMargin.x
|
|
rightMargin: hifi.dimensions.contentMargin.x
|
|
horizontalCenter: parent.horizontalCenter
|
|
}
|
|
|
|
Loader {
|
|
id: bodyLoader
|
|
anchors.fill: parent
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
source: loginDialog.isSteamRunning() ? "../LoginDialog/SignInBody.qml" : "../LoginDialog/LinkAccountBody.qml"
|
|
}
|
|
}
|
|
}
|
|
|
|
Keys.onPressed: {
|
|
if (!visible) {
|
|
return
|
|
}
|
|
|
|
if (event.modifiers === Qt.ControlModifier)
|
|
switch (event.key) {
|
|
case Qt.Key_A:
|
|
event.accepted = true
|
|
detailedText.selectAll()
|
|
break
|
|
case Qt.Key_C:
|
|
event.accepted = true
|
|
detailedText.copy()
|
|
break
|
|
case Qt.Key_Period:
|
|
if (Qt.platform.os === "osx") {
|
|
event.accepted = true
|
|
content.reject()
|
|
}
|
|
break
|
|
} else switch (event.key) {
|
|
case Qt.Key_Escape:
|
|
case Qt.Key_Back:
|
|
event.accepted = true
|
|
destroy()
|
|
break
|
|
|
|
case Qt.Key_Enter:
|
|
case Qt.Key_Return:
|
|
event.accepted = true
|
|
break
|
|
}
|
|
}
|
|
// LoginDialog {
|
|
// id: loginDialog
|
|
// width: parent.width
|
|
// height: parent.height
|
|
// StackView {
|
|
// id: bodyLoader
|
|
// property var item: currentItem
|
|
// property var props
|
|
// property string source: ""
|
|
|
|
// onCurrentItemChanged: {
|
|
// //cleanup source for future usage
|
|
// source = ""
|
|
// }
|
|
|
|
// function setSource(src, props) {
|
|
// source = "../TabletLoginDialog/" + src
|
|
// bodyLoader.props = props
|
|
// }
|
|
// function popup() {
|
|
// bodyLoader.pop()
|
|
|
|
// //check if last screen, if yes, dialog is popped out
|
|
// if (depth === 1)
|
|
// loginDialogRoot.canceled()
|
|
// }
|
|
|
|
// anchors.fill: parent
|
|
// anchors.margins: 10
|
|
// onSourceChanged: {
|
|
// if (source !== "") {
|
|
// bodyLoader.push(Qt.resolvedUrl(source), props)
|
|
// }
|
|
// }
|
|
// Component.onCompleted: {
|
|
// setSource(loginDialog.isSteamRunning() ?
|
|
// "SignInBody.qml" :
|
|
// "LinkAccountBody.qml")
|
|
// }
|
|
// }
|
|
// }
|
|
}
|