now service -really- works.

to attest that, beginnings of a progress slider to control the elapsed
song time, and seems to not be possible to put it horizontal, that's the
next problem

svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=906299
This commit is contained in:
Marco Martin 2009-01-05 21:52:23 +00:00
parent eb42130a45
commit 8040abf0b9
2 changed files with 27 additions and 7 deletions

View File

@ -147,6 +147,7 @@ QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGr
//setting the key/value pairs
for (it = begin; it != end; ++it) {
//kDebug() << "setting" << it.key() << "to" << it.value();
QString prop = it.key();
prop.replace(' ', '_');
obj.setProperty(prop, variant2ScriptValue(engine, it.value()));
@ -157,16 +158,17 @@ QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGr
void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config)
{
QScriptValueIterator it(obj);
KConfigSkeleton *skel = new KConfigSkeleton();
config = KConfigGroup(skel->config(), obj.property("__name").toString());
QScriptValueIterator it(obj);
while (it.hasNext()) {
it.next();
//kDebug() << it.name() << "is" << it.value().toString();
if (it.name() != "__name") {
config.writeEntry(it.name(), it.value().toString());
}
it.next();
}
}

View File

@ -12,7 +12,7 @@ plasmoid.dataUpdate = function(a, b)
plasmoid.stop = function()
{
data = controller.operationDescription("stop");
print(data+controller.name());
print(controller.name());
for ( var i in data ) {
print(i + ' -> ' + data[i] );
}
@ -21,8 +21,20 @@ plasmoid.stop = function()
print("stopping");
}
plasmoid.setProgress = function(progress)
{
operation = controller.operationDescription("seek");
operation["seconds"] = progress;
for ( var i in operation ) {
print(i + ' -> ' + operation[i] );
}
controller.startOperationCall(operation);
print("set progress to " + progress);
}
layout = new LinearLayout(plasmoid);
layout.orientation = Vertical;
layout.setOrientation(Vertical);
label = new Label();
layout.addItem(label);
@ -31,8 +43,14 @@ stop.text = "Stop";
layout.addItem(stop);
controller.associateWidget(stop, "stop");
print(controller.operationNames());
stop["clicked()"].connect(plasmoid.stop);
progress = new Slider();
progress.orientation = Horizontal;
layout.addItem(progress);
controller.associateWidget(progress, "progress");
progress["valueChanged(int)"].connect(plasmoid.setProgress);
engine.connectSource(watchingPlayer, plasmoid, 500);