diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-01-20 16:02:28 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-01-21 10:28:19 +0100 |
commit | 315fc34f3be55511772ec1c245ec935be61407ba (patch) | |
tree | eb7201188dfde9eda7b7ed1e778fc37696664216 /src/plugins/qmljstools | |
parent | c6d0f497f3ce543f90bf6f3c5fc8f5be43cc3b3b (diff) | |
download | qt-creator-315fc34f3be55511772ec1c245ec935be61407ba.tar.gz |
qmldump: Produce an error message if module import fails.
Reviewed-by: Kai Koehne
Diffstat (limited to 'src/plugins/qmljstools')
-rw-r--r-- | src/plugins/qmljstools/qmljsplugindumper.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index 7c92bad1a5..aca066f1cf 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -121,9 +121,17 @@ static QString qmldumpErrorMessage(const QString &libraryPath, const QString &er return PluginDumper::tr("Type dump of QML plugin in %0 failed.\nErrors:\n%1\n").arg(libraryPath, error); } -static QString qmldumpFailedMessage() +static QString qmldumpFailedMessage(const QString &error) { - return PluginDumper::tr("Type dump of C++ plugin failed.\nCheck 'General Messages' output pane for details."); + QString firstLines = + QStringList(error.split(QLatin1Char('\n')).mid(0, 10)).join(QLatin1String("\n")); + return PluginDumper::tr("Type dump of C++ plugin failed.\n" + "First 10 lines or errors:\n" + "\n" + "%1" + "\n" + "Check 'General Messages' output pane for details." + ).arg(firstLines); } static QList<FakeMetaObject::ConstPtr> parseHelper(const QByteArray &xml, QString *error) @@ -156,8 +164,9 @@ void PluginDumper::qmlPluginTypeDumpDone(int exitCode) if (exitCode != 0) { Core::MessageManager *messageManager = Core::MessageManager::instance(); - messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError())); - libraryInfo.setDumpStatus(LibraryInfo::DumpError, qmldumpFailedMessage()); + const QString errorMessages = process->readAllStandardError(); + messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, errorMessages)); + libraryInfo.setDumpStatus(LibraryInfo::DumpError, qmldumpFailedMessage(errorMessages)); } const QByteArray output = process->readAllStandardOutput(); @@ -188,12 +197,13 @@ void PluginDumper::qmlPluginTypeDumpError(QProcess::ProcessError) const QString libraryPath = m_runningQmldumps.take(process); Core::MessageManager *messageManager = Core::MessageManager::instance(); - messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError())); + const QString errorMessages = process->readAllStandardError(); + messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, errorMessages)); if (!libraryPath.isEmpty()) { const Snapshot snapshot = m_modelManager->snapshot(); LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath); - libraryInfo.setDumpStatus(LibraryInfo::DumpError, qmldumpFailedMessage()); + libraryInfo.setDumpStatus(LibraryInfo::DumpError, qmldumpFailedMessage(errorMessages)); m_modelManager->updateLibraryInfo(libraryPath, libraryInfo); } } |