Details
Diff Detail
- Repository
- R102 KInfoCenter
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 17292 Build 17310: arc lint + arc unit
As this it not in the scope of this patch, those values look suspicious to me too:
switch(model.battery.type) { case 3: return i18n("Internal battery") case 2: return i18n("UPS battery") case 9: return i18n("Monitor battery") case 4: return i18n("Mouse battery") case 5: return i18n("Keyboard battery") case 1: return i18n("PDA battery") case 7: return i18n("Phone battery") default: return i18n("Unknown battery")
Is there a special reason for the weired order? Is it correct that case 0 and 6 are missing and default to unknown? Maybe (I haven't looked deeper into it) this needs another patch.
Modules/energy/package/contents/ui/main.qml | ||
---|---|---|
104–110 | Wouldn't it be better to define 0 as a default value? | |
110 | Now you have two times the case 6 |
This is already available and translated in solid.
solid/src/solid/devices/backends/upower/upowerdevice.cpp
142: return tr("Lithium Ion", "battery technology");
Can't we expose that instead of duplicating things in QML. Especially with horrific magic numbers instead of enums.
Being a private function , this is quite complicated to expose and in solid's backend.
Can't we expose that instead of duplicating things in QML. Especially with horrific magic numbers instead of enums.
I have updated the code to use the enum properly.
Modules/energy/batterymodel.cpp | ||
---|---|---|
31 | Used this nice documentation to choose the right method : https://doc.qt.io/qt-5/qtqml-cppintegration-overview.html#choosing-the-correct-integration-method-between-c-and-qml |