Commit 50ab71bb authored by Erik Verbruggen's avatar Erik Verbruggen

QML: use Qt4 output formatter to get links in errors to work.

Reviewed-by: Tobias Hunger
parent b5bb0ace
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <qt4projectmanager/qtversionmanager.h> #include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qmlobservertool.h> #include <qt4projectmanager/qmlobservertool.h>
#include <qt4projectmanager/qtoutputformatter.h>
#include <QFormLayout> #include <QFormLayout>
#include <QComboBox> #include <QComboBox>
...@@ -258,6 +259,10 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget() ...@@ -258,6 +259,10 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
return detailsWidget; return detailsWidget;
} }
ProjectExplorer::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
{
return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject());
}
QString QmlProjectRunConfiguration::mainScript() const QString QmlProjectRunConfiguration::mainScript() const
{ {
......
...@@ -83,6 +83,8 @@ public: ...@@ -83,6 +83,8 @@ public:
// RunConfiguration // RunConfiguration
virtual QWidget *createConfigurationWidget(); virtual QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const;
QVariantMap toMap() const; QVariantMap toMap() const;
public slots: public slots:
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
QtOutputFormatter::QtOutputFormatter(Qt4Project *project) QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project)
: OutputFormatter() : OutputFormatter()
, m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):")) , m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):"))
, m_qtError(QLatin1String("Object::.*in (.*:\\d+)")) , m_qtError(QLatin1String("Object::.*in (.*:\\d+)"))
...@@ -210,7 +210,7 @@ void QtOutputFormatter::handleLink(const QString &href) ...@@ -210,7 +210,7 @@ void QtOutputFormatter::handleLink(const QString &href)
QFileInfo fi(fileName); QFileInfo fi(fileName);
if (fi.isRelative()) { if (fi.isRelative()) {
// Yeah fileName is relative, no suprise // Yeah fileName is relative, no suprise
Qt4Project *pro = m_project.data(); ProjectExplorer::Project *pro = m_project.data();
if (pro) { if (pro) {
QString baseName = fi.fileName(); QString baseName = fi.fileName();
foreach (const QString &file, pro->files(Project::AllFiles)) { foreach (const QString &file, pro->files(Project::AllFiles)) {
......
...@@ -27,17 +27,22 @@ ...@@ -27,17 +27,22 @@
** **
**************************************************************************/ **************************************************************************/
#ifndef QMLOUTPUTFORMATTER_H #ifndef QTOUTPUTFORMATTER_H
#define QMLOUTPUTFORMATTER_H #define QTOUTPUTFORMATTER_H
#include "qt4projectmanager_global.h"
#include <projectexplorer/outputformatter.h> #include <projectexplorer/outputformatter.h>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
#include <QtGui/QTextCharFormat> #include <QtGui/QTextCharFormat>
namespace ProjectExplorer {
class Project;
} // namespace ProjectExplorer
namespace Qt4ProjectManager namespace Qt4ProjectManager
{ {
class Qt4Project;
struct LinkResult struct LinkResult
{ {
...@@ -46,10 +51,10 @@ struct LinkResult ...@@ -46,10 +51,10 @@ struct LinkResult
QString href; QString href;
}; };
class QtOutputFormatter: public ProjectExplorer::OutputFormatter class QT4PROJECTMANAGER_EXPORT QtOutputFormatter: public ProjectExplorer::OutputFormatter
{ {
public: public:
QtOutputFormatter(Qt4Project *project); QtOutputFormatter(ProjectExplorer::Project *project);
virtual void appendApplicationOutput(const QString &text, bool onStdErr); virtual void appendApplicationOutput(const QString &text, bool onStdErr);
...@@ -63,13 +68,13 @@ private: ...@@ -63,13 +68,13 @@ private:
QRegExp m_qtError; QRegExp m_qtError;
QRegExp m_qtAssert; QRegExp m_qtAssert;
QRegExp m_qtTestFail; QRegExp m_qtTestFail;
QWeakPointer<Qt4Project> m_project; QWeakPointer<ProjectExplorer::Project> m_project;
QTextCharFormat m_linkFormat; QTextCharFormat m_linkFormat;
QString m_lastLine; QString m_lastLine;
QString m_deferedText; QString m_deferedText;
}; };
} // namespace QmlProjectManager } // namespace Qt4ProjectManager
#endif // QMLOUTPUTFORMATTER_H #endif // QTOUTPUTFORMATTER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment