-
-
Save Nevon/ecf0e99fe189b2c38b22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
import Ubuntu.Components 1.1 | |
import Ubuntu.Components.ListItems 1.0 as ListItem | |
import "../components/JSONListModel" | |
Page { | |
id: tickerPage | |
anchors.fill: parent | |
title: i18n.tr("Dota 2 Match Ticker") | |
UbuntuListView { | |
id: matchList | |
anchors.fill: parent | |
model: tickerFeed.model | |
visible: model.count > 0 | |
JSONListModel { | |
id: tickerFeed | |
source: "http://dailydota2.com/match-apis" | |
query: "$.matches[*]" | |
} | |
PullToRefresh { | |
enabled: true | |
refreshing: tickerFeed.status == tickerFeed.loadingStatus | |
onRefresh: tickerFeed.reload() | |
} | |
delegate: ListItem.Subtitled { | |
id: matchItemDelegate | |
text: model.team1.team_name + " " + i18n.tr("vs") + " " + model.team2.team_name | |
subText: (model.status === 1 || model.timediff < 0) ? i18n.tr("LIVE") : model.starttime | |
} | |
} | |
Label { | |
visible: matchList.model.count === 0 && tickerFeed.status === tickerFeed.readyStatus | |
anchors.centerIn: parent | |
text: i18n.tr("No upcoming matches") | |
fontSize: "medium" | |
} | |
Label { | |
visible: tickerFeed.status === tickerFeed.errorStatus | |
anchors.centerIn: parent | |
text: i18n.tr("Something went wrong") | |
} | |
tools: ToolbarItems { | |
ToolbarButton { | |
action: { | |
text: i18n.tr("Refresh") | |
iconName: "refresh" | |
onTriggered: tickerFeed.reload() | |
} | |
} | |
locked: true | |
opened: true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment