blob: 1698e9a037c583dfcd42b743ea94e700c1f85f1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include <QList>
#include <QPixmap>
#include <QScopedPointer>
#include <QVector>
#include "skin/legacy/skincontext.h"
#include "widget/wlabel.h"
#include "widget/wpixmapstore.h"
#include "widget/wwidget.h"
#include "util/battery/battery.h"
class WBattery : public WWidget {
Q_OBJECT
public:
explicit WBattery(QWidget* parent = nullptr);
~WBattery() override = default;
void setup(const QDomNode& node, const SkinContext& context);
static QString formatTooltip(double dPercentage);
private slots:
// gets information from battery and updates the Pixmap
void slotStateChanged();
protected:
void paintEvent(QPaintEvent * /*unused*/) override;
private:
void setPixmap(PaintablePointer* ppPixmap, const PixmapSource& source,
Paintable::DrawMode mode, double scaleFactor);
QScopedPointer<Battery> m_pBattery;
PaintablePointer m_pCurrentPixmap;
PaintablePointer m_pPixmapBack;
PaintablePointer m_pPixmapCharged;
QVector<PaintablePointer> m_dischargingPixmaps;
QVector<PaintablePointer> m_chargingPixmaps;
};
|