This commit is contained in:
howard-stearns 2016-07-15 16:14:29 -07:00
parent cc367f7b49
commit 289617d4ce
2 changed files with 47 additions and 21 deletions

View file

@ -51,6 +51,8 @@ Window {
}
property var allDomains: [];
property var suggestionChoices: [];
property int cardWidth: 200;
property int cardHeight: 152;
AddressBarDialog {
id: addressBarDialog
@ -60,33 +62,29 @@ Window {
Column {
width: backgroundImage.width;
anchors {
left: backgroundImage.left;
bottom: backgroundImage.top;
leftMargin: parent.height + 2 * hifi.layout.spacing;
bottomMargin: 2 * hifi.layout.spacing;
}
Text {
id: suggestionsLabel;
text: "Suggestions"
right: backgroundImage.right;
rightMargin: -104; // FIXME
}
Row {
spacing: hifi.layout.spacing;
Card {
id: s0;
width: 200;
height: 200;
width: cardWidth;
height: cardHeight;
goFunction: goCard
}
Card {
id: s1;
width: 200;
height: 200;
width: cardWidth;
height: cardHeight;
goFunction: goCard
}
Card {
id: s2;
width: 200;
height: 200;
width: cardWidth;
height: cardHeight;
goFunction: goCard
}
}
@ -221,10 +219,14 @@ Window {
});
}
function identity(x) {
return x;
}
function addPictureToDomain(domainInfo, cb) { // asynchronously add thumbnail and lobby to domainInfo, if available, and cb(error)
// This requests data for all the names at once, and just uses the first one to come back.
// We might change this to check one at a time, which would be less requests and more latency.
asyncEach([domainInfo.name].concat(domainInfo.names || null).filter(function (x) { return x; }), function (name, icb) {
asyncEach([domainInfo.name].concat(domainInfo.names || null).filter(identity), function (name, icb) {
var url = "https://metaverse.highfidelity.com/api/v1/places/" + name;
getRequest(url, function (error, json) {
var previews = !error && json.data.place.previews;
@ -279,7 +281,7 @@ Window {
target.usersText = data.online_users + ((data.online_users === 1) ? ' user' : ' users');
target.visible = true;
}
var words = addressLine.text.toUpperCase().split(/\s+/);
var words = addressLine.text.toUpperCase().split(/\s+/).filter(identity);
var filtered = !words.length ? suggestionChoices : allDomains.filter(function (domain) {
var text = domain.names.concat(domain.tags).join(' ');
if (domain.description) {
@ -293,7 +295,6 @@ Window {
fill1(s0, filtered[0]);
fill1(s1, filtered[1]);
fill1(s2, filtered[2]);
suggestionsLabel.visible = filtered.length;
}
function fillDestinations() {

View file

@ -13,6 +13,7 @@
import Hifi 1.0
import QtQuick 2.5
import QtGraphicalEffects 1.0
import "../styles-uit"
Rectangle {
@ -21,6 +22,8 @@ Rectangle {
property alias image: lobby;
property alias placeText: place.text;
property alias usersText: users.text;
property int textPadding: 20;
property int textSize: 24;
// FIXME: let's get our own
property string defaultPicture: "http://www.davidluke.com/wp-content/themes/david-luke/media/ims/placeholder720.gif";
HifiConstants { id: hifi }
@ -40,22 +43,44 @@ Rectangle {
}
}
}
DropShadow {
source: place;
anchors.fill: place;
horizontalOffset: 0;
radius: 2;
samples: 9;
color: hifi.colors.black;
verticalOffset: 1;
spread: 0;
}
DropShadow {
source: users;
anchors.fill: users;
horizontalOffset: 0;
radius: 2;
samples: 9;
color: hifi.colors.black;
verticalOffset: 1;
spread: 0;
}
RalewaySemiBold {
id: place;
color: hifi.colors.lightGrayText;
color: hifi.colors.white;
size: textSize;
anchors {
leftMargin: 2 * hifi.layout.spacing;
topMargin: 2 * hifi.layout.spacing;
top: parent.top;
left: parent.left;
margins: textPadding;
}
}
RalewayRegular {
id: users;
color: hifi.colors.lightGrayText;
size: textSize;
color: hifi.colors.white;
anchors {
bottom: parent.bottom;
right: parent.right;
bottomMargin: 2 * hifi.layout.spacing;
rightMargin: 2 * hifi.layout.spacing;
margins: textPadding;
}
}
MouseArea {