/
tracker.qml
91 lines (77 loc) · 3.12 KB
/
tracker.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import QtQuick 1.0
import org.nemomobile.grilo 0.1
import QtMultimediaKit 1.1
Item {
width: 400
height: 600
ListView {
anchors.fill: parent
GriloRegistry {
id: registry
Component.onCompleted: {
console.log("Registry is ready");
loadAll();
}
}
model: GriloModel {
id: griloModel
source: GriloBrowse {
id: browser
source: "grl-tracker-source"
registry: registry
metadataKeys: [GriloBrowse.Title, GriloBrowse.Url, GriloBrowse.Duration]
typeFilter: [GriloBrowse.Audio]
Component.onCompleted: {
console.log(browser.supportedKeys);
console.log(browser.slowKeys);
refresh();
console.log("Refreshing");
}
onAvailableChanged: {
console.log("Available ? " + available);
refresh();
}
onBaseMediaChanged: refresh();
}
}
delegate: Rectangle {
color: mouse.pressed ? "steelblue" : "white"
width: parent.width
height: 40
MouseArea {
id: mouse
anchors.fill: parent
onClicked: {
console.log(media.url);
if (media.container) {
browser.baseMedia = media.serialize();
}
else {
audio.source = media.url;
audio.play();
}
}
Text {
id: label
width: parent.width - 50
text: media.title
height: 30
font.pixelSize: 36
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: duration
text: media.duration
font.pixelSize: 36
anchors.verticalCenter: parent.verticalCenter
height: label.height
width: 50
anchors.left: label.right
}
}
}
}
Audio {
id: audio
}
}