Newer
Older
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
/***************************************************************************
* Copyright (C) 2019 by Kevin Whiaker <eyecreate@eyecreate.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
Plasmoid.fullRepresentation: ColumnLayout {
Layout.minimumWidth: units.gridUnit * 20
Layout.minimumHeight: units.gridUnit * 10
PlasmaExtras.ScrollArea {
id:scrollingList
Layout.fillHeight: true
Layout.fillWidth: true
ListView {
id:trackList
delegate:PlasmaComponents.ListItem {
checked: index==0?true:false
content: Text{
text:modelData
}
}
}
}
PlasmaCore.DataSource {
id:castSource
engine: "simplecast"
connectedSources: ["Playlist","CurrentState"]
interval: 500
onNewData: {
if(sourceName == "Playlist")
{
trackList.model = data.trackNames;
}
}
}
PlasmaComponents.ProgressBar {
id:trackProgress
Layout.fillWidth: true
maximumValue: castSource.data.CurrentState.trackDuration
value: castSource.data.CurrentState.trackPosition
}
Layout.minimumWidth: units.gridUnit * 2
Layout.minimumHeight: units.gridUnit * 2
iconSource: castSource.data.CurrentState.playingState?"media-playback-pause":"media-playback-start"
onClicked: {
var service = castSource.serviceForSource("CurrentState");
var playPause = service.operationDescription("changePlayState");
playPause.playing = !castSource.data.CurrentState.playingState;
service.startOperationCall(playPause);
}
}
PlasmaComponents.Button {
Layout.minimumWidth: units.gridUnit * 2
Layout.minimumHeight: units.gridUnit * 2
iconSource: "media-skip-forward"
onClicked: {
var service = castSource.serviceForSource("CurrentState");
var nextTrack = service.operationDescription("skipToNextTrack");
service.startOperationCall(nextTrack);
}
}
PlasmaComponents.TextField {
Layout.fillWidth: true
Layout.minimumWidth: units.gridWidth * 10
id:url
}
PlasmaComponents.Button {
text:"Add URL"
onClicked: {
var service = castSource.serviceForSource("CurrentState");
var loadTrack = service.operationDescription("addURLToPlaylist");
loadTrack.URL = url.text;
service.startOperationCall(loadTrack);
}
}
}
}
//TODO: Plasmoid.compactRepresentation?
}