-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
36 lines (25 loc) · 925 Bytes
/
main.cpp
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QIcon>
#include "app_state.h"
#include "cover_image_provider.h"
#include "playlist_model.h"
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QGuiApplication::setWindowIcon(QIcon(":/icons/app_dark.svg"));
qRegisterMetaType<Song>("Song");
QQmlApplicationEngine engine;
auto *coverProvider = new CoverImageProvider();
engine.addImageProvider(QLatin1String("cover"), coverProvider);
auto *playlistModel = new PlaylistModel();
engine.rootContext()->setContextProperty("playlistModel", playlistModel);
auto *appState = new AppState(playlistModel);
engine.rootContext()->setContextProperty("appState", appState);
engine.load(QUrl(QStringLiteral("qrc:/qml/AppWindow.qml")));
if (engine.rootObjects().isEmpty()) {
return -1;
}
return app.exec();
}