mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-10 19:52:24 +00:00
Merge pull request #46 from tim-gromeyer/linux-airpods-battery-level
[Linux] Show correct battery level when 1 Airpod is disconnected
This commit is contained in:
@@ -339,7 +339,21 @@ public slots:
|
|||||||
QStringList parts = status.split(", ");
|
QStringList parts = status.split(", ");
|
||||||
int leftLevel = parts[0].split(": ")[1].replace("%", "").toInt();
|
int leftLevel = parts[0].split(": ")[1].replace("%", "").toInt();
|
||||||
int rightLevel = parts[1].split(": ")[1].replace("%", "").toInt();
|
int rightLevel = parts[1].split(": ")[1].replace("%", "").toInt();
|
||||||
int minLevel = qMin(leftLevel, rightLevel);
|
|
||||||
|
int minLevel;
|
||||||
|
if (leftLevel == 0)
|
||||||
|
{
|
||||||
|
minLevel = rightLevel;
|
||||||
|
}
|
||||||
|
else if (rightLevel == 0)
|
||||||
|
{
|
||||||
|
minLevel = leftLevel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minLevel = qMin(leftLevel, rightLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap pixmap(32, 32);
|
QPixmap pixmap(32, 32);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
@@ -952,4 +966,4 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "main.moc"
|
#include "main.moc"
|
||||||
|
|||||||
Reference in New Issue
Block a user