155 lines
6.1 KiB
QML
155 lines
6.1 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
import QtGraphicalEffects 1.0
|
|
import "../helpers/jsFunctions.js" as JSfunctions
|
|
|
|
ListItem {
|
|
id: delegate
|
|
property alias favIcon: favIcon
|
|
property alias contextMenuHeight: contextMenu.height
|
|
//property bool favo: favorite ? true : false
|
|
property variant view
|
|
enabled: lastcheckok
|
|
opacity: lastcheckok ? 1.0 : 0.3
|
|
// property bool favorite: false
|
|
height: menuOpen ? contextMenu.height + Theme.itemSizeExtraLarge : Theme.itemSizeExtraLarge
|
|
menu: contextMenu
|
|
contentHeight: Theme.itemSizeExtraLarge
|
|
showMenuOnPressAndHold: true
|
|
|
|
ContextMenu {
|
|
id: contextMenu
|
|
MenuItem {
|
|
Row {
|
|
anchors.centerIn: parent
|
|
spacing: Theme.paddingMedium
|
|
Image {
|
|
source: "image://theme/icon-m-like"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
height: Theme.itemSizeExtraSmall * 0.5
|
|
width: height
|
|
fillMode: Image.PreserveAspectFit
|
|
}
|
|
Label {
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
text: qsTr("Vote on Community Radio Browser")
|
|
}
|
|
}
|
|
onClicked: console.log("LIKE!!!") //remove()//listView.currentItem.remove(rpindex,rpsource) //listView.remorseAction();
|
|
}
|
|
MenuItem {
|
|
Row {
|
|
anchors.centerIn: parent
|
|
spacing: Theme.paddingMedium
|
|
Image {
|
|
//source: favo ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
height: Theme.itemSizeExtraSmall * 0.5
|
|
width: height
|
|
fillMode: Image.PreserveAspectFit
|
|
}
|
|
Label {
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
//text: favo ? qsTr("Remove from favorites") : qsTr("Add to favorites")
|
|
}
|
|
}
|
|
onClicked: {
|
|
favo ? favo = false : favo = true
|
|
//radioPlayer._favorite = favo
|
|
|
|
radioPlayer.setStationFavorite(stationuuid,name,countrycode,homepage,url_resolved,favicon,tags,codec,bitrate,hls,favo)
|
|
}
|
|
}
|
|
}
|
|
|
|
RadioImage {
|
|
id: favIcon
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: Theme.paddingSmall
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
height: Theme.itemSizeLarge//nameLabel.height + codecLabel.height + tagLabel.height
|
|
width: height
|
|
stationImage: favicon ? favicon : ""
|
|
stationLabel: name
|
|
//radius: 20
|
|
}
|
|
|
|
Label {
|
|
id: nameLabel
|
|
anchors.bottom: countryLabel.top
|
|
// anchors.bottomMargin: Theme.paddingSmall
|
|
anchors.left: favIcon.right
|
|
anchors.right: fav.left
|
|
anchors.leftMargin: Theme.paddingLarge
|
|
anchors.rightMargin: Theme.paddingMedium
|
|
elide: Text.ElideRight
|
|
width: parent.width - (favIcon.width + (Theme.paddingLarge * 2))
|
|
text: lastcheckok == "1" ? name : " [DOWN] "+name
|
|
color: lastcheckok == "1" ? Theme.primaryColor : Theme.secondaryColor
|
|
font.strikeout: lastcheckok == "1" ? false : true
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
}
|
|
Image {
|
|
id:countryImage
|
|
height: countryLabel.height * 0.8
|
|
|
|
anchors.leftMargin: Theme.paddingLarge
|
|
fillMode: Image.PreserveAspectFit
|
|
opacity: 0.7
|
|
anchors.left: favIcon.right
|
|
anchors.bottom: countryLabel.bottom
|
|
source: countrycode ? "../flags/"+countrycode.toLowerCase()+".png" : ""
|
|
}
|
|
Label {
|
|
id: countryLabel
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.left: countryImage.right
|
|
anchors.leftMargin: Theme.paddingMedium
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
text: countrycode ? radioBrowser.getCountryName(countrycode) : "No country"//"Country name"//getAll(hls,codec,bitrate)
|
|
color: delegate.highlighted ? Theme.highlightColor : Theme.secondaryColor
|
|
}
|
|
Label {
|
|
id: codecLabel
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.right: parent.right
|
|
anchors.leftMargin: Theme.paddingLarge
|
|
anchors.rightMargin: Theme.paddingSmall
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
text: lastcheckok ? JSfunctions.getAll(hls,codec,bitrate) : "[OFFLINES]"
|
|
color: delegate.highlighted ? Theme.highlightColor : Theme.secondaryColor
|
|
}
|
|
Label {
|
|
id: tagLabel
|
|
anchors.top: countryLabel.bottom
|
|
//anchors.topMargin: Theme.paddingSmall
|
|
anchors.left: favIcon.right
|
|
anchors.leftMargin: Theme.paddingLarge
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
font.italic: true
|
|
width: parent.width - (favIcon.width + (Theme.paddingLarge * 2))
|
|
elide: Text.ElideRight
|
|
|
|
text: tags
|
|
color: delegate.highlighted ? Theme.highlightColor : Theme.secondaryColor
|
|
}
|
|
Image {
|
|
id: fav
|
|
height: nameLabel.height * 0.8
|
|
width: height
|
|
fillMode: Image.PreserveAspectFit
|
|
opacity: 0.8
|
|
visible: false//favo
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: nameLabel.verticalCenter
|
|
//anchors.top: nameLabel.top
|
|
anchors.rightMargin: Theme.paddingMedium
|
|
source: "image://theme/icon-m-favorite-selected" //favo ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
|
|
}
|
|
|
|
//onFavoChanged: if (favo) setRadioData()
|
|
|
|
|
|
}
|