Porting C++ plasmoid and dataengine to plasma5
Simone Gaiarin
simgunz at gmail.com
Thu Jul 14 08:10:16 UTC 2016
Thanks Marco for pointing me in the right direction.
My use case is more or less what I've explained before:
- I need to control the process for the program redshift.
- The process is controlled by a dataengine which need to be able to access
the configuration
- I want more than an instance of the plasmoid to be able to control it, so
they need to share the configuration among themselves and with the
dataengine.
In plasma 4 I was using KConfigXT with the integration in KConfigDialog as
explained here:
https://techbase.kde.org/Development/Tutorials/Using_KConfig_XT#Use_and_Dialogs
so that the configuration dialogs where all automatically in sync and the
settings were available to the data engine.
Still I don't understand one thing:
- when I open the configuration ui how do I load the data in the ui fields
from applet.globalconfig? Is there a signal that tells me that the
configuration is about to be shown?
On documentation:
Can you point me out some references on the use of nativeinterface, the
attached plasmoid object, how you manage the configuration?
Possibly I can help in writing some documentation on this. All this plasma
mechanism are very fancy, but from my personal experience it's very
frustrating developing plasmoid that do something more than displaying
"Hello world", due to the lack of documentation for plasma 5. Information
is sparse in blog posts or outdated, most of my development has relied on
reverse engineer other plasmoids.
Thanks for the help.
On Wed, Jul 13, 2016 at 2:07 PM Simone Gaiarin <simgunz at gmail.com> wrote:
> Hi all,
> time ago I've designed a Plasma 4 plasmoid together with a dataengine to
> configure and control a process (redshift).
>
> The structure is the following:
> - The plasmoid allow the user to start and stop the process, this is done
> by running a servicejob to commmunicate the dataengine to take an action
> - The dataengine controls the process (start and stop it) [I need a custom
> dataengine and I cannot use the executable dataengine]
> - Multiple instances of the plasmoid and the dataengine share the
> configuaration via KConfigXT (Singleton) in this way when the user access
> the plasmoid configuration this is propagated to the dataengine and synced
> with other instances of the plasmoid
>
> Now I want to port this to plasma 5 but I'm facing huge difficulties. I've
> managed to port the dataengine, rewrite the CMakeFiles and I've partially
> rewritten the apple in QML.
>
> The problem now is how to manage the configuration.
>
> I know that the plasmoid configuration can be accessed via
> plasmoid.configuration and that I can map the fields in main.xml to the ui
> elements of the config dialog. The problem is how to synchronize this
> configuration with the other instances of the plasmoid (each plasmoid has
> his own configuration in plasma 5).
> How to pass this configuration to the dataengine?
> Any idea to do this in a simple way?
>
> I've tried to extend my plasmoid with a C++ plugin so that in C++ I can
> still use the old KConfigXT system in order to share a config file between
> the plasmoid and the dataengine.
>
> My current solution is pretty ugly but it works. It's the following:
> - When the configuration of the plasmoid is edited (I check this throught
> the signal userConfiguringChanged) I get the values from
> plasmoid.configuration and send it to the plasmoid C++ plugin (with a
> custom method writeConfig)
> - The plasmoid C++ plugin use KonfigXT to save the configuration and emits
> a signal myConfigChanged
> - The plasmoid run the service job so that the dataengine can act
> - From all the instances of the plasmoid I monitor the dataengine
> onNewData signal and when it is catched I read the configuration from the
> C++ plugin (with a custom method readConfig) and the plugin read it from
> disk
>
> In the configuration of all the instances of the plasmoid and the
> dataengine one are synchronized all the time. It's overly complicated
> though compared to the plasma 4 solution.
>
> Various doubt:
> 1) The plasmoid configuration system is explained here:
> http://aseigo.blogspot.dk/2013/02/elegant-plasmoid-configuration.html. Is
> it there any other page of documentation for this?
>
> 2) Which is the proper way to extend the QML plasmoid in C++. I've seen
> two approaches.
> - plasmoid.nativeInterface as suggested
> in plasma-framework/templates/cpp-plasmoid/ (<- This should be documented
> in techbase, it's quite hidden)
> - The other as explained here
> http://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html and how
> I've seen implemented in many plasmoids
>
> Regards
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160714/3746ed83/attachment.html>
More information about the Plasma-devel
mailing list