#ifndef CUSTOMGLOBALTHEME_H
#define CUSTOMGLOBALTHEME_H

#include "globaltheme.h"

#include <QPixmap>

class QGSettings;
class QSettings;

class CustomThumbnailer : public QObject
{
    Q_OBJECT
public:
    explicit CustomThumbnailer(QObject *parent = nullptr);

signals:
    void thumbnailUpdated(const QPixmap &pixmap);

public slots:
    void startLoad();

};

class CustomGlobalTheme : public GlobalTheme
{
    Q_OBJECT
public:
    explicit CustomGlobalTheme(QObject *parent = nullptr);

    QString getThemeName() override;
    QString getLocaleThemeName() override;

    bool getSupportLightDarkMode() override;
    QString getDefaultLightDarkMode() override;

    QString getWidgetStyleName() override;
    QString getQtLightThemeName() override;
    QString getQtDarkThemeName() override;
    QString getQtMixedThemeName() override;
    QString getQtAccentRole() override;

    QString getGtkThemeName() override;
    QString getGtkLightThemeName() override;
    QString getGtkDarkThemeName() override;
    QString getGtkAccent() override;

    QString getIconThemeName() override;
    QString getCursorThemeName() override;
    QString getSoundThemeName() override;
    QString getWallPaperPath() override;

    bool getSupportBlur() override;
    bool getBlurEnabled() override;

    bool getSupportTransparency() override;
    int getTransparencyBlur() override;
    int getTransparencyNoBlur() override;

    bool getSupportAnimation() override;
    int getAnimationDuration() override;

    bool getSupportRadius() override;
    int getRadiusValue() override;

    void loadThumbnail() override;
    QPixmap getThumbnail() override;
    void updateThumbnail(const QPixmap &pixmap) override;

    bool isModified();
    void loadFromOtherGlobalTheme(GlobalTheme *other);
    void updateValue(const QString &functionName, const QVariant &value);

public Q_SLOTS:
    void onGlobalSettingsChanged(const QString &key);

private:
    QGSettings *gsettings = nullptr;

    QSettings *qsettings = nullptr;
    QPixmap pixmap;
};

#endif // CUSTOMGLOBALTHEME_H
