1 import Qt 4.6 |
|
2 |
|
3 |
|
4 Item { |
|
5 width: 800 |
|
6 height: 400 |
|
7 |
|
8 Audio { |
|
9 id: audio |
|
10 source: audioUrl |
|
11 } |
|
12 |
|
13 Image { |
|
14 id: coverArt |
|
15 source: audio.coverArtUrlLarge |
|
16 anchors.horizontalCenter: parent.horizontalCenter |
|
17 anchors.bottom: title.top |
|
18 } |
|
19 Text { |
|
20 id: title |
|
21 text: audio.title |
|
22 anchors.horizontalCenter: parent.horizontalCenter |
|
23 anchors.bottom: albumTitle.top |
|
24 } |
|
25 Text { |
|
26 id: albumTitle |
|
27 text: audio.albumTitle |
|
28 anchors.horizontalCenter: parent.horizontalCenter |
|
29 anchors.bottom: albumArtist.top |
|
30 } |
|
31 Text { |
|
32 id: albumArtist |
|
33 text: audio.albumArtist |
|
34 anchors.horizontalCenter: parent.horizontalCenter |
|
35 anchors.bottom: controls.top |
|
36 } |
|
37 Item { |
|
38 id: controls |
|
39 width: 800 |
|
40 height: 120 |
|
41 anchors.horizontalCenter: parent.horizontalCenter |
|
42 anchors.bottom: parent.bottom |
|
43 |
|
44 Image { |
|
45 source: "qrc:/images/play.png" |
|
46 x: 375 |
|
47 y: 25 |
|
48 |
|
49 visible: !audio.playing || audio.paused |
|
50 |
|
51 MouseRegion { |
|
52 anchors.fill: parent |
|
53 onClicked: audio.play() |
|
54 } |
|
55 } |
|
56 |
|
57 Image { |
|
58 source: "qrc:/images/pause.png" |
|
59 x: 375 |
|
60 y: 25 |
|
61 |
|
62 visible: audio.playing && !audio.paused |
|
63 |
|
64 MouseRegion { |
|
65 anchors.fill: parent |
|
66 onClicked: audio.pause() |
|
67 } |
|
68 } |
|
69 |
|
70 Image { |
|
71 source: "qrc:/images/stop.png" |
|
72 x: 305 |
|
73 y: 35 |
|
74 |
|
75 visible: audio.playing |
|
76 |
|
77 MouseRegion { |
|
78 anchors.fill: parent |
|
79 onClicked: audio.stop() |
|
80 } |
|
81 } |
|
82 |
|
83 Image { |
|
84 source: "qrc:/images/mute.png" |
|
85 x: 465 |
|
86 y: 40 |
|
87 |
|
88 MouseRegion { |
|
89 anchors.fill: parent |
|
90 onClicked: { |
|
91 audio.muted = !audio.muted; |
|
92 } |
|
93 } |
|
94 |
|
95 Image { |
|
96 source: "qrc:/images/muted.png" |
|
97 anchors.fill: parent |
|
98 |
|
99 visible: audio.muted |
|
100 } |
|
101 } |
|
102 |
|
103 Item { |
|
104 x: 535 |
|
105 y: 50 |
|
106 width: 230 |
|
107 height: 40 |
|
108 |
|
109 Image { |
|
110 source: "qrc:/images/volume.png" |
|
111 x: 0 |
|
112 y: 5 |
|
113 |
|
114 MouseRegion { |
|
115 anchors.fill: parent |
|
116 |
|
117 onClicked: audio.volume = (mouse.x - 15) / 200 |
|
118 } |
|
119 } |
|
120 |
|
121 Image { |
|
122 source: "qrc:/images/volume-grip.png" |
|
123 x: audio.volume * 200 |
|
124 y: 0 |
|
125 |
|
126 MouseRegion { |
|
127 anchors.fill: parent |
|
128 drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 0; drag.maximumX: 200 |
|
129 |
|
130 onPositionChanged: audio.volume = parent.x / 200 |
|
131 } |
|
132 } |
|
133 } |
|
134 |
|
135 Item { |
|
136 x: 5 |
|
137 y: 0 |
|
138 width: 790 |
|
139 height: 30 |
|
140 |
|
141 Image { |
|
142 source: "qrc:/images/progress.png" |
|
143 x: 0 |
|
144 y: 5 |
|
145 |
|
146 MouseRegion { |
|
147 anchors.fill: parent |
|
148 |
|
149 onClicked: audio.position = (mouse.x - 15) * audio.duration / 760 |
|
150 enabled: audio.duration > 0 |
|
151 } |
|
152 } |
|
153 |
|
154 Image { |
|
155 source: "qrc:/images/progress-grip.png" |
|
156 x: 760 * audio.position / audio.duration |
|
157 y: 0 |
|
158 visible: audio.duration > 0 |
|
159 |
|
160 MouseRegion { |
|
161 anchors.fill: parent |
|
162 drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 0; drag.maximumX: 760 |
|
163 |
|
164 onReleased: audio.position = parent.x / 760 |
|
165 } |
|
166 } |
|
167 } |
|
168 } |
|
169 } |
|