From ddc760936948b8f59ee9b5e09d34a9af851614ca Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 6 Jan 2009 02:40:30 +0000 Subject: [PATCH] tidies svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=906371 --- .../script-nowplaying/contents/code/main.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scriptengines/javascript/tests/script-nowplaying/contents/code/main.js b/scriptengines/javascript/tests/script-nowplaying/contents/code/main.js index 6f66c53a0..20153168b 100644 --- a/scriptengines/javascript/tests/script-nowplaying/contents/code/main.js +++ b/scriptengines/javascript/tests/script-nowplaying/contents/code/main.js @@ -1,8 +1,9 @@ +// set up the engine, player and controller engine = dataEngine("nowplaying"); -players = engine.sources; -watchingPlayer = players[0]; +watchingPlayer = engine.sources[0]; controller = service("nowplaying", watchingPlayer); +// define a few functions plasmoid.dataUpdate = function(a, b) { label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " + @@ -34,6 +35,7 @@ plasmoid.setProgress = function(progress) print("set progress to " + progress); } +// Set up the UI layout = new LinearLayout(plasmoid); layout.setOrientation(QtVertical); label = new Label(); @@ -43,15 +45,16 @@ stop = new PushButton(); stop.text = "Stop"; layout.addItem(stop); -controller.associateWidget(stop, "stop"); - -stop["clicked()"].connect(plasmoid.stop); - progress = new Slider(); progress.orientation = QtHorizontal; layout.addItem(progress); -controller.associateWidget(progress, "progress"); +// Glue things together +stop["clicked()"].connect(plasmoid.stop); progress["sliderMoved(int)"].connect(plasmoid.setProgress); +controller.associateWidget(stop, "stop"); +controller.associateWidget(progress, "progress"); + engine.connectSource(watchingPlayer, plasmoid, 500); +