Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
73 lines (62 loc) · 1.9 KB
/
Copy pathmain.cpp
File metadata and controls
73 lines (62 loc) · 1.9 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
#include <QApplication>
#include <QString>
#include <QStringList>
#include <QProcess>
#include <QCoreApplication>
#include <QMessageBox>
#include <QSurfaceFormat>
#include <clocale>
#include <cstring>
#include "ultragrid_window.hpp"
static bool show_help(char *argv[]) {
const char *progname = argv[0];
while (*argv != nullptr) {
if (strcmp(*argv, "-h") == 0 || strcmp(*argv, "--help") == 0) {
printf("Usage:\n");
printf("\t%s [-h|--help|--with-uv <uv>|--config <config_path>]\n", progname);
return true;
}
argv++;
}
return false;
}
int main(int argc, char *argv[]){
if (show_help(argv)) {
return 0;
}
QApplication app(argc, argv);
QStringList args = QCoreApplication::arguments();
QString ultragridExecutable = UltragridWindow::findUltragridExecutable();
QProcess process;
//important: If this line is removed parsing float numbers for vu meter fails
std::setlocale(LC_NUMERIC, "C");
QSurfaceFormat fmt;
fmt.setVersion(3, 3);
fmt.setProfile(QSurfaceFormat::CoreProfile);
fmt.setRenderableType(QSurfaceFormat::OpenGL);
QSurfaceFormat::setDefaultFormat(fmt);
UltragridWindow uw;
uw.show();
process.start(ultragridExecutable, QStringList());
if(process.waitForStarted(1000) == false) {
QMessageBox msgBox;
msgBox.setText(ultragridExecutable + " doesn't seem to be executable.");
msgBox.setInformativeText("Please install uv (UltraGrid binary) to your system "
"path or supply a '--with-uv' parameter.\n\n"
"Please check also if the binary is executable.");
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
return 1;
}
process.waitForFinished();
if (process.exitStatus() == QProcess::CrashExit || process.exitCode() != 0) {
QMessageBox msgBox;
msgBox.setText("UltraGrid has crashes when invoked without arguments!");
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
return 1;
}
uw.initializeUgOpts();
return app.exec();
}
/* vi: set noexpandtab: */