Activities API

Ivan Čukić ivan.cukic at kde.org
Thu Sep 12 16:53:23 UTC 2013


Heh, Aaron woke up :)

So, this is what is going to be done (90% finished already):

** API mostly stays the same. **

Info, Consumer:
===================

In the back:
 - all instances of both classes share a backend that syncs the data with the 
server
In the front:
 - expose the synced data through the already existing API (properties)
 - introduce a property which states whether the data is ready.

* What does it mean for QML:

 - connect something to a property and relax - it will be loaded as soon as 
possible

* What does it mean for C++:

 - create in instance of Consumer or Info and:
  1) Cover the case when the results are not valid (if the service is not 
running, or the data has not been synced) - the same as before, though 
everybody mostly ignored this part. :) - In this case, the client gets a 
single activity with no name and a null uuid.
  2) Hook into the signal which will tell you when the data is ready (or just 
into the signal of the property you want)

 - advice: at least one instance of Consumer/Info should be long-lived for 
best performance. For heavy activities users like plasma and kwin, it would be 
the best if one Consumer instance was a always-living.

The static Info::name(QString id) method will, from now on return 
QFuture<QString> and it should not really be used unless you *really* don't 
want to make a long-lived instance of Info or Consumer. (though, I'm wondering 
whether I should remove it altogether)

Controller:
===================
Since it is a more advanced class, for advanced clients, it will mostly return 
QFuture<something-might-be-even-void-for-some-methods> for the methods for 
which the users want to know when it has actually finished (start, stop, 
create and similar).

I've managed to do it in a very light-weight manner - no threads or other evil 
things - just simple signals :)

Models:
===================
Models library will also be an option (exists in 4.x branch already) - but, 
since it has more features, some depend on Nepomuk - it will have to be done 
later.

Also, usable from QML, or item-views. Directly from C++, if you are a 
masochist :)

Cheerio,
Ivan

-- 
Money can't buy happiness, but neither can poverty.
  -- Leo Rosten



More information about the Plasma-devel mailing list