This repository has been archived by the owner on Dec 1, 2019. It is now read-only.
/
main.cpp
82 lines (65 loc) · 2.24 KB
/
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
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
#include <QApplication>
#include <QDebug>
#include <QTranslator>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QtDeclarative>
#include "qmlapplicationviewer.h"
#else
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickView>
#endif
#include "Utility.h"
#include "Settings.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef Q_OS_SYMBIAN
QApplication::setAttribute((Qt::ApplicationAttribute)11); //Qt::AA_CaptureMultimediaKeys
#endif
QApplication app(argc, argv);
app.setApplicationName("QVideo");
app.setOrganizationName("QShen");
app.setApplicationVersion(VER);
QString locale = QLocale::system().name();
QTranslator translator;
if(!translator.load(QString("QVideo_") + locale,":/i18n")){
qDebug()<<"translator load erro";
}
app.installTranslator(&translator);
Utility utility;
Settings settings;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QmlApplicationViewer viewer;
//viewer.setAttribute(Qt::WA_OpaquePaintEvent);
//viewer.setAttribute(Qt::WA_NoSystemBackground);
//viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
//viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
viewer.rootContext()->setContextProperty("utility", &utility);
viewer.rootContext()->setContextProperty("settings", &settings);
viewer.rootContext()->setContextProperty("appVersion", app.applicationVersion());
#ifdef Q_OS_SYMBIAN
QSplashScreen *splash = new QSplashScreen(QPixmap(":/qml/pic/splash_symbian.png"));
splash->show();
splash->raise();
viewer.setSource(QUrl("qrc:/qml/Symbian/main.qml"));
#elif defined(Q_OS_HARMATTAN)
//QApplication::setGraphicsSystem("native");
viewer.setSource(QUrl("qrc:/qml/Meego/main.qml"));
#elif defined(Q_WS_SIMULATOR)
viewer.setSource(QUrl("qrc:/qml/Symbian/main.qml"));
#endif
viewer.showExpanded();
#else
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("utility",&utility);
#ifdef Q_OS_WIN32
engine.load(QUrl(QStringLiteral("qrc:/qml/Win32/main.qml")));
#endif
#endif
#ifdef Q_OS_SYMBIAN
splash->finish(&viewer);
splash->deleteLater();
#endif
return app.exec();
}