Merge pull request #8839 from howard-stearns/unit-scaled-address-bar

Unit scaled address bar
This commit is contained in:
Howard Stearns 2016-10-19 12:31:00 -07:00 committed by GitHub
commit 3f4ca27e76

View file

@ -21,6 +21,7 @@ import "controls-uit" as HifiControls
Window { Window {
id: root id: root
HifiConstants { id: hifi } HifiConstants { id: hifi }
HifiStyles.HifiConstants { id: hifiStyleConstants }
objectName: "AddressBarDialog" objectName: "AddressBarDialog"
title: "Go To" title: "Go To"
@ -29,7 +30,6 @@ Window {
destroyOnHidden: false destroyOnHidden: false
resizable: false resizable: false
pinnable: false; pinnable: false;
scale: 1.25 // Make this dialog a little larger than normal
width: addressBarDialog.implicitWidth width: addressBarDialog.implicitWidth
height: addressBarDialog.implicitHeight height: addressBarDialog.implicitHeight
@ -78,8 +78,7 @@ Window {
property bool punctuationMode: false property bool punctuationMode: false
implicitWidth: backgroundImage.width implicitWidth: backgroundImage.width
implicitHeight: backgroundImage.height + (keyboardEnabled ? keyboard.raisedHeight + 2 * hifi.layout.spacing : 0) implicitHeight: backgroundImage.height + (keyboardEnabled ? keyboard.height : 0) + cardHeight;
+ cardHeight - 36 // Fudge to reduce bottom margin.
// The buttons have their button state changed on hover, so we have to manually fix them up here // The buttons have their button state changed on hover, so we have to manually fix them up here
onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0; onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0;
@ -98,7 +97,7 @@ Window {
spacing: hifi.layout.spacing; spacing: hifi.layout.spacing;
clip: true; clip: true;
anchors { anchors {
top: parent.top bottom: backgroundImage.top
horizontalCenter: backgroundImage.horizontalCenter horizontalCenter: backgroundImage.horizontalCenter
} }
model: suggestions; model: suggestions;
@ -133,16 +132,16 @@ Window {
verticalCenter: scroll.verticalCenter; verticalCenter: scroll.verticalCenter;
} }
} }
Image { Image {
id: backgroundImage id: backgroundImage
source: "../images/address-bar.svg" source: "../images/address-bar.svg"
width: 576 * root.scale width: 720
height: 80 * root.scale height: 100
anchors { anchors {
top: scroll.bottom bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom;
} }
property int inputAreaHeight: 70
property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area
property int inputAreaStep: (height - inputAreaHeight) / 2 property int inputAreaStep: (height - inputAreaHeight) / 2
ToolbarButton { ToolbarButton {
@ -189,7 +188,7 @@ Window {
HifiStyles.RalewayLight { HifiStyles.RalewayLight {
id: notice; id: notice;
font.pixelSize: hifi.fonts.pixelSize * root.scale * 0.50; font.pixelSize: hifi.fonts.pixelSize * 0.50;
anchors { anchors {
top: parent.top top: parent.top
topMargin: parent.inputAreaStep + 12 topMargin: parent.inputAreaStep + 12
@ -218,7 +217,7 @@ Window {
topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing) topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing)
bottomMargin: parent.inputAreaStep bottomMargin: parent.inputAreaStep
} }
font.pixelSize: hifi.fonts.pixelSize * root.scale * 0.75 font.pixelSize: hifi.fonts.pixelSize * 0.75
cursorVisible: false cursorVisible: false
onTextChanged: { onTextChanged: {
filterChoicesByText(); filterChoicesByText();
@ -267,7 +266,6 @@ Window {
Window { Window {
width: 938 width: 938
height: 625 height: 625
scale: 0.8 // Reset scale of Window to 1.0 (counteract address bar's scale value of 1.25)
HifiControls.WebView { HifiControls.WebView {
anchors.fill: parent; anchors.fill: parent;
id: storyCardHTML; id: storyCardHTML;
@ -290,7 +288,7 @@ Window {
raised: parent.keyboardEnabled // Ignore keyboardRaised; keep keyboard raised if enabled (i.e., in HMD). raised: parent.keyboardEnabled // Ignore keyboardRaised; keep keyboard raised if enabled (i.e., in HMD).
numeric: parent.punctuationMode numeric: parent.punctuationMode
anchors { anchors {
top: backgroundImage.bottom bottom: parent.bottom
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
@ -433,10 +431,10 @@ Window {
function updateLocationText(enteringAddress) { function updateLocationText(enteringAddress) {
if (enteringAddress) { if (enteringAddress) {
notice.text = "Go to a place, @user, path or network address"; notice.text = "Go to a place, @user, path or network address";
notice.color = "gray"; notice.color = hifiStyleConstants.colors.baseGrayHighlight;
} else { } else {
notice.text = AddressManager.isConnected ? "Your location:" : "Not Connected"; notice.text = AddressManager.isConnected ? "Your location:" : "Not Connected";
notice.color = AddressManager.isConnected ? "gray" : "crimson"; notice.color = AddressManager.isConnected ? hifiStyleConstants.colors.baseGrayHighlight : hifiStyleConstants.colors.redHighlight;
// Display hostname, which includes ip address, localhost, and other non-placenames. // Display hostname, which includes ip address, localhost, and other non-placenames.
location.text = (AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : ''); location.text = (AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : '');
} }