/* * Copyright (c) 2014 Christian Surlykke * * This file is part of the LXQt project. * It is distributed under the LGPL 2.1 or later license. * Please refer to the LICENSE file for a copy of the license. */ #ifndef ICONPRODUCER_H #define ICONPRODUCER_H #include #include #include #include "../config/powermanagementsettings.h" #include class IconProducer : public QObject { Q_OBJECT public: IconProducer(Solid::Battery* battery, QObject *parent = nullptr); IconProducer(QObject *parent = nullptr); void forceIconType(PowerManagementSettings::IconType iconType); QIcon mIcon; QString mIconName; signals: void iconChanged(); public slots: void updateChargePercent(int newChargePercent); void updateState(int newState); void update(); void themeChanged(); private: bool updateIcon(); QIcon generatedIcon(); template QString buildIcon(Solid::Battery::ChargeState state, int chargeLevel); int mChargePercent; Solid::Battery::ChargeState mState; PowerManagementSettings mSettings; QMap mLevelNameMapCharging; QMap mLevelNameMapDischarging; bool iconTypeForced; PowerManagementSettings::IconType mIconType; }; #endif // ICONPRODUCER_H