35a255722e
svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=906206
38 lines
1011 B
JavaScript
38 lines
1011 B
JavaScript
engine = dataEngine("nowplaying");
|
|
players = engine.sources;
|
|
watchingPlayer = players[0];
|
|
controller = engine.serviceForSource(watchingPlayer);
|
|
|
|
plasmoid.dataUpdate = function(a, b)
|
|
{
|
|
label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " +
|
|
parseInt(b.Position/60) + ":" + (parseInt(b.Position)%60);
|
|
}
|
|
|
|
plasmoid.stop = function()
|
|
{
|
|
data = engine.serviceForSource(watchingPlayer).operationDescription("stop");
|
|
print(data+controller.name());
|
|
for ( var i in data ) {
|
|
print(i + ' -> ' + data[i] );
|
|
}
|
|
|
|
controller.startOperationCall(controller.operationDescription("stop"));
|
|
print("stopping");
|
|
}
|
|
|
|
layout = new LinearLayout(plasmoid);
|
|
layout.orientation = Vertical;
|
|
label = new Label();
|
|
layout.addItem(label);
|
|
|
|
stop = new PushButton();
|
|
stop.text = "Stop";
|
|
layout.addItem(stop);
|
|
|
|
controller.associateWidget(stop, "stop");
|
|
print(controller.operationNames());
|
|
|
|
stop["clicked()"].connect(plasmoid.stop);
|
|
|
|
engine.connectSource(watchingPlayer, plasmoid, 500); |