Add plasmoid to project.
This commit is contained in:
93
plasmoid/package/contents/ui/main.qml
Normal file
93
plasmoid/package/contents/ui/main.qml
Normal file
@@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
PlasmaComponents.Button {
|
||||
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 {
|
||||
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?
|
||||
}
|
||||
Reference in New Issue
Block a user