use a separate configuration per look and feel
ClosedPublic

Authored by mart on Aug 3 2016, 9:42 AM.

Details

Reviewers
davidedmundson
ivan
Group Reviewers
Plasma
Commits
R871:1e198e2c9d03: prettier javascript code
R871:d2f0ec63c60b: methods to switch lnf
R871:e0370b80c35f: prototype of JS config dump
R120:71eb75da019d: more explanatory comments
R871:0b91161b35da: createActivity(existingName) returns the existing one
R871:41f54319fc4a: Merge branch 'master' into mart/separateLookAndFeelLayout
R871:63bb74a7109c: remove the optional applet id parameter
R871:746884952c76: be silent
R120:d2f0ec63c60b: methods to switch lnf
R871:a697d291f98e: make sure desktop containments exist before script
R871:03d3bddf9f44: internal config migration
R871:669084d7a8fc: generate some comments in js
R871:3bdbdbcbc4ad: Merge branch 'master' into mart/separateLookAndFeelLayout
R871:f86d736def98: add a reloadDefaultLayout method to reset layout
R871:c22f0ce63e64: remove dead code
R871:f58f7f6faf85: support creating applets by id in script engine
R120:41f54319fc4a: Merge branch 'master' into mart/separateLookAndFeelLayout
R871:70c59c003f11: export the layout dump to js
R871:dbead6f45971: delete all graphics objects as well on switching
R871:3476cf0c53c8: Merge branch 'master' into mart/separateLookAndFeelLayout
R871:b03a21d6d6c7: crash--
R871:672c16ad0f8f: prototype for support of per-looknfeel layout
R120:2ddde5efc1e3: remove graphicsobject hack
R871:2ddde5efc1e3: remove graphicsobject hack
R871:57c758ad05dd: comments++
R871:312e61e42c3c: use a single config file again
R871:71eb75da019d: more explanatory comments
R871:2d57dfd63e74: use QRectF
R871:f36d882fea18: possible pass geometry to containment.addWidget()
R871:d628408a59f5: Merge branch 'master' into mart/separateLookAndFeelLayout
R871:83b0e5dfe153: more complete config js dumper
R871:97a6ac9b3ea6: use AppletOrder from the panel config
R871:914b9305e3a6: always use renamed file
R871:368254c79c72: delete views and arrays in the proper order
R871:998c1c940a9b: Merge branch 'master' into mart/separateLookAndFeelLayout
R120:312e61e42c3c: use a single config file again
R871:a42e154c6d9e: monitor for file creation
R120:c22f0ce63e64: remove dead code
R871:51e2072d7ba9: generic kconfiggroup dumper
R871:faba34ffd6bf: rework script generation
R871:8d2526f96f47: complete the dump of the panel
Summary

plasmashell has a different configuration for every lnf theme.
upon switching theme, tear down the whole shell and reload it
with the new configuration, either with the default config of
the lnf package or with the config previously stored.
the config file of the breeze theme still has the old for for
retrocompativility.
extra dependency: https://git.reviewboard.kde.org/r/128597/

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
There are a very large number of changes, so older changes are hidden. Show Older Changes
mart updated this object.Aug 3 2016, 9:42 AM
mart edited the test plan for this revision. (Show Details)
Restricted Application added a project: Plasma. · View Herald TranscriptAug 3 2016, 9:42 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart updated this revision to Diff 5652.Aug 3 2016, 10:04 AM
  • more explanatory comments
ivan added a subscriber: ivan.Aug 3 2016, 10:13 AM

All in all, seems ok.

I think we need to start commenting code like this - what it is doing. I do realize it is popular for the code to be self-documenting, but that has not been working for us that well :)

Can you write short instructions on how to test this?

shell/scripting/containment.cpp
187

It would be nice if we started putting comments with reasoning what this should do and similar in front of the blocks like these - it will be problematic to understand this code to future contributors

shell/shellcorona.cpp
136 ↗(On Diff #5651)

Why is this captured?

325–326 ↗(On Diff #5651)
QList<KConfigGroup> groups{rootGroup};
373 ↗(On Diff #5651)

I have a bad feeling about this. When will the generated JS code be used?

davidedmundson requested changes to this revision.Aug 3 2016, 3:07 PM
davidedmundson added a reviewer: davidedmundson.
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
shell/shellcorona.cpp
469 ↗(On Diff #5652)

why are we tracking file modifications?
That's not how the rest of the KCMs work.

511 ↗(On Diff #5652)

yes, otherwise everyone currently using breeze-dark loses their config on upgrade.

720 ↗(On Diff #5652)

That's clearly not how Plasma should be designed.

This revision now requires changes to proceed.Aug 3 2016, 3:07 PM
mart added inline comments.Aug 3 2016, 4:43 PM
shell/shellcorona.cpp
469 ↗(On Diff #5652)

how would you notice knf has been changed? only info about it is that key in kdeglobals

511 ↗(On Diff #5652)

can we have kconf_update that are guarantee to run before plasmashell is started?

was also thinking about just using the same file and have the config to be lost on switch (that's actually what the vdg proposed initially) tough seems really too dangerous to me

720 ↗(On Diff #5652)

i'm thinking about adding a
QObject *Applet::graphicsRepresentation() as the access to it seems to have became necessary in many places

This revision was automatically updated to reflect the committed changes.
mart reopened this revision.Aug 3 2016, 5:55 PM
This revision now requires changes to proceed.Aug 3 2016, 5:55 PM
davidedmundson added inline comments.Aug 4 2016, 12:44 AM
shell/shellcorona.cpp
469 ↗(On Diff #5652)

DBus signal from the KCM.

It's how we do fonts, styles, colours etc.

511 ↗(On Diff #5652)

can we have kconf_update that are guarantee to run before plasmashell is started?

Good question.

kconf_update also monitors for new scripts at runtime, which is another bug waiting to happen.

We might need to have some sort of:

if (exists(plasma-shell-appletsrc) {

move(plasma-shell-appletsrc   , plasma-shell-lnf-appletsrc)

}

720 ↗(On Diff #5652)

Might be nice, but that doesn't solve the thing that's the problem.

You can't just randomly delete things owned by some other object. Knowing which objects owns what is a core part of good design.

From what I can see:

  • Applet owns the DeclarativeAppletScript (member var script)
  • DeclarativeAppletScript owns the AppletInterface (AppletScript set as parent)

delete the applet (which is literally the next line) and you delete this anyway.

If this solves a problem, you're solving it in the wrong place.

mart updated this revision to Diff 5669.Aug 4 2016, 10:23 AM
mart edited edge metadata.
  • prototype for support of per-looknfeel layout
  • monitor for file creation
  • delete views and arrays in the proper order
  • be silent
  • prototype of JS config dump
  • more complete config js dumper
  • generic kconfiggroup dumper
  • complete the dump of the panel
  • export the layout dump to js
  • createActivity(existingName) returns the existing one
  • support creating applets by id in script engine
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • prettier javascript code
  • crash--
  • delete all graphics objects as well on switching
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • make sure desktop containments exist before script
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • more explanatory comments
  • possible pass geometry to containment.addWidget()
  • generate some comments in js
  • use QRectF
mart added inline comments.Aug 4 2016, 10:27 AM
shell/shellcorona.cpp
511 ↗(On Diff #5652)

this in the conf update?

720 ↗(On Diff #5652)

iirc i did that because if it was done automatically, some appletremoved signals were triggered causing loss of some configuration.
I'll see if i can find the root cause for that

mart added inline comments.Aug 4 2016, 12:45 PM
shell/shellcorona.cpp
469 ↗(On Diff #5652)

plasmshell should have a slot for that invoked by the kcm?

mart added inline comments.Aug 4 2016, 1:27 PM
shell/shellcorona.cpp
511 ↗(On Diff #5652)

what abouti do the config file move there in the c++ itself?
wouldn't be many lines and i am 100% sure it's executed at the right moment

mart updated this revision to Diff 5700.Aug 5 2016, 5:26 PM
  • use AppletOrder from the panel config
  • always use renamed file
  • internal config migration
mart updated this revision to Diff 5701.Aug 5 2016, 5:35 PM
  • remove the optional applet id parameter
mart updated this revision to Diff 5742.Aug 8 2016, 2:07 PM
  • remove graphicsobject hack
This revision was automatically updated to reflect the committed changes.
mart reopened this revision.Aug 8 2016, 2:08 PM
mart added inline comments.Aug 8 2016, 3:06 PM
shell/shellcorona.cpp
469 ↗(On Diff #5652)

i could send the notifychange signal of kglobalsettings, but it's kinda ugly, as it uses an integer as parameter to specify what changed, which is defined in kdelibs4support I can add a new enum value, but it's still a dependency on kdelibs4support.
This thing looks like it either needs a real replacement or other stuff (even file monitoring) should be used istead

davidedmundson added inline comments.Aug 8 2016, 9:44 PM
shell/shellcorona.cpp
394 ↗(On Diff #5743)

I'm confused.

Should you be getting the current from the current Plasma::Applet* instances or are you loading state from the config file?

mart added inline comments.Aug 8 2016, 9:59 PM
shell/shellcorona.cpp
394 ↗(On Diff #5743)

I'm doing what i can there.
every way to get items geometries is actually an hack, i think reading the config file is a bit more reliable, even if assumes how the config file is.
otherwise it could get to the applet graphics object then map its geometry with containment graphics object geometry (however implementation detail, it would introduce an error as the geometry of the margins of the framesvg applet background wouldn't be included then)

i can go for either of the approaches, none of them is perfect, but don't have strong preference there (while I do for the panel, as i think is the only way to ensure proper applets order)

davidedmundson requested changes to this revision.Aug 8 2016, 11:29 PM
davidedmundson edited edge metadata.
davidedmundson added inline comments.
shell/shellcorona.cpp
321 ↗(On Diff #5743)

If we go with this patch

you should filter out ItemGeometries and AppletOrder here as you're making a special case out of them.
Otherwise you're saving garbage data in the config which could conflict; one of the new IDs could clash.

Also what's going to happen to activityId

383 ↗(On Diff #5743)

No!!!!

you need to loop through containments() rather than the views
(same for panel section)

Otherwise:

  • you're only saving the currently plugged in screens.
  • this won't save the configuration for any applets in a system tray.

and when you do do the system tray you're going to have a huge problem:
system tray writes out SystrayContainmentId... you aren't going to know what that is.

394 ↗(On Diff #5743)

If every way is a hack, then maybe this feature shouldn't go in at all.

So the root issue is:

  • for saving/restory applet geometry is handled by the containment which is in completely arbitrary as it's done by that containment plugin.
  • they use the ID of the applet for an index
  • ID won't be the same

Brainstorming, there is an option.
*if* we assume dump and resume is always going to be from a clean setup we could just expose setting initial id to applet scripting. It's already in Plasma::Containment. it would fix all the problems without any hacks.


I can imagine this patch will destroy PMC if someone switched LNF twice as you're hardcoding stuff in plasma-workspace based on behaviour of plasma-desktop.

467 ↗(On Diff #5743)

what about globalConfig()?

This revision now requires changes to proceed.Aug 8 2016, 11:29 PM
mart added inline comments.Aug 9 2016, 8:12 AM
shell/shellcorona.cpp
321 ↗(On Diff #5743)

yep, same thing for location and form factor i think

394 ↗(On Diff #5743)

yes, it's always from a clean setup..
if you look back in the revision history, creating the applet with a specified id was exactly what it was doing in the early revisions.
As this would have needed some ugly changes to the desktop containment, after a discussion with Eike we decided to go this route instead, as it doesn't expose directly the config file format in the scripting.

394 ↗(On Diff #5743)

to me this feature is very desktop specific (so much that i even thought at some point loading it in a plugin only for the desktop shell...
I would consider to just ignore l&f changes on shells different from the desktop one, and even to not to dump config for containments different than the 3 default ones

mart added inline comments.Aug 9 2016, 8:24 AM
shell/shellcorona.cpp
383 ↗(On Diff #5743)

can't for panels, as their geometry is saved in the view as it should be, because they have a separate geometry setting per screen.

mart updated this revision to Diff 5760.Aug 9 2016, 9:43 AM
mart edited edge metadata.
  • prototype for support of per-looknfeel layout
  • monitor for file creation
  • delete views and arrays in the proper order
  • be silent
  • prototype of JS config dump
  • more complete config js dumper
  • generic kconfiggroup dumper
  • complete the dump of the panel
  • export the layout dump to js
  • createActivity(existingName) returns the existing one
  • support creating applets by id in script engine
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • prettier javascript code
  • crash--
  • delete all graphics objects as well on switching
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • make sure desktop containments exist before script
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • more explanatory comments
  • possible pass geometry to containment.addWidget()
  • generate some comments in js
  • use QRectF
  • use AppletOrder from the panel config
  • always use renamed file
  • internal config migration
  • remove the optional applet id parameter
  • remove graphicsobject hack
  • rework script generation
mart updated this revision to Diff 5812.Aug 10 2016, 5:24 PM
mart edited edge metadata.
  • add a reloadDefaultLayout method to reset layout
mart added inline comments.Aug 10 2016, 5:26 PM
shell/shellcorona.cpp
550 ↗(On Diff #5812)

I hate this method.
tough, i need a way from the kcm to reset the current layout to the default.
it's quite dangerous and exporting a dbus method that effectively destroys the current config is evil...
other ideas?

graesslin added inline comments.
shell/shellcorona.cpp
550 ↗(On Diff #5812)

You could do it like in KWin: make the KCM trigger a DBus signal which Plasmashell triggers to.

In the end it's going to be the same: one can destroy the current config through dbus, but it's not that exposed. Also I don't think it matters: if a user decides to shoot himself in the foot by manually triggering the DBus signal, let him.

ivan added inline comments.Aug 11 2016, 9:34 AM
shell/shellcorona.cpp
550 ↗(On Diff #5812)

I agree with Martin. If the user is crazy enough...

D-Bus was never really meant to be something that the users should be calling directly anyhow.

mart added inline comments.Aug 11 2016, 7:17 PM
shell/shellcorona.cpp
550 ↗(On Diff #5812)

yeah, agree....
so,, I'm thinking about exposing 2 functions
loadLookAndFeel(qstring name)
reloadLookAndFeel(QString name)

the first is not destructive the second is (just to not have a bool parameter)
the destructive version, even if it's loadedwith the current look and feel reloads anyways, because destroys the current setup.

mart updated this revision to Diff 5927.Aug 15 2016, 12:17 PM
  • methods to switch lnf
This revision was automatically updated to reflect the committed changes.
mart reopened this revision.Aug 16 2016, 1:53 PM
mart updated this revision to Diff 5980.Aug 16 2016, 1:54 PM
  • prototype for support of per-looknfeel layout
  • monitor for file creation
  • delete views and arrays in the proper order
  • be silent
  • prototype of JS config dump
  • more complete config js dumper
  • generic kconfiggroup dumper
  • complete the dump of the panel
  • export the layout dump to js
  • createActivity(existingName) returns the existing one
  • support creating applets by id in script engine
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • prettier javascript code
  • crash--
  • delete all graphics objects as well on switching
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • make sure desktop containments exist before script
  • Merge branch 'master' into mart/separateLookAndFeelLayout
  • more explanatory comments
  • possible pass geometry to containment.addWidget()
  • generate some comments in js
  • use QRectF
  • use AppletOrder from the panel config
  • always use renamed file
  • internal config migration
  • remove the optional applet id parameter
  • remove graphicsobject hack
  • rework script generation
  • add a reloadDefaultLayout method to reset layout
  • methods to switch lnf
  • comments++
  • Merge branch 'master' into mart/separateLookAndFeelLayout
mart updated this revision to Diff 6029.Aug 18 2016, 1:01 PM
  • Merge branch 'master' into mart/separateLookAndFeelLayout
mart updated this revision to Diff 6030.Aug 18 2016, 1:10 PM

use new config serialization

mart updated this revision to Diff 6031.Aug 18 2016, 1:28 PM

merge new serialization code from Ivan

mart updated this revision to Diff 6039.Aug 18 2016, 4:53 PM
  • use a single config file again
ivan added inline comments.Aug 18 2016, 6:29 PM
shell/scripting/containment.cpp
197

This seems not to be used

mart updated this revision to Diff 6043.Aug 18 2016, 7:14 PM
  • remove dead code
ivan accepted this revision.EditedAug 18 2016, 7:17 PM
ivan added a reviewer: ivan.

I'm remarking as accepted from my side

This revision was automatically updated to reflect the committed changes.