card default image: settable, use to start, and reset when needed

This commit is contained in:
howard-stearns 2016-07-15 13:42:31 -07:00
parent 99e229467b
commit 6fb2cedfe0
2 changed files with 5 additions and 5 deletions

View file

@ -275,9 +275,7 @@ Window {
}
console.log('suggestion:', JSON.stringify(data));
target.userStory = data;
if (data.lobby) {
target.image.source = data.lobby;
}
target.image.source = data.lobby || ''; // should fail to load and thus use default
target.placeText = data.name;
target.usersText = data.online_users + ((data.online_users === 1) ? ' user' : ' users');
target.visible = true;

View file

@ -21,11 +21,14 @@ Rectangle {
property alias image: lobby;
property alias placeText: place.text;
property alias usersText: users.text;
// 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 }
Image {
id: lobby;
width: parent.width;
height: parent.height;
source: defaultPicture;
fillMode: Image.PreserveAspectCrop;
// source gets filled in later
anchors.verticalCenter: parent.verticalCenter;
@ -33,8 +36,7 @@ Rectangle {
onStatusChanged: {
if (status == Image.Error) {
console.log("source: " + source + ": failed to load " + JSON.stringify(userStory));
// FIXME: let's get our own
source = "http://www.davidluke.com/wp-content/themes/david-luke/media/ims/placeholder720.gif"
source = defaultPicture;
}
}
}