[PATCH 2 of 2] (issue5) Add --version to trustbridge and trustbridge-admin

Wald Commits scm-commit at wald.intevation.org
Thu Jul 24 11:41:56 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1406194912 -7200
# Node ID 294d76174102ad6ff1ff83c6de4a77164a718cad
# Parent  95e14add5c50b72504027f8cfd4084ccb881cb51
(issue5) Add --version to trustbridge and trustbridge-admin

diff -r 95e14add5c50 -r 294d76174102 ui/administrator.cpp
--- a/ui/administrator.cpp	Thu Jul 24 11:41:17 2014 +0200
+++ b/ui/administrator.cpp	Thu Jul 24 11:41:52 2014 +0200
@@ -26,6 +26,11 @@
 #define ORGANIZATION "BSI"
 #endif
 
+#define COPYRIGHT "Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik \n" \
+                  "Software engineering by Intevation GmbH \n\n" \
+                  "This file is Free Software under the GNU GPL (v>=2)\n" \
+                  "and comes with ABSOLUTELY NO WARRANTY!\n"
+
 #ifdef Q_OS_WIN
  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 #else
@@ -43,6 +48,13 @@
     QApplication::setApplicationVersion(QString::fromLatin1(VERSION));
     QSettings::setDefaultFormat(QSettings::IniFormat);
 
+    if (QApplication::arguments().contains("--version")) {
+        printf (APPNAME " Version: %s \n",
+                QApplication::applicationVersion().toLocal8Bit().constData());
+        printf (COPYRIGHT);
+        return 0;
+    }
+
     QTranslator translator;
     if (QLocale::system().name() == "C") {
         /* Useful for testing / development as the primary target is german */
diff -r 95e14add5c50 -r 294d76174102 ui/main.cpp
--- a/ui/main.cpp	Thu Jul 24 11:41:17 2014 +0200
+++ b/ui/main.cpp	Thu Jul 24 11:41:52 2014 +0200
@@ -35,6 +35,11 @@
 #define ORGANIZATION "BSI"
 #endif
 
+#define COPYRIGHT "Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik \n" \
+                  "Software engineering by Intevation GmbH \n\n" \
+                  "This file is Free Software under the GNU GPL (v>=2)\n" \
+                  "and comes with ABSOLUTELY NO WARRANTY!\n"
+
 #ifdef Q_OS_WIN
  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 #else
@@ -65,6 +70,13 @@
     QStringList arguments = QApplication::arguments();
     bool trayMode = arguments.contains("--tray");
 
+    if (arguments.contains("--version")) {
+        printf (APPNAME " Version: %s \n",
+                QApplication::applicationVersion().toLocal8Bit().constData());
+        printf (COPYRIGHT);
+        return 0;
+    }
+
     QSettings settings;
     settings.beginGroup("settings");
     bool autoStart = settings.value("autostart", true).toBool();


More information about the Trustbridge-commits mailing list