A QML port of kcmodule/global a.k.a. kcm_powerdevilglobalconfig a.k.a. "Advanced Power Settings", which gets dropped and replaced by a child page within the "Energy Saving" KCM (accessible via header action).
Update: There's been a few changes since I originally submitted this MR, so the original screenshot isn't fully representative anymore. It's mostly the same but with some tweaks following reviewer comments. Prominently the "Configure Notifications" button went back down into a regular form field as "Related Pages" ToolButton. Also it obviously looks a little different when properly themed with Breeze. I'll keep the original screenshots for now because I don't have new ones for one or two related reasons.
BUG: 449254CCBUG: 450276CCBUG: 459081
Original KCM (QWidgets):
After applying this commit (Qt Quick) - not fully up to date after making the old KCM a child page of "Energy Savings":
While screenshots are always nice to look at, I encourage any reviewer to actually apply the patch and play with the interactions to get a full sense especially of how the charge limit stuff is working now.
Updated commit message below:
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 actionin the existing "Energy Saving" (QML) KCM a.k.a. profiles config.Renaming folder and class names of the profiles KCM to reflectits combined scope is left for a later commit.
I modified the "Energy Saving" KCM's JSON file to declare iton the top level of System Settings, and merged extra keywordsfrom the now deleted kcm_powerdevilglobalconfig.json.We'll have to remove the "power-management"
category fromSystem Settings after this, as only a single KCM is left.
New C++ KCM backend code is mostly moved from GeneralPage.{h,cpp}:
PowerDevil::GlobalSettings
provideskcm.settings.global
for QML.- KAuth-powered
ChargeThresholdHelper
settings are accessible viakcm.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 theunderlying data representation apart from the obvious C++/QML split.Only the magic value -1 gets replaced by a constant namedChargeThresholdUnsupported
, 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 oftwo ToolButtons in the style of Quick Settings' "Most used pages".
The start-charging threshold, i.e. the lower bound, previouslyhad 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" anddoesn't pre-allocate item width for any given space. I decided torepresent this state with numeric percentages only.- "Special value" means display text for the minimum value(
"from"
) of aQSpinBox
. The start-charging threshold QSpinBoxhad 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 thresholdfrom the other field above. If the maximum value is selected,we write the "special value" 0 to the backend. If the backendvalue changes to 0, we set the UI to the stop threshold value.
- "Special value" means display text for the minimum value(