-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
86 lines (73 loc) · 2.62 KB
/
Copy pathmain.cpp
File metadata and controls
86 lines (73 loc) · 2.62 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright (C) 2023 Michel de Boer
// License: GPLv3
#include "cached_image_provider.h"
#include "font_downloader.h"
#include "shared_image_provider.h"
#include "sky_application.h"
#include "skywalker.h"
#include "temp_file_holder.h"
#include <QFont>
#include <QGuiApplication>
#include <QImageReader>
#include <QImageWriter>
#include <QQmlApplicationEngine>
using namespace Qt::Literals::StringLiterals;
#ifdef DEBUG
extern "C" const char* __lsan_default_options()
{
return LEAK_SUPPRESSIONS;
}
#endif
#ifdef Q_OS_ANDROID
// HACK
// Google Play dashboard often shows ANR issues with accessibility in the stacktrace.
// Disable till we properly add accessibility.
// It disables all accessibility features. Copied from the following file
// and modified to always return false:
// c:\Qt6\6.10.1\Src\qtbase\src\plugins\platforms\android\qandroidplatformintegration.cpp
extern "C" {
JNIEXPORT bool JNICALL
Java_org_qtproject_qt_android_QtNativeAccessibility_accessibilitySupported(JNIEnv *, jobject)
{
qInfo() << "Disable accessibility";
return false;
}
}
#endif
int main(int argc, char *argv[])
{
qSetMessagePattern("%{time HH:mm:ss.zzz} %{type} %{function}'%{line} %{message}");
#ifdef DEBUG
qputenv("QSG_INFO", "1");
//qputenv("QSG_RENDER_TIMING", "1");
//qputenv("QSG_VISUALIZE", "batches"); // batches, overdraw, clip, changes
#endif
#ifdef QT_NO_DEBUG_OUTPUT
QLoggingCategory::setFilterRules("qml*.debug=false");
#endif
#ifdef DEBUG
Skywalker::SkyApplication app(argc, argv);
#else
QGuiApplication app(argc, argv);
#endif
app.setOrganizationName(Skywalker::Skywalker::APP_NAME);
app.setApplicationName(Skywalker::Skywalker::APP_NAME);
Skywalker::TempFileHolder::init();
Skywalker::FontDownloader::initAppFonts();
qInfo() << "Image reader supported:" << QImageReader::supportedImageFormats();
qInfo() << "Image writer supported:" << QImageWriter::supportedImageFormats();
QQmlApplicationEngine engine;
auto* providerId = Skywalker::SharedImageProvider::SHARED_IMAGE;
engine.addImageProvider(providerId, Skywalker::SharedImageProvider::getProvider(providerId));
providerId = Skywalker::CachedImageProvider::AVATAR;
engine.addImageProvider(providerId, Skywalker::CachedImageProvider::getProvider(providerId));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
const QUrl url(u"qrc:/skywalker/qml/Main.qml"_s);
engine.load(url);
#ifdef Q_OS_ANDROID
QNativeInterface::QAndroidApplication::hideSplashScreen(200);
#endif
return app.exec();
}