diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index fc574c00e..5ca2afe68 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -1459,9 +1459,10 @@ namespace BlackCore Q_UNREACHABLE(); } - void CApplication::cmdLineVersionMessage() const + void CApplication::cmdLineVersionMessage() { - printf("%s %s\n", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion())); + m_parser.showVersion(); // terminates + Q_UNREACHABLE(); } QStringList CApplication::argumentsJoined(const QStringList &newArguments, const QStringList &removeArguments) const diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 4726bca0c..37d51999b 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -595,12 +595,6 @@ namespace BlackCore //! Init class, allows to init from BlackGui::CGuiApplication as well (pseudo virtual) void init(bool withMetadata); - //! Display help message - virtual void cmdLineHelpMessage(); - - //! Display version message - virtual void cmdLineVersionMessage() const; - //! Is the command line option represented in the given arguments? static int indexOfCommandLineOption(const QCommandLineOption &option, const QStringList &args = CApplication::arguments()); @@ -660,6 +654,12 @@ namespace BlackCore //! Read the setup BlackMisc::CStatusMessageList loadSetup(); + //! Display help message + void cmdLineHelpMessage(); + + //! Display version message + void cmdLineVersionMessage(); + //! Problem with network access manager void onChangedNetworkAccessibility(QNetworkAccessManager::NetworkAccessibility accessible); diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index cd049bdd5..c1b300a34 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -469,52 +469,6 @@ namespace BlackGui } } - QString CGuiApplication::beautifyHelpMessage(const QString &helpText) - { - // just formatting Qt help message into HTML table - if (helpText.isEmpty()) { return {}; } - const QStringList lines(helpText.split('\n')); - QString html; - bool tableMode = false; - bool pendingTr = false; - for (const QString &l : lines) - { - QString lt(l.trimmed()); - if (!tableMode && lt.startsWith("-")) - { - tableMode = true; - html += "
| "; - thread_local const QRegularExpression reg("[ ]{2,}"); - html += lt.replace(reg, " | "); - pendingTr = true; - } - else - { - html += " "; - html += l.simplified().toHtmlEscaped(); - } - } - } - html += " |