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 @@
#include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qmlobservertool.h>
#include <qt4projectmanager/qtoutputformatter.h>
#include <QFormLayout>
#include <QComboBox>
......@@ -258,6 +259,10 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
return detailsWidget;
}
ProjectExplorer::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
{
return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject());
}
QString QmlProjectRunConfiguration::mainScript() const
{
......
......@@ -83,6 +83,8 @@ public:
// RunConfiguration
virtual QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const;
QVariantMap toMap() const;
public slots:
......
......@@ -39,7 +39,7 @@
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
QtOutputFormatter::QtOutputFormatter(Qt4Project *project)
QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project)
: OutputFormatter()
, m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):"))
, m_qtError(QLatin1String("Object::.*in (.*:\\d+)"))
......@@ -210,7 +210,7 @@ void QtOutputFormatter::handleLink(const QString &href)
QFileInfo fi(fileName);
if (fi.isRelative()) {
// Yeah fileName is relative, no suprise
Qt4Project *pro = m_project.data();
ProjectExplorer::Project *pro = m_project.data();
if (pro) {
QString baseName = fi.fileName();
foreach (const QString &file, pro->files(Project::AllFiles)) {
......
......@@ -27,17 +27,22 @@
**
**************************************************************************/
#ifndef QMLOUTPUTFORMATTER_H
#define QMLOUTPUTFORMATTER_H
#ifndef QTOUTPUTFORMATTER_H
#define QTOUTPUTFORMATTER_H
#include "qt4projectmanager_global.h"
#include <projectexplorer/outputformatter.h>
#include <QtCore/QRegExp>
#include <QtCore/QSharedPointer>
#include <QtGui/QTextCharFormat>
namespace ProjectExplorer {
class Project;
} // namespace ProjectExplorer
namespace Qt4ProjectManager
{
class Qt4Project;
struct LinkResult
{
......@@ -46,10 +51,10 @@ struct LinkResult
QString href;
};
class QtOutputFormatter: public ProjectExplorer::OutputFormatter
class QT4PROJECTMANAGER_EXPORT QtOutputFormatter: public ProjectExplorer::OutputFormatter
{
public:
QtOutputFormatter(Qt4Project *project);
QtOutputFormatter(ProjectExplorer::Project *project);
virtual void appendApplicationOutput(const QString &text, bool onStdErr);
......@@ -63,13 +68,13 @@ private:
QRegExp m_qtError;
QRegExp m_qtAssert;
QRegExp m_qtTestFail;
QWeakPointer<Qt4Project> m_project;
QWeakPointer<ProjectExplorer::Project> m_project;
QTextCharFormat m_linkFormat;
QString m_lastLine;
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