Skip to content
Commit 127f6aef authored by Jakob Petsovits's avatar Jakob Petsovits
Browse files

Drop "Advanced Power Settings" KCM in favor of a new QML page

This commit removes the QWidgets-based KCM in kcmodule/global,
and instead adds a new QML page accessible via header action
in the existing "Energy Saving" (QML) KCM a.k.a. profiles config.
Renaming folder and class names of the profiles KCM to reflect
its combined scope is left for a later commit.

I modified the "Energy Saving" KCM's JSON file to declare it
on the top level of System Settings, and merged extra keywords
from the now deleted kcm_powerdevilglobalconfig.json.
We'll have to remove the "power-management" category from
System Settings after this, as only a single KCM is left.

New C++ KCM backend code is mostly moved from GeneralPage.{h,cpp}:

* PowerDevil::GlobalSettings provides kcm.settings.global for QML.
* KAuth-powered ChargeThresholdHelper settings are accessible via
  kcm.externalServiceSettings & left out of non-default highlighting.
* "Supports $X" properties are added to the KCM class directly.

All in all, it's a fairly straight port that doesn't change the
underlying data representation apart from the obvious C++/QML split.
Only the magic value -1 gets replaced by a constant named
ChargeThresholdUnsupported, plus functions for checking support.

The UI is also roughly the same. That said, there are some differences:

* I replaced the "Configure Notifications" button with a column of
  two ToolButtons in the style of Quick Settings' "Most used pages".

* The start-charging threshold, i.e. the lower bound, previously
  had a weirdly long spinbox field because it needed to fit the
  "special value" text "Always charge when plugged in".
  This looks awkward and is not easily discoverable. Furthermore,
  QQC2.SpinBox doesn't have a concept of a "special value" and
  doesn't pre-allocate item width for any given space. I decided to
  represent this state with numeric percentages only.
    * "Special value" means display text for the minimum value
      ("from") of a QSpinBox. The start-charging threshold QSpinBox
      had no minimum set in generalPage.ui, so its "special value"
      would have been 0. This makes little sense, "Always charge"
      for the start threshold is conceptually more similar to
      "start threshold equals stop threshold".
    * Hence, the start threshold SpinBox now starts at 1, not 0,
      and the maximum allowed value is that of the stop threshold
      from the other field above. If the maximum value is selected,
      we write the "special value" 0 to the backend. If the backend
      value changes to 0, we set the UI to the stop threshold value.

BUG: 449254
CCBUG: 450276
CCBUG: 459081
CCBUG: 467797
parent 66dc6092
Pipeline #556410 passed with stage
in 1 minute and 42 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment