Move the --version output text to Theme #5957
authorChristian Kamm <mail@ckamm.de>
Fri, 22 Sep 2017 08:16:26 +0000 (10:16 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 5 Oct 2017 20:01:37 +0000 (22:01 +0200)
Extracted and adjusted from packaging.diff by @jnweiger and @dschmidt

src/cmd/cmd.cpp
src/gui/application.cpp
src/libsync/theme.cpp
src/libsync/theme.h

index b8116b91995f04ce1db5bba48c4f9fb355f5ad3d..79ff7b35d6d22d537c3a1efb923b374b1d902a1b 100644 (file)
@@ -196,8 +196,7 @@ void help()
 
 void showVersion()
 {
-    const char *binaryName = APPLICATION_EXECUTABLE "cmd";
-    std::cout << binaryName << " version " << qPrintable(Theme::instance()->version()) << std::endl;
+    std::cout << qPrintableUtf8(Theme::instance()->versionSwitchOutput());
     exit(0);
 }
 
index 3f58f0bfc33bc46473adad0036ad0a712a9603e1..6896857ec16bf91084dee5b64a8663c334f0fdb3 100644 (file)
@@ -487,18 +487,7 @@ void Application::showHelp()
 
 void Application::showVersion()
 {
-    QString helpText;
-    QTextStream stream(&helpText);
-    stream << _theme->appName().toLatin1().constData()
-           << QLatin1String(" version ")
-           << _theme->version().toLatin1().constData() << endl;
-#ifdef GIT_SHA1
-    stream << "Git revision " << GIT_SHA1 << endl;
-#endif
-    stream << "Using Qt " << qVersion() << ", built against Qt " << QT_VERSION_STR << endl;
-    stream << "Using '" << QSslSocket::sslLibraryVersionString() << "'" << endl;
-
-    displayHelpText(helpText);
+    displayHelpText(Theme::instance()->versionSwitchOutput());
 }
 
 void Application::showHint(std::string errorHint)
index 828bbf45e106c057e74512acd79387414c8a6a42..032a6c7617b0bd06a7725a500702c38a50119f5d 100644 (file)
@@ -505,5 +505,20 @@ QString Theme::oauthClientSecret() const
     return "UBntmLjC2yYCeHwsyj73Uwo9TAaecAetRwMw0xYcvNL9yRdLSUi0hUAHfvCHFeFh";
 }
 
+QString Theme::versionSwitchOutput() const
+{
+    QString helpText;
+    QTextStream stream(&helpText);
+    stream << appName().toLatin1().constData()
+           << QLatin1String(" version ")
+           << version().toLatin1().constData() << endl;
+#ifdef GIT_SHA1
+    stream << "Git revision " << GIT_SHA1 << endl;
+#endif
+    stream << "Using Qt " << qVersion() << ", built against Qt " << QT_VERSION_STR << endl;
+    stream << "Using '" << QSslSocket::sslLibraryVersionString() << "'" << endl;
+    return helpText;
+}
+
 
 } // end namespace client
index bb5c858ae66500d4bd2e82a761c5dafecace12a1..ffc7569b3f12614c856ed707768f12f786095b90 100644 (file)
@@ -327,6 +327,14 @@ public:
     virtual QString oauthClientId() const;
     virtual QString oauthClientSecret() const;
 
+    /**
+     * @brief What should be output for the --version command line switch.
+     *
+     * By default, it's a combination of appName(), version(), the GIT SHA1 and some
+     * important dependency versions.
+     */
+    virtual QString versionSwitchOutput() const;
+
 
 protected:
 #ifndef TOKEN_AUTH_ONLY