Plasma/libplasma2

From KDE Community Wiki

Summary

This page is dedicated to planning of the libplasma2.

libplasma2 will be binary and source incompatible with the current libplasma. This means that we can fix some issues that are currently present in plasma's design.

Enter the issues you wish fixed in the following form:

Idea: Change libplasma2
Summary: We have a chance to change stuff now
Proposed solution: We change things
Discussion: http://mail.kde.org/pipermail/plasma-devel/2010-October

Design Issues

Idea: Fewer friend classes
Summary: There are a lot of friend classes and fondling of privates going on in libplasma. Usually this is done to make the public API smoother, and is a net win for the user of the library.
Proposed solution:
Discussion: The challenge will be in DataEngine subclasses which may have class members that are not copyable, let alone the bloat of the copying or the challenge of keeping that data in each copy in sync with the shared data in DataEnginePrivate. So to do this properly, we may need to break out DataEngine which consumers use from DataEngine that gets subclassed.


Idea: Make DataEngine implicitly shared
Summary: We pass DataEngines around as pointers, which makes them vulnerable to all the usual pointer-related issues: crashes, accidental deletions, etc.
Proposed solution: Look at all friend relationships and see how many can be removed now due to evolution of libplasma itself or clever new approaches to the old problem. Public API clarity and cleanliness must not be sacrificed, however. Internal ugliness is better than external ugliness.
Discussion:


Idea: Make DataEngineConsumer public API
Summary: Right now it is a bit too easy to make mistakes with using DataEngines outside of the normal consumers (Applet, Wallpaper, etc.). This is because DataEngineManager exposes the reference counting details as public API.
Proposed solution: Instead of exposing the management details around DataEngine by making DataEngineManager public, make DataEngineConsumer a public class instead. DataEngineManager would become private API and DataEngineConsumer would use it behind the scenes.
Discussion:


Idea: Refactor Package* Classes
Summary: PackageMetaData is a relatively thin and inefficient wrapper around KDesktopFile. It's used rarely and doesn't serve a clear purpose. PackageStructure is a relatively static class that combines both a method for getting new packages as well as a description of the underlying package.
Proposed solution: Look at the use cases for Package and PackageStructure, and consider a refactor to clean up the API and make it easier to use.
Discussion:


Idea: PackageStructure::installPackage should be async
Summary: Package::installPackage is current synchronous, which prevents running it in another thread, doing user interaction (e.g. to confirm other dependencies to download) or taking additional actions such as downloads.
Proposed solution: Make Package::installPackage async and return a KJob* that represents the install process.
Discussion:


Idea: Out of process DataEngines
Summary: Even if they try to be s async as possible, right now dataengines could become too heavy and slow down the main GUI event loop.
Proposed solution: Dataengines could run in a different process (and pass the actual data trough sockets) making the UI actually faster. However especially on devices a process more would bring more context switches and overall memory consumption (MeeGo certification policy even forbids applications to run any kind of daemon) So should be probably decided at compile time.


Idea: Improving remote widgets
Summary: Remote widgets work if the widget uses DataEngines and Services exclusively, polls the remote DataEngine excessively and only speaks one network backend.
Proposed solution:
  • Provide a remote-transparent data store and/or command/event proxy.
  • Get rid of polling with push API
  • Properly abstract network layer
  • Possibility to sync over network the applet configuration too
  • Possibility for a local widget to connect to a remote dataengine


Idea: More model-like dataengines
Summary: Many dataengines return data as series of items: like rss, microblog and tasks, and they do in different ways, rss has a list of Data in a single key, microblog has an item per key, tasks has an item per source.
Proposed solution:
  • Provide an unified way to do item lists easily mappable to models for QML views
  • A DataList type?
  • directly passing a model?

API Issues

Idea: [mM]imetype -> [mM]imeType
Summary: Everywhere else in KDE/Qt API it is "MimeType"
Proposed solution: Conform to the capitalization of "Type" in Plasma APIs.


Idea: Wallpaper drop handling
Summary: We now have two ways to note that a URL has been added to a wallpaper via external means: urlDropped(KUrl) and setUrls(KUrl::List).
Proposed solution: Drop urlDropped in favor of setUrls; make setUrls virtual, drop the protected addUrls slot (was just a work-around for BC) and port Wallpaper plugins away from addUrls. In WallpaperScript, make setUrls virtual and drop urlDropped.


Idea: Applet::appletDestroyed signal poorly named
Summary: appletDestroyed is emitted in ~Applet, but this can happen even if it isn't "destroyed" but just deleted. Despite its name, appletDestroyed has nothing to do with Applet::destroy() and Applet::destroyed()
Proposed solution: Rename to appletDeleted.


Idea: Svg::setImagePath is not virtual
Summary: FrameSvg (and potentially other subclasses of Svg) need to take action when the image path is changed. setImagePath is not virtual nor does it call any internal virtuals. This has resulted in a necessary but unfortunate hack in Svg::setImagePath specifically for FrameSvg.
Proposed solution: Make Svg::setImagePath virtual.


Idea: Merge Theme::findInCache methods
Summary: There are multiple findInCache methods in Theme, which could be merged into one method with suitable default parameters.
Proposed solution: Merge methods.


Idea: Merge ExtenderItem::setGroup methods
Summary: There are multiple setGroup methods in ExtenderItem, which could be merged into one method with suitable default parameters.
Proposed solution: Merge methods.


Idea: Dialog::graphicsWidget() is not const
Summary: As a simple getter, graphicsWidget() should be const.
Proposed solution: Make Dialog::graphicsWidget() const.


Idea: Wallpaper has a protected data member
Summary: QList<QAction*> contextActions is not in the dptr.
Proposed solution: Move QList<QAction*> contextActions; to WallpaperPrivate


Idea: Use virtuals instead of slots in AbstractToolBox
Summary: There are three slots in AbstractToolBox that really ought to be virtuals: restore, save and reposition. They are currently QMetaObject::invoke()'d instead.
Proposed solution: Make them virtual.


Idea: isBusy Q_PROPERTY duplicate in Applet
Summary: There are two "busy" Q_PROPERTY entries defined in Applet: isBusy and busy. The latter is the correct frm.
Proposed solution: Remove the isBusy Q_PROPERTY, leaving just busy.


Idea: Applet::geometryChanged() superfluous now
Summary: QGraphicsWidget has a geometryChanged() signal now, it is only kept in Applet to preserve binary compatibility.
Proposed solution: Remove Applet::geometryChanged().


Idea: Applet::messageButtonPressed() should pass the fully qualified type
Summary: Applet has a signal void messageButtonPressed(const MessageButton button). Since moc does a string comparison in connect, trying to connect it to a slot that takes "Plasma::MessageButton" will not work because "MessageButton" != "Plasma::MessageButton"
Proposed solution: Change it to messageButtonPressed(const Plasma::MessageButton button);


Idea: QMimeData * AbstractRunner::mimeDataForMatch(...)
Summary: mimeDataForMatch is a slot due to BC.
Proposed solution: Change it to a virtual method


Idea: Add a function to Plasma::Wallpaper as virtual setWallpaperPath(const KUrl &url)
Summary: Right now it should be slot due to BC.
Proposed solution: Implement it as virtual in Plasma::Wallpaper so that we can set a path in the Wallpaper Plugin.
Idea: Package::installPackage and Package::uninstallPackage should be private
Summary: Both methods are static members of the public API, though all install/uninstall calls should be done through PackageStructure
Proposed solution: Move them into a private class for internally use only, perhaps private/packages.*

Changes in Qt

With the introduction on the QML language in Qt 4.7 there is a new "official" way to create user interfaces in scene/view based environments. A replacement for QGraphicsView is in development under the name of Scene-graph. It will have an opengl accelerated scene accessible only trough QML (because deciding what to paint and when is actually a bottleneck). If the timing of releases will collimate, libplasma2 should migrate from QGraphicsView to Scene-graph, this presents a number of challenge/opportunities:

A prototype of a Corona, Containment, Applet hierarchy in scene-graph can be found here: http://quickgit.kde.org/?p=scratch%2Fmart%2Fplasma2-proto.git&a=summary

Idea: Migrate widgets to QtComponents, drop current libplasma widgets
Summary: QML allows faster UI creation compared to old widgets, Scene-graph doesn't support QGraphicsWidget
Proposed solution: Gradual change: along with the development of QtCompoents, a Plasma-themed component set should be done, will hopefully go into use before libplasma2, so plasmoids can migrate to them before libplasma2, easing the port. The whole QGraphicsWidget (and QGraphicsProxyWidget) based set currently in libplasma should be dropped (since won't work in Scene-graph) so the replacement has to be as complete as possible.

It should also significantly decrease the size of the library.


Idea: Corona from a cene becomes a (singleton) scene bookeeper
Summary: In Scene-graph there is an 1:1 association scene:view
Proposed solution: Corona becomes a manager of scene and views: every time there is something to show the needed items are either created or moved from a former scene and inserted in a new one, with a new view. Changing containments will mean changing scene as well.


Idea: Applet no more a GraphicsItem
Summary: Right now Applet is a QGraphicsWidget that can optionally include a QML root element (with its declarative engine), mixing QGraphicsWidgets and QDeclarativeItems, nd maybe creatng unneded items.
Proposed solution: Applet could become a simple QObject accessible from the root object in QML's javascript, will still have most of its api and would still send to the qml object things such as formfactor and location constaint events.
Idea: libplasma not depending on graphics backends
Summary: The above issue suggests that libplasma could not depend anymore neither from QGraphicsView or SceneGraph.
Proposed solution: All the rendering specific code will go into QML imports. Libplasma could still retain QPainter specific classes, such as Svg and FrameSvg, paintutils and so on