#ifndef POWERSHOW_H
#define POWERSHOW_H

#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDebug>
#include <QPainter>
#include <QGSettings>
#include <QTime>
#include <QCoreApplication>
#include "../commondata.h"

#define KYLIN_BATTERY0_PATH            ":/image/battery-level-0-symbolic.svg"
#define KYLIN_BATTERY10_PATH           ":/image/battery-level-10-symbolic.svg"
#define KYLIN_BATTERY20_PATH           ":/image/battery-level-20-symbolic.svg"
#define KYLIN_BATTERY30_PATH           ":/image/battery-level-30-symbolic.svg"
#define KYLIN_BATTERY40_PATH           ":/image/battery-level-40-symbolic.svg"
#define KYLIN_BATTERY50_PATH           ":/image/battery-level-50-symbolic.svg"
#define KYLIN_BATTERY60_PATH           ":/image/battery-level-60-symbolic.svg"
#define KYLIN_BATTERY70_PATH           ":/image/battery-level-70-symbolic.svg"
#define KYLIN_BATTERY80_PATH           ":/image/battery-level-80-symbolic.svg"
#define KYLIN_BATTERY90_PATH           ":/image/battery-level-90-symbolic.svg"
#define KYLIN_BATTERY100_PATH          ":/image/battery-level-100-symbolic.svg"


#define KYLIN_BATTERY_CHARGING0_PATH            ":/image/battery-level-0-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING10_PATH           ":/image/battery-level-10-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING20_PATH           ":/image/battery-level-20-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING30_PATH           ":/image/battery-level-30-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING40_PATH           ":/image/battery-level-40-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING50_PATH           ":/image/battery-level-50-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING60_PATH           ":/image/battery-level-60-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING70_PATH           ":/image/battery-level-70-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING80_PATH           ":/image/battery-level-80-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING90_PATH           ":/image/battery-level-90-charging-symbolic.svg"
#define KYLIN_BATTERY_CHARGING100_PATH          ":/image/battery-level-100-charging-symbolic.svg"

class Powershow : public QWidget
{
    Q_OBJECT
public:
    explicit Powershow(QWidget *parent= nullptr);
    ~Powershow();

    void initMemberVariables();
    void initDbusaddrest();
    void initDbusValue();
    void ConnetChangeDbus();

    QLabel         *m_pPowerLabel;
    QLabel         *m_pPowericon;
    QHBoxLayout    *m_pHboxLayout;
    QTimer         *powertimer;
    QStringList    m_IconBatterList;
    QStringList    m_IconBatterChangeList;

    QString        powerpath;
    QString        Elect_surplus;
    QString        Charging;
    QFont          ft;

private:
    PictureToWhite *m_pPictureToWhite;
    QGSettings     *m_psGsetting;
    QPixmap         drawBackground(const QPixmap& pixmap);

private slots:
    void  changesignal();
    void  sleepsignal();
    void  getStyleChageSlots(QString key);
};


#endif // POWERSHOW_H
