Bug 450276

Summary: Merge Energy Saving KCM and Advanced Power Settings
Product: [Applications] systemsettings Reporter: guimarcalsilva
Component: kcm_powerdevilAssignee: Jakob Petsovits <jpetso>
Status: RESOLVED FIXED    
Severity: wishlist CC: jpetso, kde, natalie_clarius, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:

Description guimarcalsilva 2022-02-15 02:09:56 UTC
This bug is part of an ongoing effort to rethink the options available in System Settings. The end goal is to consolidate some obscure options to make Plasma feel simpler to use and improve the user experience. I was advised to make individual bug reports with my suggestions. More details with all the suggestions and talking points can be seen in this shared document: https://collaborate.kde.org/s/oEkdeYerKqaZNyC

------------

Advanced options go against the Lessons Learned Page: https://community.kde.org/Get_Involved/Design/Lessons_Learned

These options could be moved to the Energy Saving page, and that page could simply be renamed to Energy or Power Settings. With that and https://bugs.kde.org/show_bug.cgi?id=450275, SySe could get rid of an entire subcategory and only have a single page to control all power settings.


SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Comment 1 Nate Graham 2022-02-15 04:22:48 UTC
Yeah, we need to do this.
Comment 2 Jakob Petsovits 2023-12-15 06:28:55 UTC
Git commit 127f6aef4ec9626e95c200d5600655bc781b45d6 by Jakob Petsovits.
Committed on 15/12/2023 at 07:21.
Pushed by jpetso into branch 'master'.

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.
Related: bug 449254, bug 459081, bug 467797

M  +0    -2    kcmodule/CMakeLists.txt
M  +0    -1    kcmodule/common/CMakeLists.txt
D  +0    -90   kcmodule/common/ErrorOverlay.cpp
D  +0    -28   kcmodule/common/ErrorOverlay.h
D  +0    -19   kcmodule/global/CMakeLists.txt
D  +0    -266  kcmodule/global/GeneralPage.cpp
D  +0    -47   kcmodule/global/GeneralPage.h
D  +0    -4    kcmodule/global/Messages.sh
D  +0    -277  kcmodule/global/generalPage.ui
D  +0    -126  kcmodule/global/kcm_powerdevilglobalconfig.json
M  +3    -1    kcmodule/profiles/CMakeLists.txt
A  +190  -0    kcmodule/profiles/ExternalServiceSettings.cpp     [License: GPL(v2.0+)]
A  +66   -0    kcmodule/profiles/ExternalServiceSettings.h     [License: GPL(v2.0+)]
M  +0    -2    kcmodule/profiles/Messages.sh
M  +107  -5    kcmodule/profiles/ProfilesConfigKCM.cpp
M  +41   -2    kcmodule/profiles/ProfilesConfigKCM.h
M  +32   -31   kcmodule/profiles/kcm_powerdevilprofilesconfig.json
A  +364  -0    kcmodule/profiles/ui/GlobalConfig.qml     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +53   -0    kcmodule/profiles/ui/MostUsedItem.qml     [License: LGPL(v2.0)]
M  +8    -1    kcmodule/profiles/ui/main.qml

https://invent.kde.org/plasma/powerdevil/-/commit/127f6aef4ec9626e95c200d5600655bc781b45d6
Comment 3 Nate Graham 2023-12-16 04:57:11 UTC
This is effectively done now for Plasma 6.
Comment 4 Jakob Petsovits 2023-12-16 05:26:09 UTC
(In reply to Nate Graham from comment #3)
> This is effectively done now for Plasma 6.

Not sure if it's better to reopen the bug or open separate smaller bugs, but two of its suggestions are not yet implemented:

1. Removing the notion of "Advanced" settings as per Lessons Learned (we'll need more redesigning to make this happen)
2. Renaming the remaining KCM to Energy or Power Settings (personally I currently like "Power and Performance")

Let's make sure we don't forget about those now that the merge has happened.
Comment 5 Jakob Petsovits 2023-12-16 20:31:39 UTC
(In reply to Jakob Petsovits from comment #4)
> Not sure if it's better to reopen the bug or open separate smaller bugs, but
> two of its suggestions are not yet implemented: [...]

I opened https://invent.kde.org/plasma/powerdevil/-/issues/32 to remind us about moving away from "Advanced" settings, and the KCM rename is on Oliver Beard's TODO list as per https://invent.kde.org/plasma/powerdevil/-/merge_requests/107#note_793773. Looks like we don't need to reopen this.