From b6bf58d5be68ea42f55deda37dc30d293a11b14c Mon Sep 17 00:00:00 2001 From: Faye Li <si.fi.faye.li@gmial.com> Date: Mon, 20 Mar 2017 15:28:30 -0700 Subject: [PATCH 01/10] rearrange layout of main tablet go to screen --- .../qml/hifi/tablet/TabletAddressDialog.qml | 209 +++++++++--------- 1 file changed, 104 insertions(+), 105 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 952a1f7faa..3a6577f4c0 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -82,6 +82,107 @@ Item { } onMetaverseServerUrlChanged: updateLocationTextTimer.start(); + Rectangle { + id: navBar + width: 480 + height: 70 + + gradient: Gradient { + GradientStop { + position: 0 + color: "#c2ced8" + + } + + GradientStop { + position: 1 + color: "#c2ced8" + } + } + + anchors { + top: parent.top + right: parent.right + left: parent.left + } + + + ToolbarButton { + id: homeButton + imageURL: "../../../images/home.svg" + onClicked: { + addressBarDialog.loadHome(); + root.shown = false; + } + anchors { + left: parent.left + leftMargin: homeButton.width / 2 + verticalCenter: parent.verticalCenter + } + } + property int inputAreaHeight: 70 + property int inputAreaStep: (height - inputAreaHeight) / 2 + + HifiStyles.RalewayLight { + id: notice; + font.pixelSize: hifi.fonts.pixelSize * 0.50; + anchors { + top: parent.top + topMargin: parent.inputAreaStep + 12 + left: addressLine.left + right: addressLine.right + } + } + HifiStyles.FiraSansRegular { + id: location; + font.pixelSize: addressLine.font.pixelSize; + color: "gray"; + clip: true; + anchors.fill: addressLine; + visible: addressLine.text.length === 0 + } + + TextInput { + id: addressLine + focus: true + anchors { + bottom: parent.bottom + left: homeButton.right + right: parent.right + leftMargin: homeButton.width + rightMargin: homeButton.width / 2 + topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing) + bottomMargin: parent.inputAreaStep + } + font.pixelSize: hifi.fonts.pixelSize * 0.75 + cursorVisible: false + onTextChanged: { + filterChoicesByText(); + updateLocationText(text.length > 0); + if (!isCursorVisible && text.length > 0) { + isCursorVisible = true; + cursorVisible = true; + } + } + onAccepted: { + addressBarDialog.keyboardEnabled = false; + } + onActiveFocusChanged: { + cursorVisible = isCursorVisible && focus; + } + MouseArea { + // If user clicks in address bar show cursor to indicate ability to enter address. + anchors.fill: parent + onClicked: { + isCursorVisible = true; + //parent.cursorVisible = true; + parent.forceActiveFocus(); + addressBarDialog.keyboardEnabled = HMD.active + tabletRoot.playButtonClickSound(); + } + } + } + } Rectangle { id: topBar height: 90 @@ -103,7 +204,7 @@ Item { anchors.left: parent.left anchors.leftMargin: 0 anchors.topMargin: 0 - anchors.top: parent.top + anchors.top: navBar.bottom Row { id: thing @@ -158,7 +259,7 @@ Item { } - anchors.bottom: backgroundImage.top + anchors.bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom anchors.bottomMargin: 0 anchors.right: parent.right anchors.rightMargin: 0 @@ -210,109 +311,7 @@ Item { } } - Rectangle { - id: backgroundImage - width: 480 - height: 70 - - gradient: Gradient { - GradientStop { - position: 0 - color: "#c2ced8" - - } - - GradientStop { - position: 1 - color: "#c2ced8" - } - } - - anchors { - bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom - right: parent.right - left: parent.left - } - - - ToolbarButton { - id: homeButton - imageURL: "../../../images/home.svg" - onClicked: { - addressBarDialog.loadHome(); - root.shown = false; - } - anchors { - left: parent.left - leftMargin: homeButton.width / 2 - verticalCenter: parent.verticalCenter - } - } - property int inputAreaHeight: 70 - property int inputAreaStep: (height - inputAreaHeight) / 2 - - HifiStyles.RalewayLight { - id: notice; - font.pixelSize: hifi.fonts.pixelSize * 0.50; - anchors { - top: parent.top - topMargin: parent.inputAreaStep + 12 - left: addressLine.left - right: addressLine.right - } - } - HifiStyles.FiraSansRegular { - id: location; - font.pixelSize: addressLine.font.pixelSize; - color: "gray"; - clip: true; - anchors.fill: addressLine; - visible: addressLine.text.length === 0 - } - - TextInput { - id: addressLine - focus: true - anchors { - bottom: parent.bottom - left: homeButton.right - right: parent.right - leftMargin: homeButton.width - rightMargin: homeButton.width / 2 - topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing) - bottomMargin: parent.inputAreaStep - } - font.pixelSize: hifi.fonts.pixelSize * 0.75 - cursorVisible: false - onTextChanged: { - filterChoicesByText(); - updateLocationText(text.length > 0); - if (!isCursorVisible && text.length > 0) { - isCursorVisible = true; - cursorVisible = true; - } - } - onAccepted: { - addressBarDialog.keyboardEnabled = false; - } - onActiveFocusChanged: { - cursorVisible = isCursorVisible && focus; - } - MouseArea { - // If user clicks in address bar show cursor to indicate ability to enter address. - anchors.fill: parent - onClicked: { - isCursorVisible = true; - //parent.cursorVisible = true; - parent.forceActiveFocus(); - addressBarDialog.keyboardEnabled = HMD.active - tabletRoot.playButtonClickSound(); - } - } - } - } - - Timer { + Timer { // Delay updating location text a bit to avoid flicker of content and so that connection status is valid. id: updateLocationTextTimer running: false From 1d095b8158afa9f8bdd13c06b5a2f79c92b45879 Mon Sep 17 00:00:00 2001 From: Faye Li <si.fi.faye.li@gmial.com> Date: Mon, 20 Mar 2017 15:57:59 -0700 Subject: [PATCH 02/10] added back forward and back button on nav bar --- .../qml/hifi/tablet/TabletAddressDialog.qml | 54 ++++++++++++------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 3a6577f4c0..d2af9a6999 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -87,26 +87,12 @@ Item { width: 480 height: 70 - gradient: Gradient { - GradientStop { - position: 0 - color: "#c2ced8" - - } - - GradientStop { - position: 1 - color: "#c2ced8" - } - } - anchors { top: parent.top right: parent.right left: parent.left } - ToolbarButton { id: homeButton imageURL: "../../../images/home.svg" @@ -120,10 +106,40 @@ Item { verticalCenter: parent.verticalCenter } } + ToolbarButton { + id: backArrow; + imageURL: "../../../images/backward.svg"; + onClicked: addressBarDialog.loadBack(); + anchors { + left: homeButton.right + verticalCenter: parent.verticalCenter + } + } + ToolbarButton { + id: forwardArrow; + imageURL: "../../../images/forward.svg"; + onClicked: addressBarDialog.loadForward(); + anchors { + left: backArrow.right + verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + id: addressBar + width: 480 + height: 70 + anchors { + top: navBar.bottom + right: parent.right + left: parent.left + } + property int inputAreaHeight: 70 property int inputAreaStep: (height - inputAreaHeight) / 2 - HifiStyles.RalewayLight { + HifiStyles.RalewayLight { id: notice; font.pixelSize: hifi.fonts.pixelSize * 0.50; anchors { @@ -147,10 +163,10 @@ Item { focus: true anchors { bottom: parent.bottom - left: homeButton.right + left: parent.left right: parent.right - leftMargin: homeButton.width - rightMargin: homeButton.width / 2 + leftMargin: 0 + rightMargin: 0 topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing) bottomMargin: parent.inputAreaStep } @@ -204,7 +220,7 @@ Item { anchors.left: parent.left anchors.leftMargin: 0 anchors.topMargin: 0 - anchors.top: navBar.bottom + anchors.top: addressBar.bottom Row { id: thing From 9cab8b6c4a93f3c7f6959a655f7dcfec3ff4fcca Mon Sep 17 00:00:00 2001 From: Faye Li <si.fi.faye.li@gmial.com> Date: Mon, 20 Mar 2017 17:04:29 -0700 Subject: [PATCH 03/10] end of day commit --- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index d2af9a6999..8054c90603 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -90,7 +90,9 @@ Item { anchors { top: parent.top right: parent.right + rightMargin: 0 left: parent.left + leftMargin: 0 } ToolbarButton { @@ -102,7 +104,6 @@ Item { } anchors { left: parent.left - leftMargin: homeButton.width / 2 verticalCenter: parent.verticalCenter } } @@ -133,7 +134,9 @@ Item { anchors { top: navBar.bottom right: parent.right + rightMargin: 16 left: parent.left + leftMargin: 16 } property int inputAreaHeight: 70 From a078121c464325d0b52deacc6e37a424f43345e5 Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Fri, 24 Mar 2017 00:23:13 +0100 Subject: [PATCH 04/10] saving work --- interface/resources/qml/hifi/Card.qml | 73 ++++++++++--------- .../resources/qml/hifi/TabletTextButton.qml | 64 ++++++++++++++++ .../qml/hifi/tablet/TabletAddressDialog.qml | 55 +++++--------- scripts/defaultScripts.js | 2 +- 4 files changed, 124 insertions(+), 70 deletions(-) create mode 100644 interface/resources/qml/hifi/TabletTextButton.qml diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index f6f7e88d0c..781149c1b3 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -153,44 +153,49 @@ Rectangle { margins: textPadding; } } - Row { - FiraSansRegular { - id: users; - visible: isConcurrency; - text: onlineUsers; - size: textSize; - color: messageColor; - anchors.verticalCenter: message.verticalCenter; - } - Image { - id: icon; - source: "../../images/snap-icon.svg" - width: 40; - height: 40; - visible: action === 'snapshot'; - } - RalewayRegular { - id: message; - text: isConcurrency ? ((onlineUsers === 1) ? "person" : "people") : (drillDownToPlace ? "snapshots" : ("by " + userName)); - size: textSizeSmall; - color: messageColor; - elide: Text.ElideRight; // requires a width to be specified` - width: root.width - textPadding - - (users.visible ? users.width + parent.spacing : 0) - - (icon.visible ? icon.width + parent.spacing : 0) - - (actionIcon.width + (2 * smallMargin)); + + Rectangle { + radius: 20 + color: "transparent" + Row { + FiraSansRegular { + id: users; + visible: isConcurrency; + text: onlineUsers; + size: textSize; + color: messageColor; + anchors.verticalCenter: message.verticalCenter; + } + Image { + id: icon; + source: "../../images/snap-icon.svg" + width: 40; + height: 40; + visible: action === 'snapshot'; + } + RalewayRegular { + id: message; + text: isConcurrency ? ((onlineUsers === 1) ? "person" : "people") : (drillDownToPlace ? "snapshots" : ("by " + userName)); + size: textSizeSmall; + color: messageColor; + elide: Text.ElideRight; // requires a width to be specified` + width: root.width - textPadding + - (users.visible ? users.width + parent.spacing : 0) + - (icon.visible ? icon.width + parent.spacing : 0) + - (actionIcon.width + (2 * smallMargin)); + anchors { + bottom: parent.bottom; + bottomMargin: parent.spacing; + } + } + spacing: textPadding; + height: messageHeight; anchors { bottom: parent.bottom; - bottomMargin: parent.spacing; + left: parent.left; + leftMargin: textPadding; } } - spacing: textPadding; - height: messageHeight; - anchors { - bottom: parent.bottom; - left: parent.left; - leftMargin: textPadding; - } } // These two can be supplied to provide hover behavior. // For example, AddressBarDialog provides functions that set the current list view item diff --git a/interface/resources/qml/hifi/TabletTextButton.qml b/interface/resources/qml/hifi/TabletTextButton.qml new file mode 100644 index 0000000000..20f30f002c --- /dev/null +++ b/interface/resources/qml/hifi/TabletTextButton.qml @@ -0,0 +1,64 @@ +// +// TabletTextButton.qml +// +// Created by Dante Ruiz on 2017/3/23 +// 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.4 +import "../styles-uit" + +Rectangle { + property alias text: label.text + property alias pixelSize: label.font.pixelSize; + property bool selected: false + property int spacing: 2 + property var action: function () {} + property string highlightColor: hifi.colors.blueHighlight; + width: label.width + 64 + height: 32 + color: hifi.colors.white + HifiConstants { id: hifi } + RalewaySemiBold { + id: label; + color: hifi.colors.blueHighlight; + font.pixelSize: 15; + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; + } + } + + /*Rectangle { + anchors.fill: parent + border.width: 3 + border.color: clickArea.containMouse ? highlightColor : "transparent" + color: "transparent" + }*/ + + Rectangle { + id: indicator + width: parent.width + height: 3 + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + color: hifi.colors.blueHighlight + visible: parent.selected + } + + MouseArea { + id: clickArea; + anchors.fill: parent; + acceptedButtons: Qt.LeftButton; + onClicked: action(parent); + hoverEnabled: true; + } +} + diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 8054c90603..9e68d3435a 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -28,7 +28,7 @@ Item { height: parent.height property var allStories: []; - property int cardWidth: 370; + property int cardWidth: 460; property int cardHeight: 320; property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/"; @@ -86,7 +86,7 @@ Item { id: navBar width: 480 height: 70 - + color: hifi.colors.white anchors { top: parent.top right: parent.right @@ -201,22 +201,17 @@ Item { } } } + + Rectangle { + anchors.fill: addressLine + color: hifiStyleConstants.colors.baseGray + opacity: 0.1 + } } Rectangle { id: topBar - height: 90 - gradient: Gradient { - GradientStop { - position: 0 - color: "#2b2b2b" - - } - - GradientStop { - position: 1 - color: "#1e1e1e" - } - } + height: 37 + color: hifi.colors.white anchors.right: parent.right anchors.rightMargin: 0 @@ -227,14 +222,15 @@ Item { Row { id: thing - spacing: 2 * hifi.layout.spacing + spacing: 5 * hifi.layout.spacing anchors { top: parent.top; left: parent.left + leftMargin: 25 } - TextButton { + TabletTextButton { id: allTab; text: "ALL"; property string includeActions: 'snapshot, concurrency'; @@ -242,7 +238,7 @@ Item { action: tabSelect; } - TextButton { + TabletTextButton { id: placeTab; text: "PLACES"; property string includeActions: 'concurrency'; @@ -251,7 +247,7 @@ Item { } - TextButton { + TabletTextButton { id: snapTab; text: "SNAP"; property string includeActions: 'snapshot'; @@ -264,20 +260,7 @@ Item { Rectangle { id: bgMain - gradient: Gradient { - GradientStop { - position: 0 - color: "#2b2b2b" - - } - - GradientStop { - position: 1 - color: "#0f212e" - } - } - - + color: hifi.colors.white anchors.bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom anchors.bottomMargin: 0 anchors.right: parent.right @@ -292,7 +275,7 @@ Item { ListView { id: scroll - property int stackedCardShadowHeight: 10; + property int stackedCardShadowHeight: 0; clip: true spacing: 14 anchors { @@ -300,7 +283,9 @@ Item { top: parent.top left: parent.left right: parent.right - leftMargin: 50 + leftMargin: 10 + verticalCenter: parent.verticalCenter; + horizontalCenter: parent.horizontalCenter; } model: suggestions orientation: ListView.Vertical diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index aba2f35e6b..109b92d33a 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -21,7 +21,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/snapshot.js", "system/help.js", "system/pal.js", // "system/mod.js", // older UX, if you prefer - "system/goto.js", + "system/tablet-goto.js", "system/marketplaces/marketplaces.js", "system/edit.js", "system/tablet-users.js", From d9046a1982c1b760edf4e3a3e66a9390e9caa1a6 Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Fri, 24 Mar 2017 23:54:54 +0100 Subject: [PATCH 05/10] goto on the tablet --- interface/resources/qml/hifi/Card.qml | 84 +++++------ .../qml/hifi/tablet/TabletAddressDialog.qml | 26 ++-- .../qml/hifi/tablet/TabletStoryCard.qml | 132 ++++++++++++++++++ 3 files changed, 190 insertions(+), 52 deletions(-) create mode 100644 interface/resources/qml/hifi/tablet/TabletStoryCard.qml diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index 781149c1b3..01a5441380 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -129,7 +129,7 @@ Rectangle { property int dropSamples: 9; property int dropSpread: 0; DropShadow { - visible: showPlace && (desktop ? desktop.gradientsSupported : false) + visible: true;//showPlace && (desktop ? desktop.gradientsSupported : false) source: place; anchors.fill: place; horizontalOffset: dropHorizontalOffset; @@ -139,12 +139,12 @@ Rectangle { color: hifi.colors.black; spread: dropSpread; } - RalewaySemiBold { + RalewayLight { id: place; visible: showPlace; text: placeName; color: hifi.colors.white; - size: textSize; + size: 38; elide: Text.ElideRight; // requires constrained width anchors { top: parent.top; @@ -154,48 +154,44 @@ Rectangle { } } - Rectangle { - radius: 20 - color: "transparent" - Row { - FiraSansRegular { - id: users; - visible: isConcurrency; - text: onlineUsers; - size: textSize; - color: messageColor; - anchors.verticalCenter: message.verticalCenter; - } - Image { - id: icon; - source: "../../images/snap-icon.svg" - width: 40; - height: 40; - visible: action === 'snapshot'; - } - RalewayRegular { - id: message; - text: isConcurrency ? ((onlineUsers === 1) ? "person" : "people") : (drillDownToPlace ? "snapshots" : ("by " + userName)); - size: textSizeSmall; - color: messageColor; - elide: Text.ElideRight; // requires a width to be specified` - width: root.width - textPadding - - (users.visible ? users.width + parent.spacing : 0) - - (icon.visible ? icon.width + parent.spacing : 0) - - (actionIcon.width + (2 * smallMargin)); - anchors { - bottom: parent.bottom; - bottomMargin: parent.spacing; - } - } - spacing: textPadding; - height: messageHeight; + Row { + FiraSansRegular { + id: users; + visible: isConcurrency; + text: onlineUsers; + size: textSize; + color: messageColor; + anchors.verticalCenter: message.verticalCenter; + } + Image { + id: icon; + source: "../../images/snap-icon.svg" + width: 40; + height: 40; + visible: action === 'snapshot'; + } + RalewayRegular { + id: message; + text: isConcurrency ? ((onlineUsers === 1) ? "person" : "people") : (drillDownToPlace ? "snapshots" : ("by " + userName)); + size: textSizeSmall; + color: messageColor; + elide: Text.ElideRight; // requires a width to be specified` + width: root.width - textPadding + - (users.visible ? users.width + parent.spacing : 0) + - (icon.visible ? icon.width + parent.spacing : 0) + - (actionIcon.width + (2 * smallMargin)); anchors { bottom: parent.bottom; - left: parent.left; - leftMargin: textPadding; + bottomMargin: parent.spacing; } } + spacing: textPadding; + height: messageHeight; + anchors { + bottom: parent.bottom; + left: parent.left; + leftMargin: textPadding; + } } // These two can be supplied to provide hover behavior. // For example, AddressBarDialog provides functions that set the current list view item @@ -221,6 +217,12 @@ Rectangle { margins: smallMargin; } } + DropShadow { + anchors.fill: actionIcon + radius: 8.0 + color: "#80000000" + source: actionIcon + } MouseArea { id: messageArea; width: parent.width; diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 9e68d3435a..bfecf5457b 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -1,7 +1,7 @@ // // TabletAddressDialog.qml // -// Created by Dante Ruiz on 2016/07/16 +// Created by Dante Ruiz on 2017/03/16 // Copyright 2015 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -9,7 +9,8 @@ // import Hifi 1.0 -import QtQuick 2.4 +import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtGraphicalEffects 1.0 import "../../controls" import "../../styles" @@ -19,11 +20,11 @@ import "../toolbars" import "../../styles-uit" as HifiStyles import "../../controls-uit" as HifiControls -Item { +StackView { id: root HifiConstants { id: hifi } HifiStyles.HifiConstants { id: hifiStyleConstants } - + initialItem: addressBarDialog width: parent.width height: parent.height @@ -32,7 +33,7 @@ Item { property int cardHeight: 320; property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/"; - + Component { id: tabletStoryCard; TabletStoryCard {} } Component.onCompleted: { fillDestinations(); updateLocationText(); @@ -42,7 +43,7 @@ Item { Component.onDestruction: { root.parentChanged.disconnect(center); } - + function center() { // Explicitly center in order to avoid warnings at shutdown anchors.centerIn = parent; @@ -54,6 +55,9 @@ Item { } function goCard(targetString) { if (0 !== targetString.indexOf('hifi://')) { + var card = tabletStoryCard.createObject(); + card.setUrl(addressBarDialog.metaverseServerUrl + targetString); + root.push(card); return; } addressLine.text = targetString; @@ -86,7 +90,7 @@ Item { id: navBar width: 480 height: 70 - color: hifi.colors.white + color: hifiStyleConstants.colors.white anchors { top: parent.top right: parent.right @@ -194,7 +198,7 @@ Item { anchors.fill: parent onClicked: { isCursorVisible = true; - //parent.cursorVisible = true; + parent.cursorVisible = true; parent.forceActiveFocus(); addressBarDialog.keyboardEnabled = HMD.active tabletRoot.playButtonClickSound(); @@ -204,14 +208,14 @@ Item { Rectangle { anchors.fill: addressLine - color: hifiStyleConstants.colors.baseGray + color: hifiStyleConstants.colors.lightGray opacity: 0.1 } } Rectangle { id: topBar height: 37 - color: hifi.colors.white + color: hifiStyleConstants.colors.white anchors.right: parent.right anchors.rightMargin: 0 @@ -260,7 +264,7 @@ Item { Rectangle { id: bgMain - color: hifi.colors.white + color: hifiStyleConstants.colors.white anchors.bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom anchors.bottomMargin: 0 anchors.right: parent.right diff --git a/interface/resources/qml/hifi/tablet/TabletStoryCard.qml b/interface/resources/qml/hifi/tablet/TabletStoryCard.qml new file mode 100644 index 0000000000..ea6a23cb10 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/TabletStoryCard.qml @@ -0,0 +1,132 @@ +// +// TabletAddressDialog.qml +// +// Created by Dante Ruiz on 2017/04/24 +// 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.4 +import QtGraphicalEffects 1.0 +import "../../controls" +import "../../styles" +import "../../windows" +import "../" +import "../toolbars" +import "../../styles-uit" as HifiStyles +import "../../controls-uit" as HifiControls + + +Rectangle { + id: cardRoot + HifiStyles.HifiConstants { id: hifi } + width: parent.width + height: parent.height + property string address: "" + + function setUrl(url) { + cardRoot.address = url; + webview.url = url; + } + + function goBack() { + } + + function visit() { + } + + Rectangle { + id: header + anchors { + left: parent.left + right: parent.right + top: parent.top + } + + width: parent.width + height: 50 + color: hifi.colors.white + + Row { + anchors.fill: parent + spacing: 80 + + Item { + id: backButton + anchors { + top: parent.top + left: parent.left + leftMargin: 100 + } + height: parent.height + width: parent.height + + HifiStyles.FiraSansSemiBold { + text: "BACK" + elide: Text.ElideRight + anchors.fill: parent + size: 16 + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + color: hifi.colors.lightGray + + MouseArea { + id: backButtonMouseArea + anchors.fill: parent + hoverEnabled: enabled + + onClicked: { + webview.goBack(); + } + } + } + } + + Item { + id: closeButton + anchors { + top: parent.top + right: parent.right + rightMargin: 100 + } + height: parent.height + width: parent.height + + HifiStyles.FiraSansSemiBold { + text: "CLOSE" + elide: Text.ElideRight + anchors.fill: parent + size: 16 + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + color: hifi.colors.lightGray + + MouseArea { + id: closeButtonMouseArea + anchors.fill: parent + hoverEnabled: enabled + + onClicked: root.pop(); + } + } + } + } + } + + HifiControls.WebView { + id: webview + anchors { + top: header.bottom + right: parent.right + left: parent.left + bottom: parent.bottom + } + } +} From 9e2768cc84b98ae24436d594d1750c11bb292c0e Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Sat, 25 Mar 2017 01:06:21 +0100 Subject: [PATCH 06/10] saving work --- interface/resources/qml/hifi/tablet/TabletRoot.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index febb2793ec..8037c1280e 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -31,7 +31,8 @@ Item { Component { id: customInputDialogBuilder; TabletCustomQueryDialog { } } function customInputDialog(properties) { - return customInputDialogBuilder.createObject(tabletRoot, properties); + openModal = customInputDialogBuilder.createObject(tabletRoot, properties); + return openModal; } Component { id: fileDialogBuilder; TabletFileDialog { } } From 2a59139c7691e8e0e39945d4d6bbeb72fa06946a Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Sat, 25 Mar 2017 01:17:37 +0100 Subject: [PATCH 07/10] trying to fix focus issue --- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index bfecf5457b..e19f8ef72b 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -35,6 +35,8 @@ StackView { Component { id: tabletStoryCard; TabletStoryCard {} } Component.onCompleted: { + root.currentItem.focus = true; + root.currentItem.forceActiveFocus(); fillDestinations(); updateLocationText(); root.parentChanged.connect(center); @@ -199,6 +201,7 @@ StackView { onClicked: { isCursorVisible = true; parent.cursorVisible = true; + parent.focus = true; parent.forceActiveFocus(); addressBarDialog.keyboardEnabled = HMD.active tabletRoot.playButtonClickSound(); From b8eac7abef903c6f65206db6ff8106a74eb25620 Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Mon, 27 Mar 2017 16:17:50 +0100 Subject: [PATCH 08/10] revoming useless code --- interface/resources/qml/hifi/Card.qml | 2 +- interface/resources/qml/hifi/TabletTextButton.qml | 6 ------ interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index 01a5441380..3d1ae0e64b 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -129,7 +129,7 @@ Rectangle { property int dropSamples: 9; property int dropSpread: 0; DropShadow { - visible: true;//showPlace && (desktop ? desktop.gradientsSupported : false) + visible: true; source: place; anchors.fill: place; horizontalOffset: dropHorizontalOffset; diff --git a/interface/resources/qml/hifi/TabletTextButton.qml b/interface/resources/qml/hifi/TabletTextButton.qml index 20f30f002c..12e53eb217 100644 --- a/interface/resources/qml/hifi/TabletTextButton.qml +++ b/interface/resources/qml/hifi/TabletTextButton.qml @@ -33,12 +33,6 @@ Rectangle { } } - /*Rectangle { - anchors.fill: parent - border.width: 3 - border.color: clickArea.containMouse ? highlightColor : "transparent" - color: "transparent" - }*/ Rectangle { id: indicator diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index e19f8ef72b..623054f233 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -45,7 +45,7 @@ StackView { Component.onDestruction: { root.parentChanged.disconnect(center); } - + function center() { // Explicitly center in order to avoid warnings at shutdown anchors.centerIn = parent; From f4255735a9fa1448af9690094ad25fca775dad89 Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Mon, 27 Mar 2017 18:03:38 +0100 Subject: [PATCH 09/10] make login screen show up on the tablet on startup --- interface/src/ui/LoginDialog.cpp | 10 +++++----- .../script-engine/src/TabletScriptingInterface.cpp | 14 ++++++++++++++ .../script-engine/src/TabletScriptingInterface.h | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index dce76eb661..1fe09e7cec 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -47,11 +47,11 @@ void LoginDialog::showWithSelection() if (tablet->getToolbarMode()) { LoginDialog::show(); } else { - if (!hmd->getShouldShowTablet() && !qApp->isHMDMode()) { - LoginDialog::show(); - } else { - static const QUrl url("../../dialogs/TabletLoginDialog.qml"); - tablet->pushOntoStack(url); + static const QUrl url("../../dialogs/TabletLoginDialog.qml"); + qDebug() << "[DR] -> Push login onto the tablet"; + tablet->initialScreen(url); + if (!hmd->getShouldShowTablet()) { + hmd->openTablet(); } } } diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index 054cf83744..c287fbcfe7 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -250,6 +250,15 @@ static QString getUsername() { } } +void TabletProxy::initialScreen(const QVariant& url) { + if (getQmlTablet()) { + pushOntoStack(url); + } else { + _initialScreen = true; + _initialPath = url; + } +} + bool TabletProxy::isMessageDialogOpen() { if (_qmlTabletRoot) { QVariant result; @@ -299,6 +308,11 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr QMetaObject::invokeMethod(_qmlTabletRoot, "setUsername", Q_ARG(const QVariant&, QVariant(getUsername()))); } }); + + if (_initialScreen) { + pushOntoStack(_initialPath); + _initialScreen = false; + } } else { removeButtonsFromHomeScreen(); _state = State::Uninitialized; diff --git a/libraries/script-engine/src/TabletScriptingInterface.h b/libraries/script-engine/src/TabletScriptingInterface.h index acc53653f8..2e7b91fa4c 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -97,6 +97,8 @@ public: bool getToolbarMode() const { return _toolbarMode; } void setToolbarMode(bool toolbarMode); + void initialScreen(const QVariant& url); + /**jsdoc * transition to the home screen * @function TabletProxy#gotoHomeScreen @@ -213,6 +215,8 @@ protected: void addButtonsToToolbar(); void removeButtonsFromToolbar(); + bool _initialScreen { false }; + QVariant _initialPath { "" }; QString _name; std::mutex _mutex; std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies; From cba7adf32a3f0f8a3f37740f2e7306b06bc56d29 Mon Sep 17 00:00:00 2001 From: Dante Ruiz <dante@highfidelity.io> Date: Mon, 27 Mar 2017 19:08:41 +0100 Subject: [PATCH 10/10] removed qDebug --- interface/src/ui/LoginDialog.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 1fe09e7cec..10783afd23 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -48,7 +48,6 @@ void LoginDialog::showWithSelection() LoginDialog::show(); } else { static const QUrl url("../../dialogs/TabletLoginDialog.qml"); - qDebug() << "[DR] -> Push login onto the tablet"; tablet->initialScreen(url); if (!hmd->getShouldShowTablet()) { hmd->openTablet();