This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Plasmoid development. How to in Plasma 5?

Tags: plasma, plasmoid, development, cmake plasma, plasmoid, development, cmake plasma, plasmoid, development, cmake
(comma "," separated)
User avatar
simgunz
Registered Member
Posts
56
Karma
0
OS
I'm trying to port a plasmoid to Plasma 5, but I'm facing a lot of difficulties.

#) To support the advanced feature of the plasmoid I need to write some parts in C++. How do I do it? I know there is a way to associate a "plugin" written in C++ to the plasmoid, but I can't find any piece of documentation on this.

The plasma 4 version of the plasmoid had the following features that I'm not able to port to plasma 5:

#) Multiple plasmoids and the dataengine share the same configuration using KConfigXT.

In plasma 5 each plasmoid has his on configuration. How can I use KConfigXT?

#) A configuration interface page has to be created in c++ because it gather some information from a dataengine (the list of activities)

How can this be achieved in plasma 5, where the ui file of the config pages are just loaded as they are?

#) The CMake directive

Code: Select all
install(TARGETS plasma_engine_redshift DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)


install the dataengine in
Code: Select all
/usr/lib64/plugins/plasma/dataengine/
, is it correct? (I'm wondering because it's the only dataengine in there, and all the other are installed in
Code: Select all
/usr/lib/qt/plugins/plasma/dataengine/


In general there is a lack on documentation regarding how to write the file CMakeLists.txt for installing the icon, install the dataengine, install the dataengine services.

I hope someone can help me.
Musikolo
Registered Member
Posts
27
Karma
0
OS
Hi Simgunz,

I don't consider myself an expert of plasmoid development on Plasma 5, but I've been able to do a nice one:
- https://www.kde-look.org/p/998900/

I had to deal with many of the issues you are asking about. I think that by checking my code you might find an answer for many of them. In addition to, it can share a few hot links that should be helpful for you too:
- http://doc.qt.io/qt-5/reference-overview.html
- https://api.kde.org/frameworks/plasma-f ... index.html
- https://community.kde.org/Plasma/libpla ... DataEngine

I hope it helps! ;)
User avatar
simgunz
Registered Member
Posts
56
Karma
0
OS
Hi Musikolo,
thanks for the suggestion. I've read quickly through your code and it seems that you are using the qml plugin way to write cpp code. I've arrived to the same conclusion before your post and I'm using it as well. Your plasmoid is a good template since it's using many different plasmoid features.

I report here some updates on the other issues I've posted.

1) There is actually no clear KDE documentation on this. There are two methods:
- Write a plugin (Qt way)
See here: http://doc.qt.io/qt-5/qtqml-modules-cppplugins.html

The plasmoid written by Musikolo uses this approach so can be a good example.

- Write a plasma applet native interface

See plasma-framework/templates/cpp-plasmoid/ for a template

kdeplasma-addons/applets/weather/ uses this as well.

2) This is the most tricky part. I've come up with a solution that do multiple synchronization between a plasmoid, the data engine and the other instances of the plasmoid. It's not elegant but it works, and I couldn't find alternative solutions.

The soluton can be found in the code here:
https://github.com/simgunz/redshift-plasmoid

3) Not addressed yet.

4) I've managed to install the dataengine correctly with these 2 directives:
Code: Select all
kcoreaddons_desktop_to_json(plasma_engine_redshift plasma-dataengine-redshift.desktop SERVICE_TYPES plasma-dataengine.desktop)
install(TARGETS plasma_engine_redshift DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)

now it's installed in:
Code: Select all
/usr/lib/qt/plugins/plasma/dataengine/


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]