mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-08 02:58:19 +02:00
Merge remote-tracking branch 'origin/quasi-tabbed-goto' into no-snapshots-welcome
This commit is contained in:
commit
4cdda7c20f
2 changed files with 90 additions and 16 deletions
|
@ -24,7 +24,7 @@ Window {
|
||||||
HifiStyles.HifiConstants { id: hifiStyleConstants }
|
HifiStyles.HifiConstants { id: hifiStyleConstants }
|
||||||
|
|
||||||
objectName: "AddressBarDialog"
|
objectName: "AddressBarDialog"
|
||||||
title: "Go To"
|
title: "Go To:"
|
||||||
|
|
||||||
shown: false
|
shown: false
|
||||||
destroyOnHidden: false
|
destroyOnHidden: false
|
||||||
|
@ -120,8 +120,6 @@ Window {
|
||||||
highlightMoveDuration: -1;
|
highlightMoveDuration: -1;
|
||||||
highlightMoveVelocity: -1;
|
highlightMoveVelocity: -1;
|
||||||
highlight: Rectangle { color: "transparent"; border.width: 4; border.color: "#1DB5ED"; z: 1; }
|
highlight: Rectangle { color: "transparent"; border.width: 4; border.color: "#1DB5ED"; z: 1; }
|
||||||
leftMargin: 50; // Start the first item over by about the same amount as the last item peeks through on the other side.
|
|
||||||
rightMargin: 50;
|
|
||||||
}
|
}
|
||||||
Image { // Just a visual indicator that the user can swipe the cards over to see more.
|
Image { // Just a visual indicator that the user can swipe the cards over to see more.
|
||||||
source: "../images/Swipe-Icon-single.svg"
|
source: "../images/Swipe-Icon-single.svg"
|
||||||
|
@ -133,6 +131,38 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 2 * hifi.layout.spacing;
|
||||||
|
anchors {
|
||||||
|
top: parent.top;
|
||||||
|
left: parent.left;
|
||||||
|
leftMargin: 75;
|
||||||
|
topMargin: -35;
|
||||||
|
}
|
||||||
|
property var selected: allTab;
|
||||||
|
TextButton {
|
||||||
|
id: allTab;
|
||||||
|
text: "All";
|
||||||
|
property string includeActions: 'snapshot,concurrency';
|
||||||
|
selected: allTab === selectedTab;
|
||||||
|
action: tabSelect;
|
||||||
|
}
|
||||||
|
TextButton {
|
||||||
|
id: placeTab;
|
||||||
|
text: "Places";
|
||||||
|
property string includeActions: 'concurrency';
|
||||||
|
selected: placeTab === selectedTab;
|
||||||
|
action: tabSelect;
|
||||||
|
}
|
||||||
|
TextButton {
|
||||||
|
id: snapsTab;
|
||||||
|
text: "Snaps";
|
||||||
|
property string includeActions: 'snapshot';
|
||||||
|
selected: snapsTab === selectedTab;
|
||||||
|
action: tabSelect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: backgroundImage
|
id: backgroundImage
|
||||||
source: "../images/address-bar.svg"
|
source: "../images/address-bar.svg"
|
||||||
|
@ -371,11 +401,15 @@ Window {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return (place.place_name !== AddressManager.hostname); // Not our entry, but do show other entry points to current domain.
|
return (place.place_name !== AddressManager.hostname); // Not our entry, but do show other entry points to current domain.
|
||||||
// could also require right protocolVersion
|
}
|
||||||
|
property var selectedTab: allTab;
|
||||||
|
function tabSelect(textButton) {
|
||||||
|
selectedTab = textButton;
|
||||||
|
fillDestinations();
|
||||||
}
|
}
|
||||||
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
|
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
|
||||||
var options = [
|
var options = [
|
||||||
'include_actions=snapshot,concurrency',
|
'include_actions=' + selectedTab.includeActions,
|
||||||
'protocol=' + encodeURIComponent(AddressManager.protocolVersion()),
|
'protocol=' + encodeURIComponent(AddressManager.protocolVersion()),
|
||||||
'page=' + pageNumber
|
'page=' + pageNumber
|
||||||
];
|
];
|
||||||
|
@ -388,21 +422,14 @@ Window {
|
||||||
return makeModelData(story, url);
|
return makeModelData(story, url);
|
||||||
});
|
});
|
||||||
allStories = allStories.concat(stories);
|
allStories = allStories.concat(stories);
|
||||||
if (!addressLine.text) { // Don't add if the user is already filtering
|
stories.forEach(makeFilteredPlaceProcessor());
|
||||||
stories.forEach(function (story) {
|
|
||||||
if (suggestable(story)) {
|
|
||||||
suggestions.append(story);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ((data.current_page < data.total_pages) && (data.current_page <= 10)) { // just 10 pages = 100 stories for now
|
if ((data.current_page < data.total_pages) && (data.current_page <= 10)) { // just 10 pages = 100 stories for now
|
||||||
return getUserStoryPage(pageNumber + 1, cb);
|
return getUserStoryPage(pageNumber + 1, cb);
|
||||||
}
|
}
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function filterChoicesByText() {
|
function makeFilteredPlaceProcessor() { // answer a function(placeData) that adds it to suggestions if it matches
|
||||||
suggestions.clear();
|
|
||||||
var words = addressLine.text.toUpperCase().split(/\s+/).filter(identity),
|
var words = addressLine.text.toUpperCase().split(/\s+/).filter(identity),
|
||||||
data = allStories;
|
data = allStories;
|
||||||
function matches(place) {
|
function matches(place) {
|
||||||
|
@ -413,11 +440,15 @@ Window {
|
||||||
return place.searchText.indexOf(word) >= 0;
|
return place.searchText.indexOf(word) >= 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
data.forEach(function (place) {
|
return function (place) {
|
||||||
if (matches(place)) {
|
if (matches(place)) {
|
||||||
suggestions.append(place);
|
suggestions.append(place);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
function filterChoicesByText() {
|
||||||
|
suggestions.clear();
|
||||||
|
allStories.forEach(makeFilteredPlaceProcessor());
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillDestinations() {
|
function fillDestinations() {
|
||||||
|
|
43
interface/resources/qml/hifi/TextButton.qml
Normal file
43
interface/resources/qml/hifi/TextButton.qml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// TextButton.qml
|
||||||
|
//
|
||||||
|
// Created by Howard Stearns 11/12/16
|
||||||
|
// 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.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 () { };
|
||||||
|
width: label.width + (4 * spacing);
|
||||||
|
height: label.height + spacing;
|
||||||
|
radius: 2 * spacing;
|
||||||
|
color: selected ? "grey" : "transparent";
|
||||||
|
HifiConstants { id: hifi; }
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: label;
|
||||||
|
color: hifi.colors.white;
|
||||||
|
font.pixelSize: 25;
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter;
|
||||||
|
verticalCenter: parent.verticalCenter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
acceptedButtons: Qt.LeftButton;
|
||||||
|
onClicked: action(parent);
|
||||||
|
hoverEnabled: true;
|
||||||
|
onEntered: label.color = "#1DB5ED";
|
||||||
|
onExited: label.color = hifi.colors.white;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue