fix bugs and styles

- Fix a bug where export dir wont open
- Make sure currentBatteryLevel is between bounds
This commit is contained in:
uncor3
2025-11-07 17:41:19 +00:00
parent d0fb0870d4
commit f687550471
5 changed files with 30 additions and 35 deletions
+7 -5
View File
@@ -42,6 +42,7 @@
#include <QTabWidget>
#include <QTimer>
#include <QVBoxLayout>
#include <QtCore>
DeviceInfoWidget::DeviceInfoWidget(iDescriptorDevice *device, QWidget *parent)
: QWidget(parent), m_device(device)
@@ -156,9 +157,9 @@ DeviceInfoWidget::DeviceInfoWidget(iDescriptorDevice *device, QWidget *parent)
m_lightningIconLabel = new ZIconLabel(
QIcon(":/resources/icons/MdiLightningBolt.png"), " Charging", this);
m_batteryWidget =
new BatteryWidget(device->deviceInfo.batteryInfo.currentBatteryLevel,
device->deviceInfo.batteryInfo.isCharging, this);
m_batteryWidget = new BatteryWidget(
qBound<int>(1, device->deviceInfo.batteryInfo.currentBatteryLevel, 100),
device->deviceInfo.batteryInfo.isCharging, this);
// Add the widgets to the new layout
chargingLayout->addWidget(m_chargingStatusLabel);
@@ -375,8 +376,9 @@ void DeviceInfoWidget::updateBatteryInfo()
? "USB"
: "USB-C"));
m_batteryWidget->updateContext(d.batteryInfo.isCharging,
d.batteryInfo.currentBatteryLevel);
m_batteryWidget->updateContext(
d.batteryInfo.isCharging,
qBound<int>(1, d.batteryInfo.currentBatteryLevel, 100));
}
void DeviceInfoWidget::updateChargingStatusIcon()