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:
parent
eb42130a45
commit
8040abf0b9
@ -147,6 +147,7 @@ QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGr
|
|||||||
|
|
||||||
//setting the key/value pairs
|
//setting the key/value pairs
|
||||||
for (it = begin; it != end; ++it) {
|
for (it = begin; it != end; ++it) {
|
||||||
|
//kDebug() << "setting" << it.key() << "to" << it.value();
|
||||||
QString prop = it.key();
|
QString prop = it.key();
|
||||||
prop.replace(' ', '_');
|
prop.replace(' ', '_');
|
||||||
obj.setProperty(prop, variant2ScriptValue(engine, it.value()));
|
obj.setProperty(prop, variant2ScriptValue(engine, it.value()));
|
||||||
@ -157,16 +158,17 @@ QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGr
|
|||||||
|
|
||||||
void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config)
|
void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config)
|
||||||
{
|
{
|
||||||
QScriptValueIterator it(obj);
|
|
||||||
|
|
||||||
KConfigSkeleton *skel = new KConfigSkeleton();
|
KConfigSkeleton *skel = new KConfigSkeleton();
|
||||||
config = KConfigGroup(skel->config(), obj.property("__name").toString());
|
config = KConfigGroup(skel->config(), obj.property("__name").toString());
|
||||||
|
|
||||||
|
QScriptValueIterator it(obj);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
//kDebug() << it.name() << "is" << it.value().toString();
|
||||||
if (it.name() != "__name") {
|
if (it.name() != "__name") {
|
||||||
config.writeEntry(it.name(), it.value().toString());
|
config.writeEntry(it.name(), it.value().toString());
|
||||||
}
|
}
|
||||||
it.next();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +384,7 @@ void SimpleJavaScriptApplet::setupObjects()
|
|||||||
|
|
||||||
// Bindings for data engine
|
// Bindings for data engine
|
||||||
m_engine->setDefaultPrototype(qMetaTypeId<DataEngine*>(), m_engine->newQObject(new DataEngine()));
|
m_engine->setDefaultPrototype(qMetaTypeId<DataEngine*>(), m_engine->newQObject(new DataEngine()));
|
||||||
m_engine->setDefaultPrototype(qMetaTypeId<Service*>(), m_engine->newQObject(new DummyService()));
|
m_engine->setDefaultPrototype(qMetaTypeId<Service*>(), m_engine->newQObject(new DummyService()));
|
||||||
m_engine->setDefaultPrototype(qMetaTypeId<ServiceJob*>(), m_engine->newQObject(new ServiceJob(QString(), QString(), QMap<QString, QVariant>())));
|
m_engine->setDefaultPrototype(qMetaTypeId<ServiceJob*>(), m_engine->newQObject(new ServiceJob(QString(), QString(), QMap<QString, QVariant>())));
|
||||||
|
|
||||||
global.setProperty("dataEngine", m_engine->newFunction(SimpleJavaScriptApplet::dataEngine));
|
global.setProperty("dataEngine", m_engine->newFunction(SimpleJavaScriptApplet::dataEngine));
|
||||||
|
@ -12,7 +12,7 @@ plasmoid.dataUpdate = function(a, b)
|
|||||||
plasmoid.stop = function()
|
plasmoid.stop = function()
|
||||||
{
|
{
|
||||||
data = controller.operationDescription("stop");
|
data = controller.operationDescription("stop");
|
||||||
print(data+controller.name());
|
print(controller.name());
|
||||||
for ( var i in data ) {
|
for ( var i in data ) {
|
||||||
print(i + ' -> ' + data[i] );
|
print(i + ' -> ' + data[i] );
|
||||||
}
|
}
|
||||||
@ -21,8 +21,20 @@ plasmoid.stop = function()
|
|||||||
print("stopping");
|
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 = new LinearLayout(plasmoid);
|
||||||
layout.orientation = Vertical;
|
layout.setOrientation(Vertical);
|
||||||
label = new Label();
|
label = new Label();
|
||||||
layout.addItem(label);
|
layout.addItem(label);
|
||||||
|
|
||||||
@ -31,8 +43,14 @@ stop.text = "Stop";
|
|||||||
layout.addItem(stop);
|
layout.addItem(stop);
|
||||||
|
|
||||||
controller.associateWidget(stop, "stop");
|
controller.associateWidget(stop, "stop");
|
||||||
print(controller.operationNames());
|
|
||||||
|
|
||||||
stop["clicked()"].connect(plasmoid.stop);
|
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);
|
engine.connectSource(watchingPlayer, plasmoid, 500);
|
||||||
|
Loading…
Reference in New Issue
Block a user