-
Notifications
You must be signed in to change notification settings - Fork 16
/
main.cpp
51 lines (43 loc) · 1.42 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
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QMessageBox>
#ifndef _WIN32
#include <stdlib.h>
#endif
bool can_run_windows_programs() {
#ifndef _WIN32
// Make sure that Wine exists on Linux
int exitcode = system("wine --version");
return exitcode == 0;
#else
return true;
#endif
}
int main(int argc, char* argv[]) {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication application(argc, argv);
application.setApplicationName("WololoKingdoms");
application.setApplicationVersion("5.8.1.6");
QCommandLineParser cli;
cli.setApplicationDescription(
"Installer for the WololoKingdoms mod, bringing Age of Empires II: HD "
"Edition expansions to Age of Empires II: The Conquerors");
cli.addHelpOption();
cli.addVersionOption();
QCommandLineOption skipUpdaterOption(
"s",
QCoreApplication::translate("main", "Do not call the auto-updater."));
cli.addOption(skipUpdaterOption);
cli.process(application);
bool skipUpdater = cli.isSet(skipUpdaterOption);
MainWindow window(nullptr, skipUpdater);
if (!can_run_windows_programs()) {
QMessageBox::warning(&window, "Wine not found",
"Wine could not be found. You will have to pick the "
"path to your Age of Empires 2 directory manually.",
QMessageBox::Ok);
}
window.show();
return application.exec();
}