changeset 829:294d76174102

(issue5) Add --version to trustbridge and trustbridge-admin
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 24 Jul 2014 11:41:52 +0200
parents 95e14add5c50
children 344d15e23f6c
files ui/administrator.cpp ui/main.cpp
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 */
--- 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();

http://wald.intevation.org/projects/trustbridge/