mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 06:12:15 +02:00
updating tablet implementation
This commit is contained in:
parent
fad147656b
commit
951c4b2961
6 changed files with 141 additions and 137 deletions
|
@ -40,10 +40,10 @@ Item {
|
|||
if (root.isTablet === false) {
|
||||
var targetWidth = Math.max(Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth,
|
||||
termsContainer.contentWidth)), mainContainer.width)
|
||||
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
|
||||
parent.width = root.pane.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
|
||||
}
|
||||
var targetHeight = Math.max(5 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height + termsContainer.height, d.maxHeight)
|
||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
var targetHeight = Math.max(5 * hifi.dimensions.contentSpacing.y + d.minHeightButton + additionalTextContainer.height + termsContainer.height, d.maxHeight)
|
||||
parent.height = root.pane.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ Item {
|
|||
id: loginErrorMessage
|
||||
anchors.top: parent.top;
|
||||
// above buttons.
|
||||
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - buttons.height
|
||||
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - profileButton.height
|
||||
anchors.left: parent.left;
|
||||
color: "red";
|
||||
font.family: "Cairo"
|
||||
|
@ -146,81 +146,70 @@ Item {
|
|||
visible: false;
|
||||
|
||||
}
|
||||
// Row {
|
||||
// id: buttons
|
||||
// anchors {
|
||||
// top: parent.top
|
||||
// topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y
|
||||
// horizontalCenter: parent.horizontalCenter
|
||||
// margins: 0
|
||||
// }
|
||||
// spacing: hifi.dimensions.contentSpacing.x
|
||||
// onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
//
|
||||
//
|
||||
// HifiControlsUit.Button {
|
||||
// id: cancelButton
|
||||
// anchors.verticalCenter: parent.verticalCenter
|
||||
// text: qsTr("Cancel")
|
||||
// fontFamily: completeProfileBody.fontFamily
|
||||
// fontSize: completeProfileBody.fontSize
|
||||
// fontBold: completeProfileBody.fontBold
|
||||
// onClicked: {
|
||||
// bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Item {
|
||||
id: cancelContainer
|
||||
width: cancelText.width
|
||||
id: buttons
|
||||
width: Math.max(banner.width, cancelContainer.width + profileButton.width)
|
||||
height: d.minHeightButton
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: hifi.dimensions.contentSpacing.y
|
||||
topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y
|
||||
left: parent.left
|
||||
leftMargin: (parent.width - banner.width) / 2
|
||||
}
|
||||
Text {
|
||||
id: cancelText
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("Cancel");
|
||||
Item {
|
||||
id: cancelContainer
|
||||
width: cancelText.width
|
||||
height: d.minHeightButton
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
Text {
|
||||
id: cancelText
|
||||
text: qsTr("Cancel");
|
||||
|
||||
lineHeight: 1
|
||||
color: "white"
|
||||
font.family: completeProfileBody.fontFamily
|
||||
font.pixelSize: completeProfileBody.fontSize
|
||||
font.capitalization: Font.AllUppercase;
|
||||
font.bold: completeProfileBody.fontBold
|
||||
lineHeightMode: Text.ProportionalHeight
|
||||
}
|
||||
MouseArea {
|
||||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
loginDialog.atSignIn = false;
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
lineHeight: 1
|
||||
color: "white"
|
||||
font.family: completeProfileBody.fontFamily
|
||||
font.pixelSize: completeProfileBody.fontSize
|
||||
font.capitalization: Font.AllUppercase;
|
||||
font.bold: completeProfileBody.fontBold
|
||||
lineHeightMode: Text.ProportionalHeight
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextMetrics {
|
||||
id: profileButtonTextMetrics
|
||||
font: cancelText.font
|
||||
text: qsTr("CREATE YOUR PROFILE")
|
||||
}
|
||||
HifiControlsUit.Button {
|
||||
id: profileButton
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
width: Math.max(profileButtonTextMetrics.width + 2 * hifi.dimensions.contentSpacing.x, d.minWidthButton)
|
||||
height: d.minHeightButton
|
||||
|
||||
text: qsTr("Create your profile")
|
||||
color: hifi.buttons.blue
|
||||
|
||||
HifiControlsUit.Button {
|
||||
id: profileButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 256
|
||||
|
||||
text: qsTr("Create your profile")
|
||||
color: hifi.buttons.blue
|
||||
|
||||
fontFamily: completeProfileBody.fontFamily
|
||||
fontSize: completeProfileBody.fontSize
|
||||
fontBold: completeProfileBody.fontBold
|
||||
onClicked: {
|
||||
loginErrorMessage.visible = false;
|
||||
loginDialog.createAccountFromStream()
|
||||
fontFamily: completeProfileBody.fontFamily
|
||||
fontSize: completeProfileBody.fontSize
|
||||
fontBold: completeProfileBody.fontBold
|
||||
onClicked: {
|
||||
loginErrorMessage.visible = false;
|
||||
loginDialog.createAccountFromStream()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +233,6 @@ Item {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
onLinkActivated: {
|
||||
loginDialog.atSignIn = true;
|
||||
loginDialog.isLogIn = true;
|
||||
bodyLoader.setSource("SignInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
|
|
|
@ -52,10 +52,10 @@ Item {
|
|||
|
||||
var newWidth = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
||||
if (!isNaN(newWidth)) {
|
||||
parent.width = root.width = newWidth;
|
||||
parent.width = root.pane.width = newWidth;
|
||||
}
|
||||
|
||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
parent.height = root.pane.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,7 @@ Item {
|
|||
function toggleSignIn(isLogIn) {
|
||||
// going to/from sign in/up dialog.
|
||||
loginDialog.isLogIn = isLogIn;
|
||||
|
||||
bodyLoader.setSource("SignInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -73,6 +71,11 @@ Item {
|
|||
width: root.pane.width
|
||||
height: 0.6 * root.pane.height
|
||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: topOpaqueRect
|
||||
|
@ -149,7 +152,11 @@ Item {
|
|||
width: root.pane.width
|
||||
height: 0.4 * root.pane.height
|
||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
anchors.top: topContainer.bottom
|
||||
anchors {
|
||||
top: topContainer.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: bottomOpaqueRect
|
||||
|
@ -217,6 +224,7 @@ Item {
|
|||
right: parent.right
|
||||
margins: 10
|
||||
}
|
||||
visible: !root.isTablet
|
||||
Text {
|
||||
id: dismissText
|
||||
text: qsTr("No thanks, take me in-world! >")
|
||||
|
@ -258,4 +266,15 @@ Item {
|
|||
}
|
||||
d.resize();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
var poppedUp = Settings.getValue("loginDialogPoppedUp", false);
|
||||
if (poppedUp && root.isTablet) {
|
||||
// it popped up and was clicked with the X
|
||||
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
|
||||
var data = {
|
||||
"action": "user dismissed login screen"
|
||||
};
|
||||
Settings.setValue("loginDialogPoppedUp", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ Item {
|
|||
successTimer.start();
|
||||
}
|
||||
|
||||
function toggleSignIn(isLogIn) {
|
||||
function init(isLogIn) {
|
||||
// going to/from sign in/up dialog.
|
||||
loginDialog.isLogIn = isLogIn;
|
||||
usernameField.visible = !isLogIn;
|
||||
|
@ -165,10 +165,7 @@ Item {
|
|||
passwordField.text = "";
|
||||
}
|
||||
loginErrorMessage.visible = false;
|
||||
}
|
||||
|
||||
loginContainer.visible = signIn;
|
||||
|
||||
loginContainer.visible = true;
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -337,6 +334,7 @@ Item {
|
|||
left: parent.left
|
||||
leftMargin: (parent.width - usernameField.width) / 2
|
||||
}
|
||||
focus: !loginDialog.isLogIn
|
||||
visible: false
|
||||
}
|
||||
|
||||
|
@ -351,7 +349,7 @@ Item {
|
|||
left: parent.left
|
||||
leftMargin: (parent.width - emailField.width) / 2
|
||||
}
|
||||
focus: true
|
||||
focus: loginDialog.isLogIn
|
||||
placeholderText: "Username or Email"
|
||||
activeFocusOnPress: true
|
||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
|
@ -524,7 +522,7 @@ Item {
|
|||
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })
|
||||
}
|
||||
d.resize();
|
||||
toggleSignIn(loginDialog.isLogIn)
|
||||
init(loginDialog.isLogIn)
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -603,5 +601,4 @@ Item {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ Item {
|
|||
loginDialog.createAccountFromStream(textField.text)
|
||||
}
|
||||
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
@ -48,14 +47,14 @@ Item {
|
|||
function resize() {
|
||||
maxWidth = root.isTablet ? 1280 : Window.innerWidth;
|
||||
maxHeight = root.isTablet ? 720 : Window.innerHeight;
|
||||
var targetWidth = Math.max(Math.max(titleWidth, mainTextContainer.contentWidth), mainContainer.width)
|
||||
var targetWidth = Math.max(titleWidth, mainContainer.width);
|
||||
var targetHeight = mainTextContainer.height +
|
||||
hifi.dimensions.contentSpacing.y + textField.height +
|
||||
hifi.dimensions.contentSpacing.y + buttons.height
|
||||
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(Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)), mainContainer.height)
|
||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y)
|
||||
parent.width = root.pane.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
|
||||
parent.height = root.pane.height = Math.max(Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)), mainContainer.height +
|
||||
(keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +63,7 @@ Item {
|
|||
width: root.pane.width
|
||||
height: root.pane.height
|
||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: opaqueRect
|
||||
|
@ -157,20 +157,61 @@ Item {
|
|||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
Row {
|
||||
|
||||
Item {
|
||||
id: buttons
|
||||
width: Math.max(banner.width, cancelContainer.width + profileButton.width)
|
||||
height: d.minHeightButton
|
||||
anchors {
|
||||
top: textField.bottom
|
||||
topMargin: 5 * hifi.dimensions.contentSpacing.y
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
margins: 0
|
||||
topMargin: hifi.dimensions.contentSpacing.y
|
||||
left: parent.left
|
||||
leftMargin: (parent.width - banner.width) / 2
|
||||
}
|
||||
|
||||
Item {
|
||||
id: cancelContainer
|
||||
width: cancelText.width
|
||||
height: d.minHeightButton
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
Text {
|
||||
id: cancelText
|
||||
text: qsTr("Cancel");
|
||||
|
||||
lineHeight: 1
|
||||
color: "white"
|
||||
font.family: usernameCollisionBody.fontFamily
|
||||
font.pixelSize: usernameCollisionBody.fontSize
|
||||
font.capitalization: Font.AllUppercase;
|
||||
font.bold: usernameCollisionBody.fontBold
|
||||
lineHeightMode: Text.ProportionalHeight
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
id: cancelArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
}
|
||||
TextMetrics {
|
||||
id: profileButtonTextMetrics
|
||||
font: cancelText.font
|
||||
text: qsTr("CREATE YOUR PROFILE")
|
||||
}
|
||||
spacing: hifi.dimensions.contentSpacing.x
|
||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||
HifiControlsUit.Button {
|
||||
id: profileButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 256
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
width: Math.max(profileButtonTextMetrics.width + 2 * hifi.dimensions.contentSpacing.x, d.minWidthButton)
|
||||
height: d.minHeightButton
|
||||
|
||||
text: qsTr("Create your profile")
|
||||
color: hifi.buttons.blue
|
||||
|
@ -179,18 +220,7 @@ Item {
|
|||
fontSize: usernameCollisionBody.fontSize
|
||||
fontBold: usernameCollisionBody.fontBold
|
||||
onClicked: {
|
||||
usernameCollisionBody.create()
|
||||
}
|
||||
}
|
||||
HifiControlsUit.Button {
|
||||
id: cancelButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: qsTr("Cancel")
|
||||
fontFamily: usernameCollisionBody.fontFamily
|
||||
fontSize: usernameCollisionBody.fontSize
|
||||
fontBold: usernameCollisionBody.fontBold
|
||||
onClicked: {
|
||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
usernameCollisionBody.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +242,6 @@ Item {
|
|||
target: loginDialog
|
||||
onHandleCreateCompleted: {
|
||||
console.log("Create Succeeded")
|
||||
|
||||
loginDialog.loginThroughSteam()
|
||||
}
|
||||
onHandleCreateFailed: {
|
||||
|
@ -223,12 +252,10 @@ Item {
|
|||
}
|
||||
onHandleLoginCompleted: {
|
||||
console.log("Login Succeeded")
|
||||
|
||||
}
|
||||
|
||||
onHandleLoginFailed: {
|
||||
console.log("Login Failed")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,8 +59,6 @@ Windows.TabletModalWindow {
|
|||
}
|
||||
}
|
||||
|
||||
//property int colorScheme: hifi.colorSchemes.dark
|
||||
|
||||
MouseArea {
|
||||
width: realRoot.width
|
||||
height: realRoot.height
|
||||
|
@ -71,30 +69,12 @@ Windows.TabletModalWindow {
|
|||
property var items;
|
||||
property string label: ""
|
||||
|
||||
//onTitleWidthChanged: d.resize();
|
||||
|
||||
//onKeyboardRaisedChanged: d.resize();
|
||||
|
||||
signal canceled();
|
||||
|
||||
property alias bodyLoader: bodyLoader
|
||||
property alias loginDialog: loginDialog
|
||||
property alias hifi: hifi
|
||||
|
||||
HifiStylesUit.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();
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: mfRoot
|
||||
|
||||
|
@ -105,7 +85,6 @@ Windows.TabletModalWindow {
|
|||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.verticalCenter
|
||||
verticalCenterOffset: -loginKeyboard.height / 2
|
||||
}
|
||||
|
||||
LoginDialog {
|
||||
|
@ -114,8 +93,6 @@ Windows.TabletModalWindow {
|
|||
anchors {
|
||||
fill: parent
|
||||
topMargin: parent.frameMarginTop
|
||||
leftMargin: hifi.dimensions.contentMargin.x
|
||||
rightMargin: hifi.dimensions.contentMargin.x
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
|
@ -174,6 +151,6 @@ Windows.TabletModalWindow {
|
|||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
bodyLoader.setSource("../LoginDialog/LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
bodyLoader.setSource("../LoginDialog/UsernameCollisionBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ class QNetworkReply;
|
|||
|
||||
class LoginDialog : public OffscreenQmlDialog {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool atSignIn READ getAtSignIn WRITE setAtSignIn)
|
||||
Q_PROPERTY(bool isLogIn READ getIsLogIn WRITE setIsLogIn)
|
||||
HIFI_QML_DECL
|
||||
|
||||
|
@ -68,11 +67,8 @@ protected slots:
|
|||
|
||||
Q_INVOKABLE void openUrl(const QString& url) const;
|
||||
private:
|
||||
bool getAtSignIn() const { return _atSignIn; }
|
||||
void setAtSignIn(const bool atSignIn) { _atSignIn = atSignIn; }
|
||||
bool getIsLogIn() const { return _isLogIn; }
|
||||
void setIsLogIn(const bool isLogIn) { _isLogIn = isLogIn; }
|
||||
bool _atSignIn { false };
|
||||
bool _isLogIn { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue