refactor DeviceInfoWidget

- Adds battery widget and real-time battery monitoring
- Creates custom battery widget component for visual battery status display
- Integrates comprehensive battery information including charging state,
current level, connection type (USB/USB-C), and power consumption
- Implements automatic battery status updates every 30 seconds to keep
information current during device connection
- Refactors battery data retrieval into separate service function for
better code organization and reusability
- Enhances device info header with charging status, power consumption,
and connection type indicators alongside visual battery widget
This commit is contained in:
uncor3
2025-09-26 17:27:03 +00:00
parent 4f5417cbcc
commit 43aa783433
7 changed files with 447 additions and 87 deletions
+10 -1
View File
@@ -1,6 +1,9 @@
#ifndef DEVICEINFOWIDGET_H
#define DEVICEINFOWIDGET_H
#include "batterywidget.h"
#include "iDescriptor.h"
#include <QLabel>
#include <QTimer>
#include <QWidget>
class DeviceInfoWidget : public QWidget
@@ -15,7 +18,13 @@ private slots:
private:
QPixmap getDeviceIcon(const std::string &productType);
iDescriptorDevice *device;
iDescriptorDevice *m_device;
QTimer *m_updateTimer;
void updateBatteryInfo();
QLabel *m_chargingStatusLabel;
QLabel *m_chargingWattsLabel;
QLabel *m_cableTypeLabel;
BatteryWidget *m_batteryWidget;
};
#endif // DEVICEINFOWIDGET_H