D23368: [Energy KCM] Port away from WorkspaceComponents.BatteryIcon

Kai Uwe Broulik noreply at phabricator.kde.org
Fri Aug 23 09:05:29 BST 2019


broulik added inline comments.

INLINE COMMENTS

> broulik wrote in main.qml:156
> Now you lost the battery level and charging state in the icon.

Can use the following

  var iconNameParts = ["battery"];
  // Round percentage to the nearest 10% and pad it with leading zeroes to match the icon names
  iconNameParts.push(String(Math.round(model.battery.chargePercent / 10) * 10).padStart(3, "0"));
  if (model.battery.chargeState === 1) { // charging
      iconNameParts.push("charging");
  }
  return iconNameParts.join("-");

REPOSITORY
  R102 KInfoCenter

REVISION DETAIL
  https://phabricator.kde.org/D23368

To: ngraham, #plasma, broulik, meven
Cc: filipf, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190823/27c66606/attachment.html>


More information about the Plasma-devel mailing list