]> git.tdb.fi Git - xinema.git/blob - remote/qml/pages/PlaybackPage.qml
abbd0d84ea95814d6b2eebb1d6a47aafe7731cd2
[xinema.git] / remote / qml / pages / PlaybackPage.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3 import fi.mikkosoft.xinema 0.1
4 import "../components"
5
6 Page
7 {
8         id: page
9
10         Column
11         {
12                 width: parent.width
13                 spacing: Theme.paddingLarge
14
15                 PageHeader
16                 {
17                         title: qsTr("Playback")
18                 }
19
20                 Label
21                 {
22                         text: streamControl.title
23                         anchors
24                         {
25                                 left: parent.left
26                                 right: parent.right
27                                 margins: Theme.horizontalPageMargin
28                         }
29                         horizontalAlignment: Text.AlignHCenter
30                         wrapMode: Text.WordWrap
31                 }
32
33                 Column
34                 {
35                         width: parent.width
36                         spacing: Theme.paddingSmall
37
38                         StreamInfo
39                         {
40                                 text: streamControl.videoSize.width+"×"+streamControl.videoSize.height+" @ "+streamControl.framerate.toFixed(2)+"fps"
41                         }
42
43                         StreamInfo
44                         {
45                                 text: streamControl.videoCodec
46                         }
47
48                         StreamInfo
49                         {
50                                 text: streamControl.audioCodec
51                         }
52                 }
53
54                 Slider
55                 {
56                         id: slider
57                         width: parent.width
58
59                         minimumValue: 0.0
60                         maximumValue: Math.max(streamControl.duration, 1.0)
61                         valueText:
62                         {
63                                 var secs = Math.round(value);
64                                 var mins = Math.floor(secs/60);
65                                 secs %= 60;
66                                 var hours = Math.floor(mins/60);
67                                 mins %= 60;
68
69                                 var str = "";
70                                 if(hours>0)
71                                 {
72                                         str = hours+":";
73                                         if(mins<10)
74                                                 str += "0";
75                                 }
76
77                                 str += mins+":";
78                                 if(secs<10)
79                                         str += "0";
80
81                                 return str+secs;
82                         }
83
84                         onDownChanged:
85                         {
86                                 if(!down)
87                                         streamControl.position = value;
88                         }
89                 }
90
91                 IconButton
92                 {
93                         id: playPauseButton
94                         anchors.horizontalCenter: parent.horizontalCenter
95                         property string action: (streamControl.playbackState==StreamControl.Playing ? "pause" : "play")
96                         icon.source: "image://theme/icon-l-"+action
97                         onPressed:
98                         {
99                                 if(action=="play")
100                                         streamControl.playbackState = StreamControl.Playing;
101                                 else if(action=="pause")
102                                         streamControl.playbackState = StreamControl.Paused;
103                         }
104                 }
105
106                 ChannelSelect
107                 {
108                         id: audioSelect
109                         label: "Audio"
110                         channels: streamControl.audioChannels
111                         onCurrentChannelChanged: streamControl.currentAudioChannel = currentChannel
112                 }
113
114                 ChannelSelect
115                 {
116                         id: spuSelect
117                         label: "Subtitles"
118                         channels: streamControl.spuChannels
119                         onCurrentChannelChanged: streamControl.currentSpuChannel = currentChannel
120                 }
121         }
122
123         StreamControl
124         {
125                 id: streamControl
126                 control: xinemaControl
127                 onPositionChanged:
128                 {
129                         if(!slider.down)
130                                 slider.value = position;
131                 }
132                 onCurrentAudioChannelChanged: audioSelect.currentChannel = streamControl.currentAudioChannel;
133                 onCurrentSpuChannelChanged: spuSelect.currentChannel = streamControl.currentSpuChannel;
134         }
135 }