mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 18:22:46 +00:00
Added track selection and minor UI improvements
This commit is contained in:
parent
1eb6a8fb5d
commit
020c968f9c
18 changed files with 271 additions and 68 deletions
|
@ -1,5 +1,41 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
import "../"
|
||||
import "../../Utils.js" as Utils
|
||||
|
||||
Column {
|
||||
property var itemData
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
PlayToolbar {
|
||||
onPlayPressed: pageStack.push(Qt.resolvedUrl("../../pages/VideoPage.qml"),
|
||||
{"itemId": itemId, "itemData": itemData, "audioTrack": trackSelector.audioTrack,
|
||||
"subtitleTrack": trackSelector.subtitleTrack })
|
||||
}
|
||||
|
||||
VideoTrackSelector {
|
||||
id: trackSelector
|
||||
width: parent.width
|
||||
tracks: itemData.MediaStreams
|
||||
}
|
||||
|
||||
PlainLabel {
|
||||
text: "sub: %1 dub: %2".arg(trackSelector.subtitleTrack).arg(trackSelector.audioTrack)
|
||||
}
|
||||
|
||||
PlainLabel {
|
||||
id: tinyDetails
|
||||
text: qsTr("Released: %1 — Run time: %2").arg(itemData.ProductionYear).arg(Utils.ticksToText(itemData.RunTimeTicks))
|
||||
}
|
||||
|
||||
PlainLabel {
|
||||
id: overviewText
|
||||
text: itemData.Overview
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.secondaryHighlightColor
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
|
||||
}
|
||||
|
|
23
qml/components/itemdetails/PlayToolbar.qml
Normal file
23
qml/components/itemdetails/PlayToolbar.qml
Normal file
|
@ -0,0 +1,23 @@
|
|||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Row {
|
||||
signal playPressed()
|
||||
|
||||
anchors {
|
||||
//left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: Theme.horizontalPageMargin
|
||||
rightMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
spacing: Theme.paddingMedium
|
||||
IconButton {
|
||||
id: favouriteButton
|
||||
icon.source: "image://theme/icon-m-favorite"
|
||||
}
|
||||
IconButton {
|
||||
id: playButton
|
||||
icon.source: "image://theme/icon-l-play"
|
||||
onPressed: playPressed()
|
||||
}
|
||||
}
|
8
qml/components/itemdetails/UnsupportedDetails.qml
Normal file
8
qml/components/itemdetails/UnsupportedDetails.qml
Normal file
|
@ -0,0 +1,8 @@
|
|||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: true
|
||||
text: qsTr("Item type unsupported")
|
||||
hintText: qsTr("This is still an alpha version :)")
|
||||
}
|
67
qml/components/itemdetails/VideoTrackSelector.qml
Normal file
67
qml/components/itemdetails/VideoTrackSelector.qml
Normal file
|
@ -0,0 +1,67 @@
|
|||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Column {
|
||||
property var tracks
|
||||
readonly property int audioTrack: audioSelector.currentItem ? audioSelector.currentItem._index : 0
|
||||
readonly property int subtitleTrack: subitleSelector.currentItem._index
|
||||
|
||||
ListModel {
|
||||
id: audioModel
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: subtitleModel
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: audioSelector
|
||||
label: qsTr("Audio track")
|
||||
menu: ContextMenu {
|
||||
Repeater {
|
||||
model: audioModel
|
||||
MenuItem {
|
||||
readonly property int _index: model.Index
|
||||
text: model.DisplayTitle
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: subitleSelector
|
||||
label: qsTr("Subtitle track")
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
readonly property int _index: -1
|
||||
//: Value in ComboBox to disable subtitles
|
||||
text: qsTr("Off")
|
||||
}
|
||||
Repeater {
|
||||
model: subtitleModel
|
||||
MenuItem {
|
||||
readonly property int _index: model.Index
|
||||
text: model.DisplayTitle
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onTracksChanged: {
|
||||
audioModel.clear()
|
||||
subtitleModel.clear()
|
||||
for(var i = 0; i < tracks.length; i++) {
|
||||
var track = tracks[i];
|
||||
switch(track.Type) {
|
||||
case "Audio":
|
||||
audioModel.append(track)
|
||||
break;
|
||||
case "Subtitle":
|
||||
subtitleModel.append(track)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue