mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 18:26:37 +02:00
go horizontal
This commit is contained in:
parent
788849e19a
commit
c5f1455872
2 changed files with 96 additions and 54 deletions
78
interface/resources/qml/hifi/Feed.qml
Normal file
78
interface/resources/qml/hifi/Feed.qml
Normal file
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// Feed.qml
|
||||
// qml/hifi
|
||||
//
|
||||
// Displays a particular type of feed
|
||||
//
|
||||
// Created by Howard Stearns on 4/18/2017
|
||||
// Copyright 2016 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.5
|
||||
import QtGraphicalEffects 1.0
|
||||
import "toolbars"
|
||||
import "../styles-uit"
|
||||
|
||||
Rectangle {
|
||||
id: root;
|
||||
|
||||
property int cardWidth: 212;
|
||||
property int cardHeight: 152;
|
||||
property int stackedCardShadowHeight: 10;
|
||||
property alias suggestions: feed;
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
ListModel { id: feed; }
|
||||
|
||||
RalewayLight {
|
||||
id: label;
|
||||
text: "Places";
|
||||
color: hifi.colors.blueHighlight;
|
||||
size: 38;
|
||||
width: root.width;
|
||||
anchors {
|
||||
top: parent.top;
|
||||
left: parent.left;
|
||||
margins: 10;
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: scroll;
|
||||
clip: true;
|
||||
model: feed;
|
||||
orientation: ListView.Horizontal;
|
||||
|
||||
spacing: 14;
|
||||
height: cardHeight + stackedCardShadowHeight;
|
||||
anchors {
|
||||
top: label.bottom;
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
leftMargin: 10;
|
||||
}
|
||||
|
||||
delegate: Card {
|
||||
width: cardWidth;
|
||||
height: cardHeight;
|
||||
goFunction: goCard;
|
||||
userName: model.username;
|
||||
placeName: model.place_name;
|
||||
hifiUrl: model.place_name + model.path;
|
||||
thumbnail: model.thumbnail_url;
|
||||
imageUrl: model.image_url;
|
||||
action: model.action;
|
||||
timestamp: model.created_at;
|
||||
onlineUsers: model.online_users;
|
||||
storyId: model.metaverseId;
|
||||
drillDownToPlace: model.drillDownToPlace;
|
||||
shadowHeight: stackedCardShadowHeight;
|
||||
hoverThunk: function () { scroll.currentIndex = index; }
|
||||
unhoverThunk: function () { scroll.currentIndex = -1; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,8 +31,8 @@ StackView {
|
|||
height: parent !== null ? parent.height : undefined
|
||||
property var eventBridge;
|
||||
property var allStories: [];
|
||||
property int cardWidth: 460;
|
||||
property int cardHeight: 320;
|
||||
property int cardWidth: 212;
|
||||
property int cardHeight: 152;
|
||||
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
||||
|
||||
property var tablet: null;
|
||||
|
@ -275,58 +275,21 @@ StackView {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
id: bgMain
|
||||
color: hifiStyleConstants.colors.white
|
||||
anchors.bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.top: topBar.bottom
|
||||
anchors.topMargin: 0
|
||||
|
||||
ListModel { id: suggestions }
|
||||
|
||||
ListView {
|
||||
id: scroll
|
||||
|
||||
property int stackedCardShadowHeight: 0;
|
||||
clip: true
|
||||
spacing: 14
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
}
|
||||
|
||||
model: suggestions
|
||||
orientation: ListView.Vertical
|
||||
|
||||
delegate: Card {
|
||||
width: cardWidth;
|
||||
height: cardHeight;
|
||||
goFunction: goCard;
|
||||
userName: model.username;
|
||||
placeName: model.place_name;
|
||||
hifiUrl: model.place_name + model.path;
|
||||
thumbnail: model.thumbnail_url;
|
||||
imageUrl: model.image_url;
|
||||
action: model.action;
|
||||
timestamp: model.created_at;
|
||||
onlineUsers: model.online_users;
|
||||
storyId: model.metaverseId;
|
||||
drillDownToPlace: model.drillDownToPlace;
|
||||
shadowHeight: scroll.stackedCardShadowHeight;
|
||||
hoverThunk: function () { scroll.currentIndex = index; }
|
||||
unhoverThunk: function () { scroll.currentIndex = -1; }
|
||||
}
|
||||
|
||||
highlightMoveDuration: -1;
|
||||
highlightMoveVelocity: -1;
|
||||
highlight: Rectangle { color: "transparent"; border.width: 4; border.color: hifiStyleConstants.colors.blueHighlight; z: 1; }
|
||||
id: bgMain;
|
||||
color: hifiStyleConstants.colors.white;
|
||||
anchors {
|
||||
bottom: parent.keyboardEnabled ? keyboard.top : parent.bottom;
|
||||
bottomMargin: 0;
|
||||
right: parent.right;
|
||||
rightMargin: 0;
|
||||
left: parent.left;
|
||||
leftMargin: 0;
|
||||
top: topBar.bottom;
|
||||
topMargin: 0;
|
||||
}
|
||||
Feed {
|
||||
id: feed;
|
||||
width: bgMain.width;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,6 +326,7 @@ StackView {
|
|||
}
|
||||
|
||||
}
|
||||
property alias suggestions: feed.suggestions;
|
||||
|
||||
function getRequest(url, cb) { // cb(error, responseOfCorrectContentType) of url. General for 'get' text/html/json, but without redirects.
|
||||
// TODO: make available to other .qml.
|
||||
|
|
Loading…
Reference in a new issue