QMlProfiler: Print logging / errors while connecting to General Messages pane

Actually the error message should ideally show up in Application Output, but
that would require a translation. Left for 2.4.

Change-Id: Ia13dc46bf82f28862ac38e830b241f4b23f83fa2
Reviewed-on: http://codereview.qt.nokia.com/2267
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
Kai Koehne
2011-07-27 11:49:39 +02:00
parent 9843151734
commit 116b4efe5f
2 changed files with 23 additions and 12 deletions

View File

@@ -64,6 +64,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
@@ -363,14 +364,10 @@ void QmlProfilerTool::connectToClient()
return;
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
if (QmlProfilerPlugin::debugOutput)
qWarning("QML Profiler: Connecting to %s:%lld ...", qPrintable(d->m_tcpHost), d->m_tcpPort);
logStatus(QString("QML Profiler: Connecting to %1:%2 ...").arg(d->m_tcpHost, QString::number(d->m_tcpPort)));
d->m_client->connectToHost(d->m_tcpHost, d->m_tcpPort);
} else {
if (QmlProfilerPlugin::debugOutput)
qWarning("QML Profiler: Connecting to ost device %s...", qPrintable(d->m_ostDevice));
logStatus(QString("QML Profiler: Connecting to %1 ...").arg(d->m_tcpHost));
d->m_client->connectToOst(d->m_ostDevice);
}
}
@@ -501,12 +498,11 @@ void QmlProfilerTool::tryToConnect()
} else if (d->m_connectionAttempts == 50) {
d->m_connectionTimer.stop();
d->m_connectionAttempts = 0;
if (QmlProfilerPlugin::debugOutput) {
if (d->m_client) {
qWarning("QML Profiler: Failed to connect: %s", qPrintable(d->m_client->errorString()));
} else {
qWarning("QML Profiler: Failed to connect.");
}
if (d->m_client) {
logError("QML Profiler: Failed to connect! " + d->m_client->errorString());
} else {
logError("QML Profiler: Failed to connect!");
}
emit connectionFailed();
} else {
@@ -575,3 +571,16 @@ void QmlProfilerTool::startTool(StartMode mode)
Project *pro = pe->startupProject();
pe->runProject(pro, id());
}
void QmlProfilerTool::logStatus(const QString &msg)
{
Core::MessageManager *messageManager = Core::MessageManager::instance();
messageManager->printToOutputPane(msg, false);
}
void QmlProfilerTool::logError(const QString &msg)
{
// TODO: Rather show errors in the application ouput
Core::MessageManager *messageManager = Core::MessageManager::instance();
messageManager->printToOutputPane(msg, true);
}