-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapplication.cpp
More file actions
37 lines (29 loc) · 1.05 KB
/
application.cpp
File metadata and controls
37 lines (29 loc) · 1.05 KB
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
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2024 Adesh Singh
#include "application.h"
#include <QQmlContext>
#include "src/svgelementprovider.h"
Application *Application::_application = nullptr;
Application::Application(QQmlApplicationEngine *engine,QObject *parent)
: QObject{parent},
m_engine{engine}
{
_themeInfo = nullptr;
initComponent();
registerQML();
}
void Application::initComponent()
{
_themeInfo = new ThemeInfo();
}
void Application::registerQML()
{
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/LightTheme.qml")),"Theme",1,0,"LightTheme");
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/DarkTheme.qml")),"Theme",1,0,"DarkTheme");
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/Theme.qml")),"Theme",1,0,"Style");
m_engine->rootContext()->setContextProperty("gTheme",_themeInfo);
m_engine->addImageProvider(QStringLiteral(""), new SvgElementProvider(QQmlImageProviderBase::Image, QUrl(QStringLiteral("qrc:///assets/"))));
}
ThemeInfo *Application::getThemeInfo()
{
return _themeInfo;
}