harbour-labyrinth/qml/pages/InfoPage.qml
2025-05-30 16:03:59 +02:00

381 lines
14 KiB
QML

import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id:infoPage
property string showname
property string showimage: ""
property string summary: ""
property string showid: ""
property string showstatus: ""
property string showprem: ""
property string showrating: ""
property string shownetwork: ""
property string showupdated: ""
property string showprev: ""
property string shownext: ""
property string shownextse: ""
property string simdb: ""
property string sofficial: ""
property bool favorite: getFav(showid)
SilicaFlickable {
id: flick
anchors.top: parent.top
clip: true
anchors.bottom: parent.bottom
width: parent.width// - (Theme.paddingLarge * 2)
height: (showImg.height * showImg.scale) + sumheader.height + Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter
contentHeight: showSummary.height + showImg.height + sumheader.height + seasonA.height + seasonB.height + (Theme.paddingLarge * 5)
PageHeader {id: sumheader; title: showname; }
RemorsePopup {id: remorse}
Image {
id: favIcon
anchors.right: parent.right
anchors.top: showImg.top
anchors.topMargin: Theme.paddingSmall
//anchors.verticalCenter: showStatus.verticalCenter
height: showStatus.height + (showStatus.height/2)
width: height
anchors.rightMargin: Theme.paddingMedium
source: favorite ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
MouseArea {
anchors.fill: favIcon
onClicked: if (getFav(showid)) {favorite = false; delFav(showid)} else {favorite = true; addFav(showid, showname, showimage, summary, showstatus, showprem, showrating, shownetwork)}
}
}
Text {
id: showStatus
text: "Status: <b>" + showstatus + "</b>"
color: Theme.primaryColor
wrapMode: Text.WordWrap
anchors.topMargin: Theme.paddingMedium
anchors.bottom: showPrem.top
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
/* Image {
id: showImg
anchors.top: sumheader.bottom
anchors.topMargin: Theme.paddingMedium
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
fillMode: Image.PreserveAspectFit
source: showimage
//width: height * 0.8
//height: parent.height
} */
Image {
id: showImg
property bool zoomed: false
/* anchors.top: sumheader.bottom
anchors.topMargin: Theme.paddingMedium
anchors.bottomMargin: Theme.paddingLarge
anchors.rightMargin: Theme.paddingMedium
anchors.leftMargin: Theme.paddingMedium
anchors.left: parent.left */
anchors.top: sumheader.bottom
anchors.margins: Theme.paddingLarge
anchors.left: parent.left
scale: 1.1
// x: 0
// y: 0
fillMode: Image.PreserveAspectFit
source: showimage ? showimage : "../No-Image-.png"
// width: 210
width: height * 0.8
// height: showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingMedium
// height: (showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingLarge) * showImg.scale
height: (showPrem.height + showRating.height + showNetwork.height + showPrev.height + showNext.height + showStatus.height + Theme.itemSizeSmall) * showImg.scale
// scale: 1.1
// height: showName.height + showStatus.height + showPrem.height + showRating.height + showNext.height + showPrev.height
BusyIndicator {
id: imgBysy
running: showImg.progress !== 1.0
size: BusyIndicatorSize.Large
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: showImg
onClicked: {
//if (showImg.width !== Screen.width) {showImg.width = Screen.width; showImg.height = Screen.height;} else {showImg.height = showPrem.height + showRating.height + showNetwork.height + showPrev.height + showNext.height + showStatus.height}
}
}
}
Text {
id: showPrem
text: showprem ? "Premiered: <b>" + showprem + "</b>" : "Premiered: ?"
color: Theme.primaryColor
wrapMode: Text.WordWrap
anchors.bottom: showRating.top
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
Text {
id: showRating
text: "Average rating: <b>" + showrating + "</b>"
color: Theme.primaryColor
wrapMode: Text.WordWrap
anchors.bottom: showNetwork.top
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
Text {
id: showNetwork
text: "Network: <b>" + shownetwork + "</b>"
color: Theme.primaryColor
wrapMode: Text.ElideRight
maximumLineCount: 1
anchors.bottom: showPrev.top
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
Text {
id: showPrev
text: showprev !== "" ? "Previous: <b>" + showprev+"</b>" : ""
color: Theme.primaryColor
wrapMode: Text.ElideRight
maximumLineCount: 1
anchors.bottom: showNext.top
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
Text {
id: showNext
text: shownext !== "" || shownext !== "Unknown" ? "Next: ("+shownextse + ") <b>" + shownext + "</b>" : "" //nextse !=="" ? "Next: ("+nextse+")" : "Next: " + next
color: Theme.primaryColor
wrapMode: Text.ElideRight
maximumLineCount: 1
anchors.bottom: showImg.bottom
anchors.bottomMargin: Theme.paddingMedium
anchors.left: showImg.right
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
font.pixelSize: Theme.fontSizeSmall
}
BackgroundItem {
id: seasonA
anchors.left: parent.left
anchors.right: parent.right
anchors.top: showImg.bottom
anchors.topMargin: Theme.paddingLarge
OpacityRampEffect {
sourceItem: actorRect
direction: OpacityRamp.TopToBottom
offset: 0.0
slope: 1.0
}
Rectangle {
id: actorRect
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: actorName.height + Theme.paddingLarge
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
}
Image {
id: nextIconActor
anchors.verticalCenter: actorRect.verticalCenter
anchors.right: actorRect.right
anchors.rightMargin: Theme.paddingMedium
source: "image://theme/icon-m-right" + "?" + (seasonA.highlighted ? Theme.highlightColor : Theme.primaryColor)
}
Text {
id: actorName
text: "Show main cast"
color: seasonA.highlighted ? Theme.highlightColor : Theme.primaryColor
anchors.leftMargin: Theme.paddingMedium
anchors.rightMargin: Theme.paddingMedium
anchors.left: parent.left
anchors.right: nextIconActor.left
anchors.verticalCenter: actorRect.verticalCenter
wrapMode: Text.ElideRight
font.pixelSize: Theme.fontSizeLarge
maximumLineCount: 1
}
onClicked: pageStack.push(Qt.resolvedUrl("CastPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
}
/* IconButton {
anchors.bottom: showImg.bottom
anchors.bottomMargin: Theme.paddingLarge
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
//width: 200
//height: 50
icon.source: "../imdb.png"
onClicked: console.log("Delete!")
} */
BackgroundItem {
id: seasonB
anchors.left: parent.left
anchors.right: parent.right
anchors.top: seasonA.bottom
anchors.topMargin: Theme.paddingLarge
OpacityRampEffect {
sourceItem: seasonRect
direction: OpacityRamp.TopToBottom
offset: 0.0
slope: 1.0
}
Rectangle {
id: seasonRect
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: seasonName.height + Theme.paddingLarge
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
}
Image {
id: nextIconSeason
anchors.verticalCenter: seasonRect.verticalCenter
anchors.right: seasonRect.right
anchors.rightMargin: Theme.paddingMediumIMDB
source: "image://theme/icon-m-right" + "?" + (seasonB.highlighted ? Theme.highlightColor : Theme.primaryColor)
}
Text {
id: seasonName
text: "Show seasons"
color: seasonB.highlighted ? Theme.highlightColor : Theme.primaryColor
anchors.leftMargin: Theme.paddingMedium
anchors.rightMargin: Theme.paddingMedium
anchors.left: parent.left
anchors.right: nextIconSeason.left
anchors.verticalCenter: seasonRect.verticalCenter
wrapMode: Text.ElideRight
font.pixelSize: Theme.fontSizeLarge
maximumLineCount: 1
// font.bold: true
}
onClicked: pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
}
/* Text {
id: showSummaryH
anchors.top: seasonB.bottom
anchors.topMargin: Theme.paddingLarge
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
text: "Summary"
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeLarge
//font.underline: true
//font.bold: true
} */
Text {
id: showSummary
anchors.top: seasonB.bottom
//anchors.topMargin: Theme.paddingSmall
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Theme.paddingLarge
anchors.rightMargin: Theme.paddingLarge
text: summary
textFormat: Text.StyledText
color: Theme.primaryColor
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeMedium
}
function fitToScreen() {
showImg.scale = Math.min(flick.width / showImg.width, flick.height / showImg.height, 1)
//pinchArea.minScale = scale
prevScale = scale
}
/* Image {
id: showImg
anchors.top: sumheader.bottom
anchors.topMargin: Theme.paddingMedium
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
fillMode: Image.PreserveAspectFit
source: showimage
//width: height * 0.8
//height: parent.height
property real prevScale
MouseArea {
anchors.fill: parent
onClicked: {
scale = Math.min(flick.width / width, flick.height / height, 1)
//pinchArea.minScale = scale
//prevScale = scale
}
//transform: Scale { origin.x: 25; origin.y: 25; xScale: 3}
}
} */
PullDownMenu {
MenuItem {
visible: simdb !== "" ? true : false
text: qsTr("Open IMDB page")
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
//WebViewer {webPageAddress: defaultDevice }
console.log("IMDB: "+simdb)
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": "http://m.imdb.com/title/"+simdb} )
}
}
MenuItem {
visible: sofficial !== "" ? true : false
text: qsTr("Official site")
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
//WebViewer {webPageAddress: defaultDevice }
console.log("Official: "+sofficial)
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": sofficial} )
}
}
}
}
}