42 lines
763 B
C++
42 lines
763 B
C++
#ifndef STATUSBAR_H
|
|
#define STATUSBAR_H
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QTimer>
|
|
|
|
class StatusBar : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit StatusBar(QWidget *parent = nullptr);
|
|
~StatusBar();
|
|
|
|
void setTitle(const QString &title);
|
|
void setBatteryLevel(int level);
|
|
void setNetworkStatus(bool connected, const QString &type = "WiFi");
|
|
|
|
private slots:
|
|
void updateTime();
|
|
void updateBatteryLevel();
|
|
void updateNetworkStatus();
|
|
|
|
private:
|
|
void setupUI();
|
|
int getBatteryPercentage();
|
|
bool isWiFiConnected();
|
|
|
|
QLabel *m_titleLabel;
|
|
QLabel *m_timeLabel;
|
|
QLabel *m_batteryLabel;
|
|
QLabel *m_networkLabel;
|
|
QTimer *m_timer;
|
|
|
|
int m_batteryLevel;
|
|
bool m_networkConnected;
|
|
QString m_networkType;
|
|
};
|
|
|
|
#endif // STATUSBAR_H
|