-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
32 lines (29 loc) · 852 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
#include "config.h"
#include "lrc.h"
#include "lyricsmodel.h"
#include <QDir>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QStandardPaths>
#include <fstream>
#define APP_NAME "puff"
QString configPath()
{
QDir config_dir = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
config_dir.mkdir(APP_NAME);
config_dir.cd(APP_NAME);
return config_dir.filePath("config.json");
}
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
Config config(configPath());
qmlRegisterType<LyricsModel>("kienyew.github", 1, 0, "LyricsModel");
engine.rootContext()->setContextProperty("config", &config);
engine.load("qrc:/Puff/main.qml");
int exit_code = app.exec();
config.write();
return exit_code;
}