Skip to content

Don't use profile generation for global config file

Instead, use a parameterized PowerDevil::GlobalSettings that will determine the correct default for your system on every startup, as opposed to just the first time when profile generation is run.

There was only a single global setting requiring parameterization, namely BatteryCriticalAction. But the impact is considerable:

  • generateProfiles() now doesn't need canSuspendToDisk, which reduces the surface area of profile generation autotests.
  • We need a new GlobalDefaults::defaultBatteryCriticalAction(), so powerdevilprofiledefaults.{h,cpp} gets renamed to powerdevilsettingsdefaults.h for both global and profile defaults.
  • PowerDevil::Core switches from the previous settings singleton to an owned GlobalSettings object, initialized in onBackendReady().

The unused "doNotInhibitOnLidClose" config entry is dropped from PowerDevilGlobalSettings.kcfg.

This commit requires a clean (re)build because the global config KCM had already generated an earlier version of GlobalSettings elsewhere. The API change makes sure that an unclean build will fail loudly.


Follow-up to !233 (closed) !244 (merged), in my ongoing KConfigXT series of MRs from issue #23 (closed). Note that this initially targeted my work branch from !233 (closed), but has now been retargeted to master with !244 (merged) merged instead.

This MR will conflict with patches from @nicolasfella (!224 (merged), in powerdevilcore.cpp) and @nclarius (!230 (merged), isVM parameter for generateProfiles()). That's okay, whichever one goes in first won't cause too much rebasing trouble for the remaining ones. [edit: rebased, done.]

Edited by Jakob Petsovits

Merge request reports