summaryrefslogtreecommitdiffstats
path: root/src/pvsmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pvsmgr.cpp')
-rw-r--r--src/pvsmgr.cpp76
1 files changed, 67 insertions, 9 deletions
diff --git a/src/pvsmgr.cpp b/src/pvsmgr.cpp
index f543c6d..b9e53f3 100644
--- a/src/pvsmgr.cpp
+++ b/src/pvsmgr.cpp
@@ -16,15 +16,73 @@
#include <QtGui>
#include <QtGui/QDesktopServices>
+#include <getopt.h>
#include "gui/mainWindow.h"
#include "util/consoleLogger.h"
#include "util/CertManager.h"
#include "src/input/i18n.h"
+#include "version.h"
QApplication *qtApp;
+void printHelp()
+{
+ QTextStream qout(stdout);
+ qout << QObject::tr("Usage: pvsmgr/pvsmgrtouch [OPTIONS]...") << endl;
+ qout << QObject::tr("Start the Pool Video Switch Manager.") << endl;
+ qout << QObject::tr("Options:") << endl << endl;
+ qout << "-f or --fullscreen" << "\t" << QObject::tr("Start in fullscreen mode.") << endl;
+ qout << "-h or --help" << "\t\t" << QObject::tr("Show this help text and quit.") << endl;
+ qout << "-v or --version" << "\t\t" << QObject::tr("Show version and quit.") << endl;
+ qout << endl;
+ qout.flush();
+ exit(0);
+}
+
+void printVersion()
+{
+ QTextStream qout(stdout);
+ qout << QObject::tr("Version: ") << VERSION_STRING << endl;
+ qout << endl;
+ qout.flush();
+ exit(0);
+}
+
int main(int argc, char** argv)
{
+ bool fullscreen = false;
+
+ // parse command line arguments
+ int opt = 0;
+ int longIndex = 0;
+ static const char *optString = "hvf?";
+ static const struct option longOpts[] =
+ {
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
+ { "fullscreen", no_argument, NULL, 'f' }
+ };
+
+ opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
+ while( opt != -1 )
+ {
+ switch( opt )
+ {
+ case 'h':
+ printHelp();
+ break;
+ case 'v':
+ printVersion();
+ break;
+ case 'f':
+ fullscreen = true;
+ break;
+ case '?':
+ exit(1);
+ }
+ opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
+ }
+
//system("openssl genrsa 1024 >~/.pvs/");
qtApp = new QApplication(argc, argv);
qtApp->setOrganizationName("openslx");
@@ -42,15 +100,15 @@ int main(int argc, char** argv)
ConsoleLog writeLine(QString("PVS-Server started."));
QSslKey k = CertManager::getPrivateKey("manager"); // preload key so the gui won't hang later
- /*
- if (k.isNull())
- {
- printf("FATAL: Private key could not be generated or loaded!\n");
- exit(123);
- }
- */
- MainWindow w;
- w.show();
+
+ MainWindow *w;
+ if (fullscreen)
+ w = new MainWindow(0, Qt::FramelessWindowHint);
+ else
+ w = new MainWindow();
+
+ w->show();
+
return qtApp->exec();
}