MCPcopy Create free account
hub / github.com/LibreVR/Revive / main

Function main

ReviveOverlay/main.cpp:40–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int main(int argc, char *argv[])
41{
42 QApplication a(argc, argv);
43
44 // Open the log file and install our handler.
45 QString logPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Revive/";
46 if (QDir().mkpath(logPath)) {
47 g_LogFile = new QFile(logPath + "ReviveOverlay.txt");
48 g_LogFile->open(QIODevice::WriteOnly | QIODevice::Truncate);
49 }
50 qInstallMessageHandler(myMessageOutput);
51
52 // Handle command-line arguments
53 if (a.arguments().contains("-manifest")) {
54 // Only initialize the manifest
55 vr::EVRInitError err = vr::VRInitError_None;
56 vr::VR_Init( &err, vr::VRApplication_Utility );
57
58 if ( err != vr::VRInitError_None )
59 return -1;
60
61 QString filePath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/app.vrmanifest");
62 vr::VRApplications()->AddApplicationManifest(qPrintable(filePath));
63 vr::VRApplications()->SetApplicationAutoLaunch(CReviveManifestController::AppKey, true);
64 vr::VR_Shutdown();
65 return 0;
66 }
67
68 if (COpenVROverlayController::SharedInstance()->Init())
69 {
70 // If the dashboard was successfully created keep running in the background
71 a.setQuitOnLastWindowClosed(false);
72 }
73
74 if (!QSslSocket::supportsSsl())
75 qDebug("Missing SSL support, online features will not work");
76
77 if (!CTrayIconController::SharedInstance()->Init())
78 qDebug("Failed to initialize the tray icon");
79
80 if (!CReviveManifestController::SharedInstance()->Init())
81 qDebug("Failed to initialize the revive manifest");
82
83 if (!COculusOauthTokenController::SharedInstance()->Init())
84 qDebug("Failed to initialize the Oculus OAuth token");
85
86 // Create a QML engine.
87 QQmlEngine qmlEngine;
88 qmlEngine.rootContext()->setContextProperty("Revive", CReviveManifestController::SharedInstance());
89 qmlEngine.rootContext()->setContextProperty("OpenVR", COpenVROverlayController::SharedInstance());
90 qmlEngine.rootContext()->setContextProperty("Platform", COculusOauthTokenController::SharedInstance());
91
92 QQmlComponent qmlComponent( &qmlEngine, QUrl("qrc:/Overlay.qml"));
93 if (qmlComponent.isError())
94 {
95 qDebug(qUtf8Printable(qmlComponent.errorString()));
96 return -1;
97 }

Callers

nothing calls this directly

Calls 3

SetQuickItemMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected