Move the --version output text to Theme #5957

Extracted and adjusted from packaging.diff by @jnweiger and @dschmidt
This commit is contained in:
Christian Kamm 2017-09-22 10:16:26 +02:00 committed by ckamm
parent 706c68f69c
commit 844bfc5f25
4 changed files with 25 additions and 14 deletions

View 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);
}

View 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)

View 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

View 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