aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp
blob: fb9e5fb2d318981337b53a00acc060e81ec8ee50 (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
#include <QStylePlugin>
#include <QSettings>
#include <QStyleFactory>
#include <lthemeengine/lthemeengine.h>
#include "lthemeengineproxystyle.h"

class lthemeengineStylePlugin : public QStylePlugin{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "lthemeengine.json")

public:
    QStyle *create(const QString &key);
};

QStyle *lthemeengineStylePlugin::create(const QString &key){
    if (key == "lthemeengine-style")
    {
        QSettings settings(lthemeengine::configFile(), QSettings::IniFormat);
        QString style = settings.value("Appearance/style", "Fusion").toString();
        if(key == style || !QStyleFactory::keys().contains(style))
            style = "Fusion";
        return new lthemeengineProxyStyle(style);
    }
    return 0;
}

#include "plugin.moc"
bgstack15