-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (34 loc) · 1.2 KB
/
Copy pathmain.cpp
File metadata and controls
45 lines (34 loc) · 1.2 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
38
39
40
41
42
43
44
45
#include <QApplication>
#include <FelgoApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#ifdef QT_NO_DEBUG
constexpr auto PUBLISH = true;
#else
#include <FelgoLiveClient>
constexpr auto PUBLISH = false;
#endif
constexpr auto REMOTE_VIEW_DIR = "http://zdonik.mukhtarov.net:8000";
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
const auto VIEWS_ROOT = PUBLISH ? REMOTE_VIEW_DIR : app.applicationDirPath() + "/qml/views";
FelgoApplication felgo;
// Use platform-specific fonts instead of Felgo's default font
felgo.setPreservePlatformFonts(true);
QQmlApplicationEngine engine;
felgo.initialize(&engine);
// Set an optional license key from project file
// This does not work if using Felgo Live, only for Felgo Cloud Builds and local builds
felgo.setLicenseKey(PRODUCT_LICENSE_KEY);
engine.rootContext()->setContextProperty("isPublishStage", PUBLISH);
engine.rootContext()->setContextProperty("viewRoot", VIEWS_ROOT);
engine.addImportPath(VIEWS_ROOT);
#ifdef QT_NO_DEBUG
felgo.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml"));
engine.load(QUrl(felgo.mainQmlFileName()));
#else
FelgoLiveClient client(&engine);
#endif
return app.exec();
}