-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (44 loc) · 1.4 KB
/
main.cpp
File metadata and controls
59 lines (44 loc) · 1.4 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
// SPDX-FileCopyrightText: Copyright 2024 BBLauncher Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include <QApplication>
#include <QCommandLineParser>
#include <QMessageBox>
#if defined(_MSC_VER)
#include <intrin.h>
#endif
#ifndef USE_WEBENGINE
#include <QtWebView>
#endif
#include "modules/RunGuard.h"
#include "modules/bblauncher.h"
void customMessageHandler(QtMsgType, const QMessageLogContext&, const QString&) {}
int main(int argc, char* argv[]) {
#ifdef Q_OS_MAC
qputenv("QT_WEBVIEW_PLUGIN", "native");
#endif
#ifndef USE_WEBENGINE
QtWebView::initialize();
#endif
QApplication a(argc, argv);
QApplication::setStyle("Fusion");
QCommandLineParser parser;
QCommandLineOption noGui("n");
parser.addOption(noGui);
parser.process(a);
bool noGUIset = parser.isSet(noGui);
RunGuard guard("d8976skj86874hkj287960980lkjhfka1#Q$^&*");
bool noinstancerunning = guard.tryToRun();
BBLauncher* main_window = new BBLauncher(noGUIset, noinstancerunning, nullptr);
bool hasInstance = false;
if (!noinstancerunning) {
QMessageBox::warning(nullptr, "BB_Launcher already running",
"Only one instance of BB_Launcher can run at a time");
main_window->close();
return 0;
}
noGUIset ? main_window->hide() : main_window->show();
if (!main_window->canLaunch) {
return 0;
}
return a.exec();
}