aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp
blob: 31c59a0c9aeb67831266ceb4c16456dcdd0d4852 (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
#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