ny commit

This commit is contained in:
Niels
2025-05-28 20:47:14 +02:00
commit d4cd7f8bdc
324 changed files with 7462 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
Flickable {
id: flick
width:parent.width
height: parent.height - Theme.paddingLarge * 3
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge * 3
contentHeight: column1.height
Column{
id: column1
width: parent.width
spacing: Theme.paddingLarge
Label {
font.pixelSize: Theme.fontSizeExtraLarge
font.bold: true
text: "AllRadio v"+ _version
anchors.horizontalCenter: parent.horizontalCenter
}
Label {
text: "License: GPL"
anchors.horizontalCenter: parent.horizontalCenter
}
Image{
source: "../images/community.png"
height: Theme.itemSizeHuge
width: height
fillMode: Image.PreserveAspectFit
anchors {
horizontalCenter: parent.horizontalCenter
}
}
/* Rectangle{
gradient: Gradient {
GradientStop { position: 0.0; color: "#333333" }
GradientStop { position: 1.0; color: "#777777" }
}
anchors {
horizontalCenter: parent.horizontalCenter
}
height: 3
width: parent.width-64
}
Label {
width: 360
font.pixelSize: Theme.fontSizeMedium
text: "Created by llelectronics"
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
}
Repeater{
anchors.horizontalCenter: parent.horizontalCenter
//model: credits
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: title
font.pixelSize: Theme.fontSizeSmall
}
}
Rectangle{
gradient: Gradient {
GradientStop { position: 0.0; color: "#333333" }
GradientStop { position: 1.0; color: "#777777" }
}
anchors {
horizontalCenter: parent.horizontalCenter
}
height: 3
width: parent.width-64
}
Button {
id: homepage
anchors.horizontalCenter: parent.horizontalCenter
text: "<a href=\"https://github.com/llelectronics/webcat\">Sourcecode on Github</a>"
onClicked: {
mainWindow.openNewTab('page-'+salt(), "https://github.com/llelectronics/webcat", false);
}
} */
Label {
width: parent.width-70
font.pixelSize: Theme.fontSizeSmall
text: qsTr("AllRadio is an internet radio station player")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
height: 200
wrapMode: Text.WordWrap
}
}
}
}
+430
View File
@@ -0,0 +1,430 @@
import QtQuick 2.2
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import QtGraphicalEffects 1.0
import "../items"
import "../models"
import "../delegates"
import "../helpers/db.js" as Favorites
import "../helpers/jsFunctions.js" as JS
Page {
id: page
anchors.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize
property bool stationOk: radioPlayer.stationOk
property bool online: radioBrowser.online
property GetCountryStations getTrending1: GetCountryStations {id: getTrending1}
property GetCountryStations getTrending2: GetCountryStations {id: getTrending2}
property GetCountryStations getTrendingWorld: GetCountryStations {id: getTrendingWorld}
property GetCountryStations getTags1: GetCountryStations {id: getTags1}
property GetCountryStations getTags2: GetCountryStations {id: getTags2}
property GetCountryStations getTags3: GetCountryStations {id: getTags3}
property ListModel playedCountries: ListModel {id: playedCountries}
property ListModel playedTags: ListModel {id: playedTags}
property ListModel favorites: ListModel {id: favorites}
onOnlineChanged: if (online) reloadDbData()
onStationOkChanged: if (stationOk) reloadDbData()
Splash {
id: splashItem
visible: radioBrowser.loading ? true : false
}
SilicaFlickable {
anchors.fill: parent
contentHeight: mainColumn.height
clip: mediaPlayerPanel.expanded
visible: !splashItem.visible
onVisibleChanged: if (visible) reloadDbData()
PullDownMenu {
MenuItem {
text: "About"
onClicked: pageStack.push("AboutPage.qml")
}
MenuItem {
text: "Settings"
onClicked: pageStack.push("SettingsPage.qml")
}
MenuItem {
text: "Sleep timer"
onClicked: {
pageStack.push("SleepTimerPage.qml")
}
/* var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", {
hour: 0,
minute: 30,
hourMode: DateTime.TwentyFourHours
})
dialog.accepted.connect(function() {
})
} */
}
}
Column {
id: mainColumn
width: parent.width
spacing: Theme.paddingMedium
Item {
width: parent.width
height: Theme.itemSizeHuge
Label {
id: hlabel
font.pixelSize: Theme.fontSizeExtraLarge
text: JS.getGreeting()
color: Theme.highlightColor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
}
Image {
id: logo
anchors.verticalCenter: hlabel.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
height: Theme.itemSizeMedium
width: height
smooth: true
source: "../images/community.png"
}
ColorOverlay {
anchors.fill: logo
source: logo
color: Theme.highlightColor
}
}
BackgroundItem {
width: parent.width
height: Theme.itemSizeMedium
ButtonRect {fill: false}
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.paddingMedium
Image {
anchors.verticalCenter: parent.verticalCenter
source: "image://theme/icon-m-search"
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: "Search"
font.pixelSize: Theme.fontSizeLarge
}
}
Image {
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
source: "image://theme/icon-m-right"
}
onClicked: pageStack.push("SearchStationsPage.qml",{searchby:"name"})}
// Most played countries
Column {
//visible: playedCountries.count > 0
width: parent.width
Item {height: Theme.paddingLarge;width: parent.width}
HeaderButton {
headerText: "Countries"
onClicked: pageStack.push("CountryListPage.qml")
}
Item {height: Theme.paddingMedium;width: parent.width}
SilicaGridView {
clip: true
visible: playedCountries.count > 0
width: parent.width
height: playedCountries.count > 0 ? Theme.itemSizeExtraSmall * Math.round(playedCountries.count / 2) : 0
cellWidth: parent.width / 2
cellHeight: Theme.itemSizeExtraSmall
model: playedCountries
delegate: FavoriteCountryList {onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"name",_countrycode: alpha_2})}
}
}
// Most played favorites
Item {height: Theme.paddingLarge;width: parent.width;visible: favorites.count > 0}
HeaderButton {
visible: favorites.count > 0
headerText: "My Favorites"
onClicked: pageStack.push("FavoritesPage.qml")
}
GridView {
//clip: true
clip: true
height: Theme.itemSizeHuge * 1.35
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
visible: favorites.count > 0//radioBrowser.getCountryName(_country) || playedCountries.count > 0 ? true : false
model: favorites
delegate: SmallStationsDelegate {
flagVisible: true
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
// Recently played
Item {height: Theme.paddingLarge;width: parent.width;visible: radioPlayer.playHistory.count > 0}
HeaderButton {
visible: radioPlayer.playHistory.count > 0
headerText: "Play history"//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("HistoryPage.qml")
}
GridView {
visible: radioPlayer.playHistory.count > 0
clip: true
height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
model: radioPlayer.playHistory
delegate: SmallStationsDelegate {
flagVisible: true
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
// Most played tags
Item {height: Theme.paddingLarge;width: parent.width;visible: radioPlayer.playHistory.count > 0}
HeaderButton {
visible: radioPlayer.playHistory.count > 0
headerText: "My most played Tags"//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("TagListPage.qml",{})
}
GridView {
visible: radioPlayer.playHistory.count > 0
clip: true
height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
model: playedTags
delegate: SmallTagsDelegate {
onClicked: pageStack.push("CountryStationsPage.qml",{filterby: "tag",searchby: "clicktrend",stext: tag,comboIndex: 1 })
}
}
Item {height: Theme.paddingLarge;width: parent.width;visible: radioBrowser.getCountryName(_country) || playedCountries.count > 0 ? true : false}
HeaderButton {
visible: radioBrowser.getCountryName(_country) || playedCountries.count > 0 ? true : false
headerText: playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: playedCountries.get(0).alpha_2})
}
GridView {
clip: true
height: Theme.itemSizeHuge * 1.35
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
visible: radioBrowser.getCountryName(_country) || playedCountries.count > 0 ? true : false
model: getTrending1.searchModel
delegate: SmallStationsDelegate {
flagVisible: false
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
Item {height: Theme.paddingLarge;width: parent.width;visible: playedCountries.count > 1}
HeaderButton {
visible: playedCountries.count > 1
headerText: playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(1).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: playedCountries.get(1).alpha_2})
}
GridView {
clip: true
height: Theme.itemSizeHuge * 1.35
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
visible: playedCountries.count > 1
model: getTrending2.searchModel
delegate: SmallStationsDelegate {
flagVisible: false
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
Item {height: Theme.paddingLarge;width: parent.width}
HeaderButton {
headerText: "Trending in the world"//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: ""})
}
GridView {
clip: true
height: Theme.itemSizeHuge * 1.35
width: page.width
cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2
flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight
model: getTrendingWorld.searchModel
delegate: SmallStationsDelegate {
flagVisible: true
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
}
}
function reloadDbData() {
Favorites.getTagsRecentClicked(playedTags,15)
Favorites.getFavorites(favorites,"myclickcount",15)
Favorites.getCountryRecentClicked(playedCountries,4)
getTrending1.countrycode = playedCountries.count > 0 ? playedCountries.get(0).alpha_2 : _country
getTrending1.order = "clicktrend"
getTrending1.offset = 0
getTrending1.limit = 15
if (getTrending1.searchModel.count !== 0) getTrending1.clear = true; else getTrending1.getStations()
if (playedCountries.count > 1) {
getTrending2.countrycode = playedCountries.get(1).alpha_2
getTrending2.order = "clicktrend"
getTrending2.offset = 0
getTrending2.limit = 15
if (getTrending2.searchModel.count !== 0) getTrending2.clear = true; else getTrending2.getStations()
}
getTrendingWorld.countrycode = ""
getTrendingWorld.order = "clicktrend"
getTrendingWorld.offset = 0
getTrendingWorld.limit = 15
if (getTrendingWorld.searchModel.count !== 0) getTrendingWorld.clear=true; else getTrendingWorld.getStations()
}
Component.onCompleted: {
Favorites.init()
radioBrowser.getList()
reloadDbData()
}
}
+50
View File
@@ -0,0 +1,50 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import "../delegates"
Page {
property bool sfocus: false
property bool pageAcitve
z:1
SilicaListView {
id: view
anchors.fill: parent
clip: mediaPlayerPanel.expanded
anchors.bottomMargin: mediaPlayerPanel.visibleSize
VerticalScrollDecorator {}
header: Column {
width: parent.width
PageHeader {title: "Community Radio Browser";description: "Found "+view.count + " countries"}
SearchField {
id: sfield
width: parent.width
placeholderText: "Search"
text: ""
inputMethodHints: Qt.ImhNoAutoUppercase //| Qt.ImhNoPredictiveText
EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: {focus = false}
focus: sfocus
onTextChanged: radioBrowser.countriesModel.filter = text
onClicked: {view.currentIndex = -1}
}
}
model: radioBrowser.countriesModel.countryModel
delegate: CountryListDelegate {
id: countryListDelegate;
onClicked: {
sfocus=false;
settings.setValue("lastCountry",alpha_2)
pageStack.push("CountryStationsPage.qml",{stationCount: stationcount,_countrycode: alpha_2,searchby:"name"})
}
}
}
}
+213
View File
@@ -0,0 +1,213 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../models"
import "../delegates"
Page {
property string sortedby: ""
property string filterby
property alias searchby: getCountryStations.order
property string searchtext: ""
property string _countrycode: ""
property int stationCount: 0
property alias name: getCountryStations.name
property alias tag: getCountryStations.tag
property string stext: ""
property GetCountryStations getCountryStations: GetCountryStations {id: getCountryStations}
property bool sfocus
property int comboIndex: 0
onStatusChanged: if (status !== PageStatus.Active) sfocus=false
onSearchbyChanged: {
switch (searchby){
case "name": sortedby = "Sorted by Name";break;
case "votes": sortedby = "Most likes";break;
case "clicktrend": sortedby = "Trending right now";break;
case "clickcount": sortedby = "Most played";
}
}
BusyIndicator {
id: busy
visible: running
anchors.centerIn: parent
size: BusyIndicatorSize.Large
running: !getCountryStations.finished && getCountryStations.offset > 0
}
SilicaListView {
id: view
enabled: !busy.visible
opacity: enabled ? 1 : 0.5
anchors.fill: parent
clip: mediaPlayerPanel.expanded
anchors.bottomMargin: sfocus ? 0 : mediaPlayerPanel.visibleSize
ViewPlaceholder {
anchors.centerIn: parent
enabled: view.count == 0
text: getCountryStations.finished && view.count === 0 ? "Oh no..." : "Please wait"
hintText: getCountryStations.finished && view.count === 0 ? "No radio stations!?!" : "getting radio stations"
}
VerticalScrollDecorator {}
onAtYEndChanged: {
if (atYEnd && view.count >= getCountryStations.limit) {
if (getCountryStations.offset + getCountryStations.limit < stationCount) {
getCountryStations.offset = getCountryStations.offset + getCountryStations.limit + 1
getCountryStations.getStations()
}
}
}
header: Column {
width: parent.width
PageHeader {
id: pheader
Column {
id: headerCol
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
anchors.right: parent.right
anchors.left: parent.left
anchors.rightMargin: Theme.paddingLarge//headerLogo.width + (Theme.paddingLarge * 2)
anchors.leftMargin: Theme.paddingLarge
Row {
anchors.right: parent.right
spacing: Theme.paddingMedium
Image {
id: headerLogo
anchors.bottom: ccode.bottom
height: ccode.height * 0.8
fillMode: Image.PreserveAspectFit
smooth: true
source: _countrycode === "" ? "../images/bycountry_t.png" : "../flags/"+_countrycode.toLowerCase()+".png"
}
Label {
id: ccode
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
wrapMode: Text.WordWrap
elide: Text.ElideLeft
text: getCountryStations.country //+ " ["+stationCount+"]"
}
}
Label {
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
width: parent.width
horizontalAlignment: Text.AlignRight
text: sortedby//view.count + " channels"
}
}
}
Row {
id: row
width: parent.width
SearchField {
id: sfield
placeholderText: "Search"
inputMethodHints: Qt.ImhNoAutoUppercase
EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: focus = false
focus: sfocus
text: stext
onFocusChanged: sfocus = focus
onTextChanged: {
if (searchtext !== text) {
if (text.length > 0) {
searchtext = text
switch(searchCombo.currentIndex) {
case 0: filterby="name";getCountryStations.offset=0;getCountryStations.name=text;getCountryStations.tag="";break
case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=text;getCountryStations.name=""
}
} else {
getCountryStations.name=""
getCountryStations.tag=""
}
getCountryStations.offset=0;
getCountryStations.clear = true
getCountryStations.getStations()
}
}
onClicked: {view.currentIndex = -1}
}
}
ComboBox {
id: searchCombo
label: "Search by:"
currentIndex: comboIndex
menu: ContextMenu {
MenuItem { text: "Name" }
MenuItem { text: "Tag" }
}
onValueChanged: {
switch(currentIndex) {
case 0: filterby="name";getCountryStations.offset=0;getCountryStations.name=sfield.text;getCountryStations.tag="";break
case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=sfield.text;getCountryStations.name=""
}
if (searchtext.length !== 0) {
getCountryStations.offset=0;
getCountryStations.clear = true
getCountryStations.getStations()
}
}
}
}
PullDownMenu {
MenuItem {
text: "Name"
onClicked: {getCountryStations.clear=true;getCountryStations.order = "name";getCountryStations.getStations()}//;xmlModel.running = true}
}
MenuItem {
text: "Most likes"
onClicked: {getCountryStations.clear=true;getCountryStations.order = "votes";getCountryStations.getStations()}//;xmlModel.running = true}
}
MenuItem {
text: "Most played"
onClicked: {getCountryStations.clear=true;getCountryStations.order = "clickcount";getCountryStations.getStations()}//xmlModel.running = true}
}
MenuItem {
text: "Trending right now"
onClicked: {getCountryStations.clear=true;getCountryStations.order = "clicktrend";getCountryStations.getStations()}//xmlModel.running = true}
}
}
model: getCountryStations.stationsModel
delegate: StationsDelegate{
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec
radioPlayer._bitrate = model.bitrate
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid)
}
}
}
}
Component.onCompleted: {
getCountryStations.countrycode=_countrycode
getCountryStations.order=searchby
getCountryStations.getStations()
}
}
+123
View File
@@ -0,0 +1,123 @@
import QtQuick 2.2
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import "../delegates"
import "../helpers/db.js" as Favorites
Page {
property ListModel favorites: ListModel {id: favorites}
property real showP: 0.0
property int tab: allradioSettings.value("favoriteTab",0)
SilicaListView {
id: view
// enabled: !splashItem.visible
opacity: enabled ? 1 : 0
anchors.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize
clip: mediaPlayerPanel.expanded
onVisibleChanged: if (visible) updateFav()
header: Column {
width: parent.width
spacing: Theme.paddingLarge
PageHeader{
title: "Favorites"
description: "Radio stations: "+view.count
}
Row {
id: row
// width: parent.width
//anchors.verticalCenter: parent.verticalCenter
width: parent.width
TabButton {
id: home
//anchors.verticalCenter: parent.verticalCenter
down: tab === 0
width: parent.width / 3
fontSize: Theme.fontSizeMedium
fontColor: down ? Theme.secondaryColor : Theme.secondaryColor
iconVisible: false
// icon: "image://theme/icon-m-home" //"image://theme/icon-m-video"
text: "By name"
onButtonClick: {showP=0.0;tab = 0;Favorites.getFavorites(favorites,"name",10000)}
}
TabButton {
id: search
// anchors.verticalCenter: parent.verticalCenter
down: tab === 1
width: parent.width / 3
fontSize: Theme.fontSizeMedium
fontColor: down ? Theme.secondaryColor : Theme.secondaryColor
iconVisible: false
// icon: "image://theme/icon-m-search"
text: "Most played"
onButtonClick: {showP=0.0;tab = 1;Favorites.getFavorites(favorites,"myclickcount",10000)}
}
TabButton {
id: favorite
// anchors.verticalCenter: parent.verticalCenter
down: tab === 2
width: parent.width / 3
fontSize: Theme.fontSizeMedium
fontColor: down ? Theme.secondaryColor : Theme.secondaryColor
iconVisible: false
// icon: "image://theme/icon-m-favorite"
text: "Last played"
onButtonClick: {showP=0.0;tab = 2;Favorites.getFavorites(favorites,"myclicktimestamp",10000);console.log("CLICK")}
}
}
Item {width: parent.width;height: Theme.paddingLarge}
}
ViewPlaceholder {
anchors.centerIn: allRadio.center
enabled: view.count == 0
text: "Favorites"
hintText: "add favorites here"
}
VerticalScrollDecorator {}
model: favorites
delegate: StationsDelegate{
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer._favorite = model.favorite ? true : false
//pageStack.push("RadioPlayerPage.qml")
}
}
}
function updateFav() {
var sort
switch (tab){
case 0: sort = "name";break
case 1: sort = "myclickcount";break
case 2: sort = "myclicktimestamp";break
}
Favorites.getFavorites(favorites,sort,10000)
}
Component.onCompleted: {
updateFav()
}
Component.onDestruction: {
allradioSettings.setValue("favoriteTab",tab)
}
}
}
+65
View File
@@ -0,0 +1,65 @@
import QtQuick 2.2
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import "../delegates"
import "../helpers/db.js" as Favorites
Page {
property ListModel history: ListModel {id: history}
SilicaListView {
id: view
enabled: !splashItem.visible
//visible: enabled
opacity: enabled ? 1 : 0
anchors.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize
clip: mediaPlayerPanel.expanded
onVisibleChanged: if (visible) updateHist()
ViewPlaceholder {
anchors.centerIn: allRadio.center
enabled: view.count == 0
text: "History"
hintText: "see you play history here"
}
VerticalScrollDecorator {}
header: PageHeader{title: "Play history";description: "Radio stations: "+view.count}
/* onAtYEndChanged: {
if (atYEnd && view.count >= getCountryStations.limit) {
// console.log("AT BOTTOM: "+view.count)
if (getCountryStations.offset + getCountryStations.limit < stationCount) {
getCountryStations.offset = getCountryStations.offset + getCountryStations.limit + 1
getCountryStations.getStations()
}
}
} */
model: history
delegate: StationsDelegate{
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
radioPlayer._favorite = model.favorite ? true : false
//pageStack.push("RadioPlayerPage.qml")
}
}
}
function updateHist() {
Favorites.getHistory(history,10000)
}
Component.onCompleted: updateHist()
}
}
+320
View File
@@ -0,0 +1,320 @@
import QtQuick 2.0
import QtGraphicalEffects 1.0
import Sailfish.Silica 1.0
import "../delegates"
import "../items"
import "../helpers/jsFunctions.js" as JSfunctions
Page {
id: page
property bool keepScreenOn: Qt.application.active && radioPlayer.isPlaying ? true : false
allowedOrientations: radioPlayer.isPlaying && radioPlayer.radioVideo ? Orientation.All : Orientation.Portrait
backNavigation: orientation === Orientation.Portrait ? true : false//radioPlayer.isPlaying && radioPlayer.radioVideo && Orientation.Portrait ? false : true
ScreenBlank {
id: screenBlank
enabled: keepScreenOn
}
VideoPlayer {
id: videoPlayer
z:97
anchors.top: orientation === Orientation.Portrait ? radioName.top : page.top
anchors.bottom: orientation === Orientation.Portrait ? radioName.bottom : page.bottom
anchors.left: orientation === Orientation.Portrait ? radioName.left : page.left
anchors.right: orientation === Orientation.Portrait ? radioName.right : page.right
anchors.margins: orientation === Orientation.Portrait ? radioName.border.width : 0
visible: radioPlayer.radioVideo && !radioPlayer.isPaused ? true : false
onVisibleChanged: visible ? enabled=true : enabled = false
videoSource: radioPlayer
}
PageHeader {
id: pheader
z: orientation === Orientation.Portrait || !screenTimer.running ? 98 : 0
visible: orientation !== Orientation.LandscapeMask
Column {
id: headerCol
visible: orientation === Orientation.Portrait
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
width: parent.width
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
spacing: Theme.paddingSmall
Row {
spacing: Theme.paddingMedium
anchors.right: parent.right
Text{
id: countryName
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
horizontalAlignment: Text.AlignRight
text: radioPlayer.radioCountryName
}
Image {
anchors.bottom: countryName.bottom
height: countryName.height * 0.9
fillMode: Image.PreserveAspectFit
smooth: false
source: radioPlayer._countrycode === "" ? "../images/bycountry_t.png" : "../flags/"+radioPlayer._countrycode.toLowerCase()+".png"
}
}
Label {
anchors.right: parent.right
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeExtraSmall
text: JSfunctions.getAll(radioPlayer._hls,radioPlayer._codec,radioPlayer._bitrate)
}
}
}
Rectangle {
id: radioName
anchors.top: pheader.bottom
anchors.topMargin: Theme.paddingLarge
anchors.bottom: artistSongName.top
anchors.bottomMargin: Theme.paddingLarge
color: Theme.rgba(Theme.overlayBackgroundColor,0.5)
radius: 20
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - (Theme.paddingLarge * 2)
Behavior on opacity {
FadeAnimator {}
}
Label {
id: nameLabel
z:99
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge * 2
anchors.leftMargin: Theme.paddingLarge
anchors.rightMargin: Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter
font.bold: false
color: Theme.secondaryColor
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeLarge
fontSizeMode: Text.Fit
maximumLineCount: 2
width: parent.width - (Theme.paddingLarge * 2)
height: Theme.itemSizeExtraSmall
elide: Text.ElideLeft
horizontalAlignment: Text.AlignHCenter
text: radioPlayer._name
}
RadioImage {
anchors.top: nameLabel.bottom
anchors.bottom: parent.bottom
anchors.topMargin: Theme.paddingLarge
anchors.bottomMargin: Theme.paddingLarge * 2
id: radioImage
width: height
stationBorder: false
anchors.horizontalCenter: parent.horizontalCenter
stationImage: radioPlayer._favicon ? radioPlayer._favicon : ""
stationLabel: radioPlayer._name
flag: false
onWidthChanged: if (width > radioName.width - (Theme.paddingLarge * 2)) width = radioName.width - (Theme.paddingLarge * 2)
}
}
Rectangle {
id: artistSongName
anchors.bottom: playerControls.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Theme.paddingLarge
color: Theme.rgba(Theme.overlayBackgroundColor,0.5)
radius: 20
width: parent.width
height: radioname.height + radiocountry.height + (Theme.paddingMedium * 3)
opacity: radioname.text !== "" ? 1.0 : 0.0
Behavior on opacity {
FadeAnimator {}
}
Column {
width: parent.width
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Theme.paddingSmall
Label {
id: radioname
color: Theme.secondaryColor
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeLarge
fontSizeMode: Text.Fit
maximumLineCount: 5
width: parent.width - (Theme.paddingMedium * 2)
elide: Text.ElideLeft
horizontalAlignment: Text.AlignHCenter
visible: text.length > 0
text: radioPlayer.radioVideo && !radioPlayer.isPaused ? radioPlayer._name : radioPlayer.radioArtist // radioPlayer._name
}
Label {
id: radiocountry
color: Theme.secondaryColor
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeLarge
fontSizeMode: Text.Fit
maximumLineCount: 5
width: parent.width - (Theme.paddingMedium * 2)
elide: Text.ElideLeft
horizontalAlignment: Text.AlignHCenter
visible: text.length > 0
text: radioPlayer.radioSong
}
}
}
// Radio player controls
Item {
id: playerControls
visible: orientation === Orientation.Portrait
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter
height: Theme.itemSizeLarge
width: parent.width
Rectangle {
width: row.width + (Theme.paddingMedium * 3)
height: play.height + (Theme.paddingMedium * 2)
radius: 90
color: Theme.rgba(Theme.overlayBackgroundColor,0.5)
border.width: 0
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
Row {
id: row
anchors.centerIn: parent
spacing: Theme.paddingMedium
Image {
id: play
source: radioPlayer.isPlaying ? "image://theme/icon-l-pause" : "image://theme/icon-l-play"
height: Theme.itemSizeSmall * 0.75
width: height
MouseArea {
anchors.fill: parent
onClicked: radioPlayer.isPlaying ? radioPlayer.pauseStream() : radioPlayer.resumeStream()//icon.source == "image://theme/icon-l-play" ? icon.source = "image://theme/icon-l-pause" : icon.source = "image://theme/icon-l-play"
}
}
Image {
id: playDLNA
source: "image://theme/icon-m-next"
height: play.height
width: height
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: play.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: {
console.log(radioPlayer.playlistIndex + " | "+radioPlayer.playlistCount)
radioPlayer.playlistIndex < radioPlayer.playlistCount && radioPlayer.playlistIndex > -1 ? radioPlayer.playlistIndex = radioPlayer.playlistIndex + 1 : radioPlayer.playlistIndex = 0
radioPlayer.loadPlaylistSelected()
}
}
}
Image {
source: "image://theme/icon-s-timer"
height: play.height
width: height
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: play.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push("SleepTimerPage.qml")
/* console.log(radioPlayer.playlistIndex + " | "+radioPlayer.playlistCount)
if (radioPlayer.playlistIndex > -1) {
radioPlayer.playlistIndex > 0 ? radioPlayer.playlistIndex = radioPlayer.playlistIndex - 1 : radioPlayer.playlistIndex = 16
} else radioPlayer.playlistIndex = 0
radioPlayer.loadPlaylistSelected() */
}
}
}
}
}
Rectangle {
visible: orientation === Orientation.Portrait
width: upvote.width + url.width + favorite.width + (Theme.paddingMedium * 4)
height: upvote.height + (Theme.paddingMedium * 2)
radius: 90
color: Theme.rgba(Theme.overlayBackgroundColor,0.5)
border.width: 0
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
Row {
anchors.centerIn: parent
spacing: Theme.paddingMedium
Image {
id: favorite
source: radioPlayer._favorite ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
height: Theme.itemSizeSmall * 0.75
width: height
MouseArea {
anchors.fill: parent
onClicked: {
radioPlayer._favorite ? radioPlayer._favorite = false : radioPlayer._favorite = true
radioPlayer.setStationFavorite(radioPlayer._stationuuid,radioPlayer._name,radioPlayer._countrycode,radioPlayer._homepage,radioPlayer._url_resolved,radioPlayer._favicon,radioPlayer._tags,radioPlayer._codec,radioPlayer._bitrate,radioPlayer._hls,radioPlayer._favorite)
}
}
}
Image {
id: upvote
property bool returnValue: false
source: returnValue ? "image://theme/icon-m-like" : "image://theme/icon-m-outline-like"
height: favorite.height
width: height
fillMode: Image.PreserveAspectFit
onReturnValueChanged: console.log(" RETURN VALUE: "+upvote.returnValue)
MouseArea {
anchors.fill: parent
onClicked: {radioBrowser.upVote(radioPlayer._stationuuid,upvote.returnValue)}
}
}
Image {
id: url
source: "image://theme/icon-m-website"
height: favorite.height
width: height
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
onClicked: {
statusInfo.visible = true;remorse.execute(statusInfo,qsTr("<h2>Open radio station webpage</h2>"), function() {Qt.openUrlExternally(radioPlayer._homepage)}, 5000)
}
}
}
}
}
}
Component.onCompleted: {
mediaPlayerPanel.open=false
radioPlayer.playerPageOpen=true
}
Component.onDestruction: {
if (radioPlayer.radioVideo) radioPlayer.pauseStream()
radioPlayer.playerPageOpen=false
mediaPlayerPanel.open=true
}
}
+222
View File
@@ -0,0 +1,222 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../models"
import "../delegates"
//import "../radio-browser"
Page {
property string sortedby: ""
property string filterby
property alias searchby: getCountryStations.order
property string searchtext: ""
property string _countrycode: ""
property int stationCount: 0
property alias name: getCountryStations.name
property alias tag: getCountryStations.tag
property GetCountryStations getCountryStations: GetCountryStations {id: getCountryStations}
property bool sfocus
onStatusChanged: if (status !== PageStatus.Active) sfocus=false
onSearchbyChanged: {
// console.log("SEARCHBY: "+searchby)
switch (searchby){
case "name": sortedby = "Sorted by Name";break;
case "votes": sortedby = "Most likes";break;
case "clicktrend": sortedby = "Trending right now";break;
case "clickcount": sortedby = "Most played";
}
}
BusyIndicator {
id: busy
visible: running
anchors.centerIn: parent
size: BusyIndicatorSize.Large
running: !getCountryStations.finished && getCountryStations.offset > 0
}
SilicaListView {
id: view
enabled: !busy.visible
opacity: enabled ? 1 : 0.5
anchors.fill: parent
clip: mediaPlayerPanel.expanded
anchors.bottomMargin: sfocus ? 0 : mediaPlayerPanel.visibleSize
ViewPlaceholder {
anchors.centerIn: parent
enabled: view.count == 0
text: getCountryStations.finished && view.count === 0 ? "Search" : "Please wait"
hintText: getCountryStations.finished && view.count === 0 ? "radio stations" : "getting radio stations"
}
VerticalScrollDecorator {}
onAtYEndChanged: {
if (atYEnd && view.count >= getCountryStations.limit) {
// console.log("AT BOTTOM: "+view.count)
if (getCountryStations.offset + getCountryStations.limit < stationCount) {
getCountryStations.offset = getCountryStations.offset + getCountryStations.limit + 1
getCountryStations.getStations()
}
}
}
header: Column {
width: parent.width
PageHeader {
id: pheader
Column {
id: headerCol
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
anchors.right: parent.right
anchors.left: parent.left
anchors.rightMargin: Theme.paddingLarge//headerLogo.width + (Theme.paddingLarge * 2)
anchors.leftMargin: Theme.paddingLarge
Row {
anchors.right: parent.right
spacing: Theme.paddingMedium
Image {
id: headerLogo
anchors.bottom: ccode.bottom
height: ccode.height * 0.8
fillMode: Image.PreserveAspectFit
smooth: true
source: _countrycode === "" ? "../images/bycountry_t.png" : "../flags/"+_countrycode.toLowerCase()+".png"
}
Label {
id: ccode
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
wrapMode: Text.WordWrap
elide: Text.ElideLeft
text: getCountryStations.country //+ " ["+stationCount+"]"
}
}
Label {
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
width: parent.width
horizontalAlignment: Text.AlignRight
text: sortedby//view.count + " channels"
}
}
}
Row {
id: row
width: parent.width
SearchField {
id: sfield
placeholderText: "Search"
inputMethodHints: Qt.ImhNoAutoUppercase //| Qt.ImhNoPredictiveText
EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: focus = false
focus: sfocus
onFocusChanged: {
sfocus = focus
//radioPlayer.isPlaying || radioPlayer.isPaused && !focus ? mediaPlayerPanel.open = false : mediaPlayerPanel.open = true
}
onTextChanged: {
if (searchtext !== text) {
// console.log(" *** TEXT CHANGED: "+searchCombo.currentIndex+" --- TEXT: "+text)
if (text.length > 0) {
searchtext = text
switch(searchCombo.currentIndex) {
case 0: filterby="name";getCountryStations.offset=0;getCountryStations.name=text;getCountryStations.tag="";break
case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=text;getCountryStations.name=""
}
} else {
getCountryStations.name=""
getCountryStations.tag=""
}
getCountryStations.offset=0;
getCountryStations.clear = true
if (text !== "") getCountryStations.getStations()
}
}
onClicked: {view.currentIndex = -1}
}
}
ComboBox {
id: searchCombo
label: "Search by:"
currentIndex: 0
menu: ContextMenu {
MenuItem { text: "Name" }
MenuItem { text: "Tag" }
}
onValueChanged: {
switch(currentIndex) {
case 0: filterby="name";getCountryStations.offset=0;getCountryStations.name=sfield.text;getCountryStations.tag="";break
case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=sfield.text;getCountryStations.name=""
}
if (searchtext.length !== 0) {
getCountryStations.offset=0;
getCountryStations.clear = true
getCountryStations.getStations()
}
}
}
}
PullDownMenu {
MenuItem {
text: "Name"
onClicked: {getCountryStations.order = "name";if (view.count > 0) {getCountryStations.clear=true;getCountryStations.getStations()}}//;xmlModel.running = true}
}
MenuItem {
text: "Most likes"
onClicked: {getCountryStations.order = "votes";if (view.count > 0) {getCountryStations.clear=true;getCountryStations.getStations()}}//;xmlModel.running = true}
}
MenuItem {
text: "Most played"
onClicked: {getCountryStations.order = "clickcount";if (view.count > 0) {getCountryStations.clear=true;getCountryStations.getStations()}}//xmlModel.running = true}
}
MenuItem {
text: "Trending right now"
onClicked: {getCountryStations.order = "clicktrend";if (view.count > 0) {getCountryStations.clear=true;getCountryStations.getStations()}}//xmlModel.running = true}
}
}
model: getCountryStations.stationsModel
delegate: StationsDelegate{
onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._favicon = model.favicon
radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid
//radioPlayer._favorite = model.favorite ? true : false
radioPlayer.getStationFavorite(model.stationuuid)
// pageStack.push("RadioPlayerPage.qml")
}
}
}
}
Component.onCompleted: {
//MediaPlayerPanel.open = false
getCountryStations.countrycode=""
getCountryStations.order=searchby
//getCountryStations.getStations()
}
// Component.onDestruction: if (radioPlayer.isPlaying || radioPlayer.isPaused) mediaPlayerPanel.open ? mediaPlayerPanel.open = false : mediaPlayerPanel.open = true
}
+30
View File
@@ -0,0 +1,30 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
SilicaListView {
id: listView
model: 20
anchors.fill: parent
header: PageHeader {
title: qsTr("Nested Page")
}
delegate: BackgroundItem {
id: delegate
Label {
x: Theme.horizontalPageMargin
text: qsTr("Item") + " " + index
anchors.verticalCenter: parent.verticalCenter
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
}
onClicked: console.log("Clicked " + index)
}
VerticalScrollDecorator {}
}
}
+39
View File
@@ -0,0 +1,39 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
Flickable {
id: flick
width:parent.width
height: parent.height - Theme.paddingLarge * 3
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge * 3
contentHeight: column1.height
Column{
id: column1
width: parent.width
spacing: Theme.paddingLarge
Image{
source: "../images/community.png"
height: Theme.itemSizeHuge
width: height
fillMode: Image.PreserveAspectFit
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Label {
width: parent.width-70
font.pixelSize: Theme.fontSizeSmall
text: qsTr("Working on it.....")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
height: 200
wrapMode: Text.WordWrap
}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../items"
Page {
id: page
property bool closePanel: false
onClosePanelChanged: if (closePanel) mediaPlayerPanel.open = false
// property int sleepTime: 0
//allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
clip: true
anchors.bottomMargin: mediaPlayerPanel.visibleSize
VerticalScrollDecorator {}
PageHeader {title: "Sleep timer";description: ((sleepTime > 0) ? (qsTr("Remaning time: ") + (sleepTime) + qsTr(" minutes")) : qsTr("choose time: ") + minutes.value )}
ValuePicker {
id: minutes
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
max: 121
min: 1
value: sleepTime
}
Label {
text: minutes.value
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: Theme.secondaryHighlightColor
font.family: Theme.fontFamilyHeading
font.pixelSize: Theme.fontSizeHuge
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 40
spacing: Theme.paddingLarge
Button {
text: ((sleepTime > 0) ? (qsTr("Change")) : (qsTr("Start")))
onPressed: sleepTime = minutes.value
}
Button {
text: qsTr("Stop")
onPressed: sleepTime = 0;
}
}
}
Component.onCompleted: if (mediaPlayerPanel.open) closePanel = true; else closePanel = false;
Component.onDestruction: if (closePanel) mediaPlayerPanel.open = true
}
+83
View File
@@ -0,0 +1,83 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import "../helpers/db.js" as Favorites
Page {
property int maxTags: 0
property int fontMin: Theme.fontSizeExtraSmall
property int fontMax: Theme.fontSizeHuge
property ListModel playedTags: ListModel {id: playedTags}
function getCrSize(size) { /// Calculate and return a more nice looking fontsize based on number of stations.
//console.log("FUNCTION: "+size)
var fs = size === 100 ? fontMin : (size / maxTags) * (fontMax - fontMin) + fontMin;
return fs
}
onMaxTagsChanged: console.log("MAXTAGS: "+maxTags)
SilicaFlickable {
id: flick
anchors.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize
contentWidth: parent.width;
contentHeight: flow.childrenRect.height + header.height + (Theme.paddingLarge * 2)
clip: true
// header: PageHeader{title: "Play history";description: "Radio stations: "+view.count}
ScrollDecorator {flickable:flick}
Column {
id: header
width: parent.width
PageHeader {
title: "Played tags"
description: "Found "+playedTags.count
}
}
Flow {
id: flow
anchors.top: header.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Theme.paddingMedium
clip: true
spacing: Theme.paddingLarge
Repeater {
id: elements
model: playedTags
//onItemAdded: "ITEM ADDED: "+model.tag
Text {
id: tagtext
text: tag
font.pixelSize: getCrSize(myclickcount) //((stationcount / 3000) * 100) * (Theme.fontSizeExtraLarge - Theme.fontSizeSmall) + Theme.fontSizeSmall
//font.bold: if (font.pixelSize >= Theme.fontSizeLarge) true; else false
color: {
if (font.pixelSize <= Theme.fontSizeMedium) Theme.secondaryColor;
else if (font.pixelSize > Theme.fontSizeMedium) Theme.primaryColor
}
MouseArea {
id: m
anchors.fill: parent
onPressedChanged: pressed ? tagtext.color = Theme.highlightColor : tagtext.color = Theme.primaryColor
onClicked: pageStack.push("CountryStationsPage.qml",{filterby: "tag",searchby: "name",stext: tag,comboIndex: 1 })//pageStack.push("CrTagStationsPage.qml",{filter: tag}) //pageStack.push("TagStationsPage.qml",{filter: tag,running: true})// //{Qt.inputMethod.hide();flick.focus=true ;pageStack.push("TagStationsPage.qml",{filter: tag,running: true})}
}
}
}
}
}
Component.onCompleted: {Favorites.getTagsClicked(playedTags,100000)}
}