Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-04-26 11:59:17 +0300
committerHannah von Reth <vonreth@kde.org>2021-04-26 12:20:45 +0300
commit3cfd49a7c9585114a228c882e12554298fabd8a7 (patch)
tree6cb7dcfdf1c521e2444d502f202ed5c4bf10d606 /src/gui/application.cpp
parentf77a043b8cb8de578d228b7c485b659705af44dd (diff)
Display command line argument hints on in Windows popup
Diffstat (limited to 'src/gui/application.cpp')
-rw-r--r--src/gui/application.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 405ce67e0..de71d8875 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -618,20 +618,21 @@ void Application::parseOptions(const QStringList &options)
// virtual file, open it after the Folder were created (if the app is not terminated)
QTimer::singleShot(0, this, [this, option] { openVirtualFile(option); });
} else {
- showHint("Unrecognized option '" + option.toStdString() + "'");
+ showHint(QStringLiteral("Unrecognized option '%1'").arg(option));
}
}
}
// Helpers for displaying messages. Note that there is probably no console on Windows.
-static void displayHelpText(const QString &t)
+static void displayHelpText(const QString &t, std::ostream &stream = std::cout)
{
- std::cout << qUtf8Printable(t) << std::endl;
+ Logger::instance()->attacheToConsole();
+ stream << qUtf8Printable(t) << std::endl;
#ifdef Q_OS_WIN
// No console on Windows.
QString spaces(80, ' '); // Add a line of non-wrapped space to make the messagebox wide enough.
- QString text = QLatin1String("<qt><pre style='white-space:pre-wrap'>")
- + t.toHtmlEscaped() + QLatin1String("</pre><pre>") + spaces + QLatin1String("</pre></qt>");
+ QString text = QStringLiteral("<qt><pre style='white-space:pre-wrap'>")
+ + t.toHtmlEscaped() + QStringLiteral("</pre><pre>") + spaces + QStringLiteral("</pre></qt>");
QMessageBox::information(0, Theme::instance()->appNameGUI(), text);
#endif
}
@@ -663,11 +664,13 @@ void Application::showVersion()
displayHelpText(Theme::instance()->versionSwitchOutput());
}
-void Application::showHint(std::string errorHint)
+void Application::showHint(const QString &errorHint)
{
- static QString binName = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
- std::cerr << errorHint << std::endl;
- std::cerr << "Try '" << binName.toStdString() << " --help' for more information" << std::endl;
+ QString out;
+ QTextStream hint(&out);
+ hint << errorHint << endl
+ << "Try '" << QFileInfo(QCoreApplication::applicationFilePath()).fileName() << " --help' for more information" << endl;
+ displayHelpText(out, std::cerr);
std::exit(1);
}