Re: Porting C++ plasmoid+dataengine to plasma5

2016-07-10 Thread Marco Martin
On Sunday 10 July 2016, Simone Gaiarin wrote:
> 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).

the idea is that you don't, really. What is your use case exactly? Different 
plasmoids are designed to be completely independent.
If you really need something different, you can still write a c++ plugin for 
the plasmoid (an Applet* subclass just as in plasma 4, accessible via qml with 
nativeinterface) in which you still have access to applet.globalconfig or you 
can do whatever more complex/different you need.



-- 
Marco Martin
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Porting C++ plasmoid+dataengine to plasma5

2016-07-10 Thread Simone Gaiarin
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 provided by the dataengine
- 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 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 (somehow works) but I don't know how  to
sync this with the plasmoid configuration.
In particular how can I know when the user finished editing the settings in
the UI so that I can notify the dataengine? It seems there are no signal to
notify this.


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

3) How can I catch a signal emitted by the 'plasmoid' object in QML?
Let's say I want to catch the signal '*userConfiguringChanged' how can I do
it?*

Regards
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel