From 0d7d53fd46e8ab512bed88d0dab114cfada227ce Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 5 Jun 2013 15:40:10 +0200 Subject: [PATCH] Improve error output when platform plugin cannot be loaded Forgetting to deploy the platform plugin, or deploying it to the wrong folder, is a common mistake. The old error message didn't made it however explicit what was happening. Make the log more verbose, and explicitly state that the missing plugin is the reason for termination. Change-Id: I810a0ef8da5f8e898e7e0c6f853972514a05c75d Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 29a7e87d46b..3c3cea29109 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -782,12 +782,14 @@ static void init_platform(const QString &pluginArgument, const QString &platform QGuiApplicationPrivate::platform_name = new QString(name); } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(const QString &key, keys) { - fatalMessage.append(key + QLatin1Char('\n')); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + QString fatalMessage + = QStringLiteral("Failed to find or load platform plugin \"%1\".\n").arg(name); + if (!keys.isEmpty()) + fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( + keys.join(QStringLiteral(", "))); + fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); + qFatal(qPrintable(fatalMessage)); return; }