// // SignInBody.qml // // Created by Clement on 7/18/16 // Copyright 2015 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.7 import QtQuick.Controls.Styles 1.4 as OriginalStyles import controlsUit 1.0 import stylesUit 1.0 Item { id: signInBody clip: true height: root.pane.height width: root.pane.width property bool required: false function login() { console.log("Trying to log in") loginDialog.loginThroughSteam() } function cancel() { root.tryDestroy() } QtObject { id: d readonly property int minWidth: 480 readonly property int maxWidth: 1280 readonly property int minHeight: 120 readonly property int maxHeight: 720 function resize() { var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth) var targetHeight = mainTextContainer.height + 3 * hifi.dimensions.contentSpacing.y + buttons.height parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) } } InfoItem { id: mainTextContainer anchors { top: parent.top horizontalCenter: parent.horizontalCenter margins: 0 topMargin: hifi.dimensions.contentSpacing.y } text: required ? qsTr("This domain's owner requires that you sign in:") : qsTr("Sign in to access your user account:") wrapMode: Text.WordWrap color: hifi.colors.baseGrayHighlight lineHeight: 2 lineHeightMode: Text.ProportionalHeight horizontalAlignment: Text.AlignHCenter } Row { id: buttons anchors { top: mainTextContainer.bottom horizontalCenter: parent.horizontalCenter margins: 0 topMargin: 2 * hifi.dimensions.contentSpacing.y } spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); Button { anchors.verticalCenter: parent.verticalCenter width: undefined // invalidate so that the image's size sets the width height: undefined // invalidate so that the image's size sets the height focus: true background: Image { id: buttonImage source: "../../images/steam-sign-in.png" } onClicked: signInBody.login() } Button { anchors.verticalCenter: parent.verticalCenter text: qsTr("Cancel"); onClicked: signInBody.cancel() } } Component.onCompleted: { root.title = required ? qsTr("Sign In Required") : qsTr("Sign In") root.iconText = "" d.resize(); } Connections { target: loginDialog onHandleLoginCompleted: { console.log("Login Succeeded") bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true }) bodyLoader.item.width = root.pane.width bodyLoader.item.height = root.pane.height } onHandleLoginFailed: { console.log("Login Failed") bodyLoader.source = "CompleteProfileBody.qml" if (!root.isTablet) { bodyLoader.item.width = root.pane.width bodyLoader.item.height = root.pane.height } } } }