UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include <QApplication>
2#include <QString>
3#include <QStringList>
4#include <QProcess>
5#include <QCoreApplication>
6#include <QMessageBox>
7#include <QSurfaceFormat>
8#include <clocale>
9#include <cstring>
10
11#include "ultragrid_window.hpp"
12
13static bool show_help(char *argv[]) {
14 const char *progname = argv[0];
15 while (*argv != NULL) {
16 if (strcmp(*argv, "-h") == 0 || strcmp(*argv, "--help") == 0) {
17 printf("Usage:\n");
18 printf("\t%s [-h|--help|--with-uv <uv>|--config <config_path>]\n", progname);
19 return true;
20 }
21 argv++;
22 }
23 return false;
24}
25
26int main(int argc, char *argv[]){
27 if (show_help(argv)) {
28 return 0;
29 }
30 QApplication app(argc, argv);
31 QStringList args = QCoreApplication::arguments();
32 QString ultragridExecutable = UltragridWindow::findUltragridExecutable();
33 QProcess process;
34
35 //important: If this line is removed parsing float numbers for vu meter fails
36 std::setlocale(LC_NUMERIC, "C");
37
38 QSurfaceFormat fmt;
39 fmt.setDepthBufferSize(24);
40 fmt.setStencilBufferSize(8);
41 fmt.setVersion(3, 3);
42 fmt.setProfile(QSurfaceFormat::CoreProfile);
43 QSurfaceFormat::setDefaultFormat(fmt);
44
46 uw.show();
47
48 process.start(ultragridExecutable, QStringList());
49 if(process.waitForStarted(1000) == false) {
50 QMessageBox msgBox;
51 msgBox.setText(ultragridExecutable + " doesn't seem to be executable.");
52 msgBox.setInformativeText("Please install uv (UltraGrid binary) to your system "
53 "path or supply a '--with-uv' parameter.\n\n"
54 "Please check also if the binary is executable.");
55 msgBox.setIcon(QMessageBox::Critical);
56 msgBox.exec();
57 return 1;
58 }
59
60 process.waitForFinished();
61
62 if (process.exitStatus() == QProcess::CrashExit || process.exitCode() != 0) {
63 QMessageBox msgBox;
64 msgBox.setText("UltraGrid has crashes when invoked without arguments!");
65 msgBox.setIcon(QMessageBox::Critical);
66 msgBox.exec();
67 return 1;
68 }
69
71 return app.exec();
72}
73
74/* vi: set noexpandtab: */
const char * fmt
static void show_help()
Definition wasapi.cpp:193
static QString findUltragridExecutable()
static const ULWord app
Definition aja.cpp:162