fix: add information when the time to charge/discharge is unavailable

This commit is contained in:
Serhiy Mytrovtsiy
2021-05-10 19:49:32 +02:00
parent 6323f31b3d
commit 65cf681eac

View File

@@ -231,11 +231,15 @@ internal class Popup: NSView, Popup_p {
self.timeLabelField?.stringValue = "\(LocalizedString("Time to discharge")):"
if value.timeToEmpty != -1 && value.timeToEmpty != 0 {
self.timeField?.stringValue = Double(value.timeToEmpty*60).printSecondsToHoursMinutesSeconds(short: self.timeFormat == "short")
} else {
self.timeField?.stringValue = LocalizedString("Unknown")
}
} else {
self.timeLabelField?.stringValue = "\(LocalizedString("Time to charge")):"
if value.timeToCharge != -1 && value.timeToCharge != 0 {
self.timeField?.stringValue = Double(value.timeToCharge*60).printSecondsToHoursMinutesSeconds(short: self.timeFormat == "short")
} else {
self.timeField?.stringValue = LocalizedString("Unknown")
}
}