Move OutputFormatter to Utils lib.

This commit is contained in:
con
2011-04-15 12:59:44 +02:00
parent 28c92cf044
commit 2cf76ead26
38 changed files with 168 additions and 148 deletions

View File

@@ -33,7 +33,7 @@
#ifndef OUTPUTFORMAT_H #ifndef OUTPUTFORMAT_H
#define OUTPUTFORMAT_H #define OUTPUTFORMAT_H
namespace ProjectExplorer { namespace Utils {
enum OutputFormat enum OutputFormat
{ {
@@ -46,6 +46,6 @@ enum OutputFormat
NumberOfFormats // Keep this entry last. NumberOfFormats // Keep this entry last.
}; };
} // namespace ProjectExplorer } // namespace Utils
#endif // OUTPUTFORMATR_H #endif // OUTPUTFORMATR_H

View File

@@ -32,19 +32,16 @@
#include "outputformatter.h" #include "outputformatter.h"
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
#include <QtGui/QPlainTextEdit> #include <QtGui/QPlainTextEdit>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtCore/QString> #include <QtCore/QString>
using namespace ProjectExplorer; using namespace Utils;
using namespace TextEditor;
OutputFormatter::OutputFormatter() OutputFormatter::OutputFormatter()
: QObject() : QObject()
, m_plainTextEdit(0)
, m_formats(0) , m_formats(0)
{ {
@@ -94,11 +91,11 @@ QColor OutputFormatter::mixColors(const QColor &a, const QColor &b)
void OutputFormatter::initFormats() void OutputFormatter::initFormats()
{ {
if (!plainTextEdit())
return;
QPalette p = plainTextEdit()->palette(); QPalette p = plainTextEdit()->palette();
FontSettings fs = TextEditorSettings::instance()->fontSettings(); QFont boldFont = m_font;
QFont font = fs.font();
QFont boldFont = font;
boldFont.setBold(true); boldFont.setBold(true);
m_formats = new QTextCharFormat[NumberOfFormats]; m_formats = new QTextCharFormat[NumberOfFormats];
@@ -112,12 +109,12 @@ void OutputFormatter::initFormats()
m_formats[ErrorMessageFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red))); m_formats[ErrorMessageFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red)));
// StdOutFormat // StdOutFormat
m_formats[StdOutFormat].setFont(font); m_formats[StdOutFormat].setFont(m_font);
m_formats[StdOutFormat].setForeground(p.color(QPalette::Text)); m_formats[StdOutFormat].setForeground(p.color(QPalette::Text));
m_formats[StdOutFormatSameLine] = m_formats[StdOutFormat]; m_formats[StdOutFormatSameLine] = m_formats[StdOutFormat];
// StdErrFormat // StdErrFormat
m_formats[StdErrFormat].setFont(font); m_formats[StdErrFormat].setFont(m_font);
m_formats[StdErrFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red))); m_formats[StdErrFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red)));
m_formats[StdErrFormatSameLine] = m_formats[StdErrFormat]; m_formats[StdErrFormatSameLine] = m_formats[StdErrFormat];
} }
@@ -126,3 +123,14 @@ void OutputFormatter::handleLink(const QString &href)
{ {
Q_UNUSED(href); Q_UNUSED(href);
} }
QFont OutputFormatter::font() const
{
return m_font;
}
void OutputFormatter::setFont(const QFont &font)
{
m_font = font;
initFormats();
}

View File

@@ -33,10 +33,11 @@
#ifndef OUTPUTFORMATTER_H #ifndef OUTPUTFORMATTER_H
#define OUTPUTFORMATTER_H #define OUTPUTFORMATTER_H
#include "projectexplorer_export.h" #include "utils_global.h"
#include "outputformat.h" #include "outputformat.h"
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtGui/QFont>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QPlainTextEdit; class QPlainTextEdit;
@@ -44,9 +45,9 @@ class QTextCharFormat;
class QColor; class QColor;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace ProjectExplorer { namespace Utils {
class PROJECTEXPLORER_EXPORT OutputFormatter : public QObject class QTCREATOR_UTILS_EXPORT OutputFormatter : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -57,6 +58,9 @@ public:
QPlainTextEdit *plainTextEdit() const; QPlainTextEdit *plainTextEdit() const;
void setPlainTextEdit(QPlainTextEdit *plainText); void setPlainTextEdit(QPlainTextEdit *plainText);
QFont font() const;
void setFont(const QFont &font);
virtual void appendMessage(const QString &text, OutputFormat format); virtual void appendMessage(const QString &text, OutputFormat format);
virtual void handleLink(const QString &href); virtual void handleLink(const QString &href);
@@ -70,8 +74,9 @@ protected:
private: private:
QPlainTextEdit *m_plainTextEdit; QPlainTextEdit *m_plainTextEdit;
QTextCharFormat *m_formats; QTextCharFormat *m_formats;
QFont m_font;
}; };
} // namespace ProjectExplorer } // namespace Utils
#endif // OUTPUTFORMATTER_H #endif // OUTPUTFORMATTER_H

View File

@@ -81,7 +81,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/ssh/sftpdefs.cpp \ $$PWD/ssh/sftpdefs.cpp \
$$PWD/ssh/sftpchannel.cpp \ $$PWD/ssh/sftpchannel.cpp \
$$PWD/ssh/sshremoteprocessrunner.cpp \ $$PWD/ssh/sshremoteprocessrunner.cpp \
$$PWD/ssh/sshconnectionmanager.cpp $$PWD/ssh/sshconnectionmanager.cpp \
$$PWD/outputformatter.cpp
win32 { win32 {
SOURCES += $$PWD/abstractprocess_win.cpp \ SOURCES += $$PWD/abstractprocess_win.cpp \
@@ -179,7 +180,9 @@ HEADERS += $$PWD/environment.h \
$$PWD/ssh/sshremoteprocessrunner.h \ $$PWD/ssh/sshremoteprocessrunner.h \
$$PWD/ssh/sshconnectionmanager.h \ $$PWD/ssh/sshconnectionmanager.h \
$$PWD/ssh/sshpseudoterminal.h \ $$PWD/ssh/sshpseudoterminal.h \
$$PWD/statuslabel.h $$PWD/statuslabel.h \
$$PWD/outputformatter.h \
$$PWD/outputformat.h
FORMS += $$PWD/filewizardpage.ui \ FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \ $$PWD/projectintropage.ui \

View File

@@ -142,12 +142,12 @@ QIcon AnalyzerRunControl::icon() const
void AnalyzerRunControl::receiveStandardOutput(const QString &text) void AnalyzerRunControl::receiveStandardOutput(const QString &text)
{ {
appendMessage(text, ProjectExplorer::StdOutFormat); appendMessage(text, Utils::StdOutFormat);
} }
void AnalyzerRunControl::receiveStandardError(const QString &text) void AnalyzerRunControl::receiveStandardError(const QString &text)
{ {
appendMessage(text, ProjectExplorer::StdErrFormat); appendMessage(text, Utils::StdErrFormat);
} }
void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description, void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,

View File

@@ -55,10 +55,10 @@
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/outputformat.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication* #include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication*
#include <utils/outputformat.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fancymainwindow.h> #include <utils/fancymainwindow.h>
@@ -241,7 +241,7 @@ void DebuggerRunControl::start()
// User canceled input dialog asking for executable when working on library project. // User canceled input dialog asking for executable when working on library project.
if (d->m_engine->startParameters().startMode == StartInternal if (d->m_engine->startParameters().startMode == StartInternal
&& d->m_engine->startParameters().executable.isEmpty()) { && d->m_engine->startParameters().executable.isEmpty()) {
appendMessage(tr("No executable specified.\n"), ErrorMessageFormat); appendMessage(tr("No executable specified.\n"), Utils::ErrorMessageFormat);
emit started(); emit started();
emit finished(); emit finished();
return; return;
@@ -257,12 +257,12 @@ void DebuggerRunControl::start()
d->m_engine->startDebugger(this); d->m_engine->startDebugger(this);
if (d->m_running) if (d->m_running)
appendMessage(tr("Debugging starts\n"), NormalMessageFormat); appendMessage(tr("Debugging starts\n"), Utils::NormalMessageFormat);
} }
void DebuggerRunControl::startFailed() void DebuggerRunControl::startFailed()
{ {
appendMessage(tr("Debugging has failed\n"), NormalMessageFormat); appendMessage(tr("Debugging has failed\n"), Utils::NormalMessageFormat);
d->m_running = false; d->m_running = false;
emit finished(); emit finished();
d->m_engine->handleStartFailed(); d->m_engine->handleStartFailed();
@@ -270,7 +270,7 @@ void DebuggerRunControl::startFailed()
void DebuggerRunControl::handleFinished() void DebuggerRunControl::handleFinished()
{ {
appendMessage(tr("Debugging has finished\n"), NormalMessageFormat); appendMessage(tr("Debugging has finished\n"), Utils::NormalMessageFormat);
if (d->m_engine) if (d->m_engine)
d->m_engine->handleFinished(); d->m_engine->handleFinished();
debuggerCore()->runControlFinished(d->m_engine); debuggerCore()->runControlFinished(d->m_engine);
@@ -280,13 +280,13 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
{ {
switch (channel) { switch (channel) {
case AppOutput: case AppOutput:
appendMessage(msg, StdOutFormatSameLine); appendMessage(msg, Utils::StdOutFormatSameLine);
break; break;
case AppError: case AppError:
appendMessage(msg, StdErrFormatSameLine); appendMessage(msg, Utils::StdErrFormatSameLine);
break; break;
case AppStuff: case AppStuff:
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
break; break;
} }
} }

View File

@@ -200,8 +200,8 @@ void QmlEngine::setupInferior()
SIGNAL(processExited(int)), SIGNAL(processExited(int)),
SLOT(disconnected())); SLOT(disconnected()));
connect(&d->m_applicationLauncher, connect(&d->m_applicationLauncher,
SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)), SIGNAL(appendMessage(QString,Utils::OutputFormat)),
SLOT(appendMessage(QString,ProjectExplorer::OutputFormat))); SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(&d->m_applicationLauncher, connect(&d->m_applicationLauncher,
SIGNAL(bringToForegroundRequested(qint64)), SIGNAL(bringToForegroundRequested(qint64)),
runControl(), runControl(),
@@ -214,7 +214,7 @@ void QmlEngine::setupInferior()
} }
} }
void QmlEngine::appendMessage(const QString &msg, OutputFormat /* format */) void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
{ {
showMessage(msg, AppOutput); // FIXME: Redirect to RunControl showMessage(msg, AppOutput); // FIXME: Redirect to RunControl
} }
@@ -392,7 +392,7 @@ void QmlEngine::startApplicationLauncher()
QDir::toNativeSeparators(startParameters().executable), QDir::toNativeSeparators(startParameters().executable),
startParameters().processArgs) startParameters().processArgs)
+ QLatin1Char('\n') + QLatin1Char('\n')
, NormalMessageFormat); , Utils::NormalMessageFormat);
d->m_applicationLauncher.start(ApplicationLauncher::Gui, d->m_applicationLauncher.start(ApplicationLauncher::Gui,
startParameters().executable, startParameters().executable,
startParameters().processArgs); startParameters().processArgs);

View File

@@ -35,7 +35,7 @@
#include "debuggerengine.h" #include "debuggerengine.h"
#include <projectexplorer/outputformat.h> #include <utils/outputformat.h>
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
#include <QtNetwork/QAbstractSocket> #include <QtNetwork/QAbstractSocket>
@@ -130,7 +130,7 @@ private slots:
void connectionStartupFailed(); void connectionStartupFailed();
void connectionError(QAbstractSocket::SocketError error); void connectionError(QAbstractSocket::SocketError error);
void serviceConnectionError(const QString &service); void serviceConnectionError(const QString &service);
void appendMessage(const QString &msg, ProjectExplorer::OutputFormat); void appendMessage(const QString &msg, Utils::OutputFormat);
void synchronizeWatchers(); void synchronizeWatchers();

View File

@@ -34,7 +34,8 @@
#define APPLICATIONLAUNCHER_H #define APPLICATIONLAUNCHER_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "outputformat.h"
#include <utils/outputformat.h>
#include <QtCore/QProcess> #include <QtCore/QProcess>
@@ -69,7 +70,7 @@ public:
qint64 applicationPID() const; qint64 applicationPID() const;
signals: signals:
void appendMessage(const QString &message, ProjectExplorer::OutputFormat format); void appendMessage(const QString &message, Utils::OutputFormat format);
void processExited(int exitCode); void processExited(int exitCode);
void bringToForegroundRequested(qint64 pid); void bringToForegroundRequested(qint64 pid);

View File

@@ -132,13 +132,13 @@ qint64 ApplicationLauncher::applicationPID() const
void ApplicationLauncher::appendProcessMessage(const QString &output, bool onStdErr) void ApplicationLauncher::appendProcessMessage(const QString &output, bool onStdErr)
{ {
emit appendMessage(output, onStdErr ? ErrorMessageFormat : NormalMessageFormat); emit appendMessage(output, onStdErr ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
} }
void ApplicationLauncher::readWinDebugOutput(const QString &output, void ApplicationLauncher::readWinDebugOutput(const QString &output,
bool onStdErr) bool onStdErr)
{ {
emit appendMessage(output, onStdErr ? StdErrFormat : StdOutFormat); emit appendMessage(output, onStdErr ? Utils::StdErrFormat : Utils::StdOutFormat);
} }
void ApplicationLauncher::processStopped() void ApplicationLauncher::processStopped()

View File

@@ -99,7 +99,7 @@ ApplicationLauncher::~ApplicationLauncher()
void ApplicationLauncher::appendProcessMessage(const QString &output, bool onStdErr) void ApplicationLauncher::appendProcessMessage(const QString &output, bool onStdErr)
{ {
emit appendMessage(output, onStdErr ? ErrorMessageFormat : NormalMessageFormat); emit appendMessage(output, onStdErr ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
} }
void ApplicationLauncher::setWorkingDirectory(const QString &dir) void ApplicationLauncher::setWorkingDirectory(const QString &dir)
@@ -176,7 +176,7 @@ void ApplicationLauncher::guiProcessError()
default: default:
error = tr("Some error has occurred while running the program."); error = tr("Some error has occurred while running the program.");
} }
emit appendMessage(error + QLatin1Char('\n'), ErrorMessageFormat); emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat);
emit processExited(d->m_guiProcess.exitCode()); emit processExited(d->m_guiProcess.exitCode());
} }
@@ -185,7 +185,7 @@ void ApplicationLauncher::readStandardOutput()
QByteArray data = d->m_guiProcess.readAllStandardOutput(); QByteArray data = d->m_guiProcess.readAllStandardOutput();
QString msg = d->m_outputCodec->toUnicode( QString msg = d->m_outputCodec->toUnicode(
data.constData(), data.length(), &d->m_outputCodecState); data.constData(), data.length(), &d->m_outputCodecState);
emit appendMessage(msg, StdOutFormatSameLine); emit appendMessage(msg, Utils::StdOutFormatSameLine);
} }
void ApplicationLauncher::readStandardError() void ApplicationLauncher::readStandardError()
@@ -193,7 +193,7 @@ void ApplicationLauncher::readStandardError()
QByteArray data = d->m_guiProcess.readAllStandardError(); QByteArray data = d->m_guiProcess.readAllStandardError();
QString msg = d->m_outputCodec->toUnicode( QString msg = d->m_outputCodec->toUnicode(
data.constData(), data.length(), &d->m_outputCodecState); data.constData(), data.length(), &d->m_outputCodecState);
emit appendMessage(msg, StdErrFormatSameLine); emit appendMessage(msg, Utils::StdErrFormatSameLine);
} }
void ApplicationLauncher::processStopped() void ApplicationLauncher::processStopped()

View File

@@ -89,8 +89,8 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig
m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode()); m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
m_commandLineArguments = rc->commandLineArguments(); m_commandLineArguments = rc->commandLineArguments();
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
this, SLOT(slotAppendMessage(QString,ProjectExplorer::OutputFormat))); this, SLOT(slotAppendMessage(QString,Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -105,12 +105,12 @@ void LocalApplicationRunControl::start()
{ {
emit started(); emit started();
if (m_executable.isEmpty()) { if (m_executable.isEmpty()) {
appendMessage(tr("No executable specified.\n"), ErrorMessageFormat); appendMessage(tr("No executable specified.\n"), Utils::ErrorMessageFormat);
emit finished(); emit finished();
} else { } else {
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
} }
} }
@@ -131,7 +131,7 @@ QIcon LocalApplicationRunControl::icon() const
} }
void LocalApplicationRunControl::slotAppendMessage(const QString &err, void LocalApplicationRunControl::slotAppendMessage(const QString &err,
OutputFormat format) Utils::OutputFormat format)
{ {
appendMessage(err, format); appendMessage(err, format);
} }
@@ -140,7 +140,7 @@ void LocalApplicationRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2\n") QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
emit finished(); emit finished();
} }

View File

@@ -65,7 +65,7 @@ public:
virtual QIcon icon() const; virtual QIcon icon() const;
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotAppendMessage(const QString &err, ProjectExplorer::OutputFormat isError); void slotAppendMessage(const QString &err, Utils::OutputFormat isError);
private: private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher; ProjectExplorer::ApplicationLauncher m_applicationLauncher;
QString m_executable; QString m_executable;

View File

@@ -36,7 +36,6 @@
#include "projectexplorersettings.h" #include "projectexplorersettings.h"
#include "runconfiguration.h" #include "runconfiguration.h"
#include "session.h" #include "session.h"
#include "outputformatter.h"
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
@@ -47,10 +46,15 @@
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <find/basetextfind.h> #include <find/basetextfind.h>
#include <aggregation/aggregate.h> #include <aggregation/aggregate.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/outputformatter.h>
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QScrollBar> #include <QtGui/QScrollBar>
@@ -72,6 +76,8 @@ static const int MaxBlockCount = 100000;
enum { debug = 0 }; enum { debug = 0 };
using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
@@ -242,8 +248,8 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
this, SLOT(runControlStarted())); this, SLOT(runControlStarted()));
connect(rc, SIGNAL(finished()), connect(rc, SIGNAL(finished()),
this, SLOT(runControlFinished())); this, SLOT(runControlFinished()));
connect(rc, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,ProjectExplorer::OutputFormat)), connect(rc, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)),
this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,ProjectExplorer::OutputFormat))); this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
// First look if we can reuse a tab // First look if we can reuse a tab
const int size = m_runControlTabs.size(); const int size = m_runControlTabs.size();
@@ -598,6 +604,7 @@ OutputFormatter *OutputWindow::formatter() const
void OutputWindow::setFormatter(OutputFormatter *formatter) void OutputWindow::setFormatter(OutputFormatter *formatter)
{ {
m_formatter = formatter; m_formatter = formatter;
m_formatter->setFont(TextEditor::TextEditorSettings::instance()->fontSettings().font());
m_formatter->setPlainTextEdit(this); m_formatter->setPlainTextEdit(this);
} }

View File

@@ -35,6 +35,7 @@
#include "outputformat.h" #include "outputformat.h"
#include <coreplugin/ioutputpane.h> #include <coreplugin/ioutputpane.h>
#include <utils/outputformatter.h>
#include <QtGui/QPlainTextEdit> #include <QtGui/QPlainTextEdit>
#include <QtGui/QIcon> #include <QtGui/QIcon>
@@ -50,7 +51,6 @@ namespace Core {
} }
namespace ProjectExplorer { namespace ProjectExplorer {
class OutputFormatter;
class RunControl; class RunControl;
class Project; class Project;
@@ -107,7 +107,7 @@ public slots:
void projectRemoved(); void projectRemoved();
void appendMessage(ProjectExplorer::RunControl *rc, const QString &out, void appendMessage(ProjectExplorer::RunControl *rc, const QString &out,
ProjectExplorer::OutputFormat format); Utils::OutputFormat format);
private slots: private slots:
void reRunRunControl(); void reRunRunControl();
@@ -156,10 +156,10 @@ public:
OutputWindow(QWidget *parent = 0); OutputWindow(QWidget *parent = 0);
~OutputWindow(); ~OutputWindow();
OutputFormatter* formatter() const; Utils::OutputFormatter* formatter() const;
void setFormatter(OutputFormatter *formatter); void setFormatter(Utils::OutputFormatter *formatter);
void appendMessage(const QString &out, OutputFormat format); void appendMessage(const QString &out, Utils::OutputFormat format);
/// appends a \p text using \p format without using formater /// appends a \p text using \p format without using formater
void appendText(const QString &text, const QTextCharFormat &format, int maxLineCount); void appendText(const QString &text, const QTextCharFormat &format, int maxLineCount);
@@ -189,7 +189,7 @@ private:
QString doNewlineEnfocement(const QString &out); QString doNewlineEnfocement(const QString &out);
Core::IContext *m_outputWindowContext; Core::IContext *m_outputWindowContext;
OutputFormatter *m_formatter; Utils::OutputFormatter *m_formatter;
bool m_enforceNewline; bool m_enforceNewline;
bool m_scrollToBottom; bool m_scrollToBottom;

View File

@@ -89,8 +89,6 @@ HEADERS += projectexplorer.h \
buildenvironmentwidget.h \ buildenvironmentwidget.h \
ldparser.h \ ldparser.h \
linuxiccparser.h \ linuxiccparser.h \
outputformat.h \
outputformatter.h \
runconfigurationmodel.h \ runconfigurationmodel.h \
buildconfigurationmodel.h \ buildconfigurationmodel.h \
processparameters.h \ processparameters.h \
@@ -180,7 +178,6 @@ SOURCES += projectexplorer.cpp \
buildenvironmentwidget.cpp \ buildenvironmentwidget.cpp \
ldparser.cpp \ ldparser.cpp \
linuxiccparser.cpp \ linuxiccparser.cpp \
outputformatter.cpp \
runconfigurationmodel.cpp \ runconfigurationmodel.cpp \
buildconfigurationmodel.cpp \ buildconfigurationmodel.cpp \
taskhub.cpp \ taskhub.cpp \

View File

@@ -32,7 +32,6 @@
#include "runconfiguration.h" #include "runconfiguration.h"
#include "outputformatter.h"
#include "project.h" #include "project.h"
#include "target.h" #include "target.h"
#include "toolchain.h" #include "toolchain.h"
@@ -327,9 +326,9 @@ QList<IRunConfigurationAspect *> RunConfiguration::extraAspects() const
return m_aspects; return m_aspects;
} }
ProjectExplorer::OutputFormatter *RunConfiguration::createOutputFormatter() const Utils::OutputFormatter *RunConfiguration::createOutputFormatter() const
{ {
return new OutputFormatter(); return new Utils::OutputFormatter();
} }
/*! /*!
@@ -450,7 +449,7 @@ RunControl::RunControl(RunConfiguration *runConfiguration, QString mode)
} }
// We need to ensure that there's always a OutputFormatter // We need to ensure that there's always a OutputFormatter
if (!m_outputFormatter) if (!m_outputFormatter)
m_outputFormatter = new OutputFormatter(); m_outputFormatter = new Utils::OutputFormatter();
} }
RunControl::~RunControl() RunControl::~RunControl()
@@ -458,7 +457,7 @@ RunControl::~RunControl()
delete m_outputFormatter; delete m_outputFormatter;
} }
OutputFormatter *RunControl::outputFormatter() Utils::OutputFormatter *RunControl::outputFormatter()
{ {
return m_outputFormatter; return m_outputFormatter;
} }
@@ -554,7 +553,7 @@ void RunControl::bringApplicationToForegroundInternal()
#endif #endif
} }
void RunControl::appendMessage(const QString &msg, OutputFormat format) void RunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
{ {
emit appendMessage(this, msg, format); emit appendMessage(this, msg, format);
} }

View File

@@ -36,7 +36,8 @@
#include "abi.h" #include "abi.h"
#include "projectconfiguration.h" #include "projectconfiguration.h"
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "outputformat.h"
#include <utils/outputformatter.h>
#include <QtCore/QMetaType> #include <QtCore/QMetaType>
#include <QtCore/QWeakPointer> #include <QtCore/QWeakPointer>
@@ -47,7 +48,6 @@ namespace ProjectExplorer {
class BuildConfiguration; class BuildConfiguration;
class IRunConfigurationAspect; class IRunConfigurationAspect;
class OutputFormatter;
class RunControl; class RunControl;
class Target; class Target;
@@ -65,7 +65,7 @@ public:
Target *target() const; Target *target() const;
virtual ProjectExplorer::OutputFormatter *createOutputFormatter() const; virtual Utils::OutputFormatter *createOutputFormatter() const;
void setUseQmlDebugger(bool value); void setUseQmlDebugger(bool value);
void setUseCppDebugger(bool value); void setUseCppDebugger(bool value);
@@ -206,16 +206,16 @@ public:
bool sameRunConfiguration(const RunControl *other) const; bool sameRunConfiguration(const RunControl *other) const;
OutputFormatter *outputFormatter(); Utils::OutputFormatter *outputFormatter();
QString runMode() const; QString runMode() const;
public slots: public slots:
void bringApplicationToForeground(qint64 pid); void bringApplicationToForeground(qint64 pid);
void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format); void appendMessage(const QString &msg, Utils::OutputFormat format);
signals: signals:
void appendMessage(ProjectExplorer::RunControl *runControl, void appendMessage(ProjectExplorer::RunControl *runControl,
const QString &msg, ProjectExplorer::OutputFormat format); const QString &msg, Utils::OutputFormat format);
void started(); void started();
void finished(); void finished();
@@ -232,7 +232,7 @@ private:
QString m_displayName; QString m_displayName;
QString m_runMode; QString m_runMode;
const QWeakPointer<RunConfiguration> m_runConfiguration; const QWeakPointer<RunConfiguration> m_runConfiguration;
OutputFormatter *m_outputFormatter; Utils::OutputFormatter *m_outputFormatter;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
//these two are used to bring apps in the foreground on Mac //these two are used to bring apps in the foreground on Mac

View File

@@ -164,7 +164,7 @@ void QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_params.debuggee, arguments); m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_params.debuggee, arguments);
} }
void QmlProfilerEngine::logApplicationMessage(const QString &msg, ProjectExplorer::OutputFormat /*format*/) void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat /*format*/)
{ {
qDebug() << "app: " << msg; qDebug() << "app: " << msg;
} }

View File

@@ -35,7 +35,7 @@
#define QMLPROFILERENGINE_H #define QMLPROFILERENGINE_H
#include <analyzerbase/ianalyzerengine.h> #include <analyzerbase/ianalyzerengine.h>
#include <projectexplorer/outputformat.h> #include <utils/outputformat.h>
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
@@ -63,7 +63,7 @@ private slots:
void setFetchingData(bool); void setFetchingData(bool);
void dataReceived(); void dataReceived();
void finishProcess(); void finishProcess();
void logApplicationMessage(const QString &msg, ProjectExplorer::OutputFormat format); void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
private: private:
class QmlProfilerEnginePrivate; class QmlProfilerEnginePrivate;

View File

@@ -219,7 +219,7 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
return m_configurationWidget.data(); return m_configurationWidget.data();
} }
ProjectExplorer::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const Utils::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
{ {
return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject()); return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject());
} }

View File

@@ -99,7 +99,7 @@ public:
// RunConfiguration // RunConfiguration
bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const; bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const;
virtual QWidget *createConfigurationWidget(); virtual QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const; Utils::OutputFormatter *createOutputFormatter() const;
QVariantMap toMap() const; QVariantMap toMap() const;
ProjectExplorer::Abi abi() const; ProjectExplorer::Abi abi() const;

View File

@@ -79,8 +79,8 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QStri
} }
m_commandLineArguments = runConfiguration->viewerArguments(); m_commandLineArguments = runConfiguration->viewerArguments();
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
this, SLOT(slotAppendMessage(QString, ProjectExplorer::OutputFormat))); this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -100,7 +100,7 @@ void QmlRunControl::start()
emit started(); emit started();
QString msg = tr("Starting %1 %2\n") QString msg = tr("Starting %1 %2\n")
.arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments); .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
} }
RunControl::StopResult QmlRunControl::stop() RunControl::StopResult QmlRunControl::stop()
@@ -124,7 +124,7 @@ void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
bringApplicationToForeground(pid); bringApplicationToForeground(pid);
} }
void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format) void QmlRunControl::slotAppendMessage(const QString &line, Utils::OutputFormat format)
{ {
appendMessage(line, format); appendMessage(line, format);
} }
@@ -133,7 +133,7 @@ void QmlRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2\n") QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
emit finished(); emit finished();
} }

View File

@@ -58,7 +58,7 @@ public:
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotBringApplicationToForeground(qint64 pid); void slotBringApplicationToForeground(qint64 pid);
void slotAppendMessage(const QString &line, ProjectExplorer::OutputFormat); void slotAppendMessage(const QString &line, Utils::OutputFormat);
private: private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher; ProjectExplorer::ApplicationLauncher m_applicationLauncher;

View File

@@ -699,7 +699,7 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
return m_baseEnvironmentBase; return m_baseEnvironmentBase;
} }
ProjectExplorer::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
{ {
return new QtOutputFormatter(qt4Target()->qt4Project()); return new QtOutputFormatter(qt4Target()->qt4Project());
} }

View File

@@ -102,7 +102,7 @@ public:
// TODO detectQtShadowBuild() ? how did this work ? // TODO detectQtShadowBuild() ? how did this work ?
QVariantMap toMap() const; QVariantMap toMap() const;
ProjectExplorer::OutputFormatter *createOutputFormatter() const; Utils::OutputFormatter *createOutputFormatter() const;
signals: signals:
void commandLineArgumentsChanged(const QString&); void commandLineArgumentsChanged(const QString&);

View File

@@ -137,7 +137,7 @@ QWidget *MaemoRunConfiguration::createConfigurationWidget()
return new MaemoRunConfigurationWidget(this); return new MaemoRunConfigurationWidget(this);
} }
ProjectExplorer::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const
{ {
return new QtOutputFormatter(maemoTarget()->qt4Project()); return new QtOutputFormatter(maemoTarget()->qt4Project());
} }

View File

@@ -84,7 +84,7 @@ public:
using ProjectExplorer::RunConfiguration::isEnabled; using ProjectExplorer::RunConfiguration::isEnabled;
bool isEnabled(ProjectExplorer::BuildConfiguration *config) const; bool isEnabled(ProjectExplorer::BuildConfiguration *config) const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const; Utils::OutputFormatter *createOutputFormatter() const;
AbstractQt4MaemoTarget *maemoTarget() const; AbstractQt4MaemoTarget *maemoTarget() const;
Qt4BuildConfiguration *activeQt4BuildConfiguration() const; Qt4BuildConfiguration *activeQt4BuildConfiguration() const;

View File

@@ -95,7 +95,7 @@ void MaemoRunControl::handleSshError(const QString &error)
void MaemoRunControl::startExecution() void MaemoRunControl::startExecution()
{ {
appendMessage(tr("Starting remote process ...\n"), NormalMessageFormat); appendMessage(tr("Starting remote process ...\n"), Utils::NormalMessageFormat);
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4") m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(), .arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(),
m_runner->connection()->connectionParameters().userName, m_runner->connection()->connectionParameters().userName,
@@ -109,29 +109,29 @@ void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
{ {
if (exitCode != MaemoSshRunner::InvalidExitCode) { if (exitCode != MaemoSshRunner::InvalidExitCode) {
appendMessage(tr("Finished running remote process. Exit code was %1.\n") appendMessage(tr("Finished running remote process. Exit code was %1.\n")
.arg(exitCode), NormalMessageFormat); .arg(exitCode), Utils::NormalMessageFormat);
} }
setFinished(); setFinished();
} }
void MaemoRunControl::handleRemoteOutput(const QByteArray &output) void MaemoRunControl::handleRemoteOutput(const QByteArray &output)
{ {
appendMessage(QString::fromUtf8(output), StdOutFormatSameLine); appendMessage(QString::fromUtf8(output), Utils::StdOutFormatSameLine);
} }
void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output) void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output)
{ {
appendMessage(QString::fromUtf8(output), StdErrFormatSameLine); appendMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
} }
void MaemoRunControl::handleProgressReport(const QString &progressString) void MaemoRunControl::handleProgressReport(const QString &progressString)
{ {
appendMessage(progressString + QLatin1Char('\n'), NormalMessageFormat); appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat);
} }
void MaemoRunControl::handleMountDebugOutput(const QString &output) void MaemoRunControl::handleMountDebugOutput(const QString &output)
{ {
appendMessage(output, StdErrFormatSameLine); appendMessage(output, Utils::StdErrFormatSameLine);
} }
bool MaemoRunControl::isRunning() const bool MaemoRunControl::isRunning() const
@@ -147,7 +147,7 @@ QIcon MaemoRunControl::icon() const
void MaemoRunControl::handleError(const QString &errString) void MaemoRunControl::handleError(const QString &errString)
{ {
stop(); stop();
appendMessage(errString, ErrorMessageFormat); appendMessage(errString, Utils::ErrorMessageFormat);
QMessageBox::critical(0, tr("Remote Execution Failure"), errString); QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
} }

View File

@@ -98,11 +98,11 @@ bool CodaRunControl::doStart()
if (m_address.isEmpty() && m_serialPort.isEmpty()) { if (m_address.isEmpty() && m_serialPort.isEmpty()) {
cancelProgress(); cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again.\n"); QString msg = tr("No device is connected. Please connect a device and try again.\n");
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
return false; return false;
} }
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())), appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
NormalMessageFormat); Utils::NormalMessageFormat);
return true; return true;
} }
@@ -122,14 +122,14 @@ bool CodaRunControl::setupLauncher()
if (m_serialPort.length()) { if (m_serialPort.length()) {
// We get the port from SymbianDeviceManager // We get the port from SymbianDeviceManager
appendMessage(tr("Connecting to '%1'...\n").arg(m_serialPort), NormalMessageFormat); appendMessage(tr("Connecting to '%1'...\n").arg(m_serialPort), Utils::NormalMessageFormat);
m_codaDevice = SymbianUtils::SymbianDeviceManager::instance()->getCodaDevice(m_serialPort); m_codaDevice = SymbianUtils::SymbianDeviceManager::instance()->getCodaDevice(m_serialPort);
if (m_codaDevice.isNull()) { if (m_codaDevice.isNull()) {
appendMessage(tr("Unable to create CODA connection. Please try again.\n"), ErrorMessageFormat); appendMessage(tr("Unable to create CODA connection. Please try again.\n"), Utils::ErrorMessageFormat);
return false; return false;
} }
if (!m_codaDevice->device()->isOpen()) { if (!m_codaDevice->device()->isOpen()) {
appendMessage(tr("Could not open serial device: %1\n").arg(m_codaDevice->device()->errorString()), ErrorMessageFormat); appendMessage(tr("Could not open serial device: %1\n").arg(m_codaDevice->device()->errorString()), Utils::ErrorMessageFormat);
return false; return false;
} }
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)), connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
@@ -151,7 +151,7 @@ bool CodaRunControl::setupLauncher()
m_codaDevice->setDevice(codaSocket); m_codaDevice->setDevice(codaSocket);
codaSocket->connectToHost(m_address, m_port); codaSocket->connectToHost(m_address, m_port);
m_state = StateConnecting; m_state = StateConnecting;
appendMessage(tr("Connecting to %1:%2...\n").arg(m_address).arg(m_port), NormalMessageFormat); appendMessage(tr("Connecting to %1:%2...\n").arg(m_address).arg(m_port), Utils::NormalMessageFormat);
} }
QTimer::singleShot(5000, this, SLOT(checkForTimeout())); QTimer::singleShot(5000, this, SLOT(checkForTimeout()));
if (debug) if (debug)
@@ -178,7 +178,7 @@ void CodaRunControl::doStop()
void CodaRunControl::slotError(const QString &error) void CodaRunControl::slotError(const QString &error)
{ {
appendMessage(tr("Error: %1\n").arg(error), ErrorMessageFormat); appendMessage(tr("Error: %1\n").arg(error), Utils::ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }
@@ -238,7 +238,7 @@ void CodaRunControl::handleConnected()
if (m_state >= StateConnected) if (m_state >= StateConnected)
return; return;
m_state = StateConnected; m_state = StateConnected;
appendMessage(tr("Connected.\n"), NormalMessageFormat); appendMessage(tr("Connected.\n"), Utils::NormalMessageFormat);
setProgress(maxProgress()*0.80); setProgress(maxProgress()*0.80);
emit connected(); emit connected();
if (!m_stopAfterConnect) if (!m_stopAfterConnect)
@@ -251,7 +251,7 @@ void CodaRunControl::handleContextRemoved(const CodaEvent &event)
= static_cast<const CodaRunControlContextRemovedEvent &>(event).ids(); = static_cast<const CodaRunControlContextRemovedEvent &>(event).ids();
if (!m_runningProcessId.isEmpty() if (!m_runningProcessId.isEmpty()
&& removedItems.contains(m_runningProcessId.toAscii())) { && removedItems.contains(m_runningProcessId.toAscii())) {
appendMessage(tr("Process has finished.\n"), NormalMessageFormat); appendMessage(tr("Process has finished.\n"), Utils::NormalMessageFormat);
finishRunControl(); finishRunControl();
} }
} }
@@ -276,7 +276,7 @@ void CodaRunControl::handleContextSuspended(const CodaEvent &event)
switch (me.reason()) { switch (me.reason()) {
case TcfSuspendEvent::Other: case TcfSuspendEvent::Other:
case TcfSuspendEvent::Crash: case TcfSuspendEvent::Crash:
appendMessage(tr("Thread has crashed: %1\n").arg(QString::fromLatin1(me.message())), ErrorMessageFormat); appendMessage(tr("Thread has crashed: %1\n").arg(QString::fromLatin1(me.message())), Utils::ErrorMessageFormat);
if (me.reason() == TcfSuspendEvent::Crash) if (me.reason() == TcfSuspendEvent::Crash)
stop(); stop();
@@ -303,7 +303,7 @@ void CodaRunControl::handleModuleLoadSuspended(const CodaEvent &event)
void CodaRunControl::handleLogging(const CodaEvent &event) void CodaRunControl::handleLogging(const CodaEvent &event)
{ {
const CodaLoggingWriteEvent &me = static_cast<const CodaLoggingWriteEvent &>(event); const CodaLoggingWriteEvent &me = static_cast<const CodaLoggingWriteEvent &>(event);
appendMessage(me.message(), StdOutFormat); appendMessage(me.message(), Utils::StdOutFormat);
} }
void CodaRunControl::handleAddListener(const CodaCommandResult &result) void CodaRunControl::handleAddListener(const CodaCommandResult &result)
@@ -318,7 +318,7 @@ void CodaRunControl::handleFindProcesses(const CodaCommandResult &result)
{ {
if (result.values.size() && result.values.at(0).type() == JsonValue::Array && result.values.at(0).children().count()) { if (result.values.size() && result.values.at(0).type() == JsonValue::Array && result.values.at(0).children().count()) {
//there are processes running. Cannot run mine //there are processes running. Cannot run mine
appendMessage(tr("The process is already running on the device. Please first close it.\n"), ErrorMessageFormat); appendMessage(tr("The process is already running on the device. Please first close it.\n"), Utils::ErrorMessageFormat);
finishRunControl(); finishRunControl();
} else { } else {
setProgress(maxProgress()*0.90); setProgress(maxProgress()*0.90);
@@ -328,7 +328,7 @@ void CodaRunControl::handleFindProcesses(const CodaCommandResult &result)
commandLineArguments().split(' '), commandLineArguments().split(' '),
QString(), QString(),
true); true);
appendMessage(tr("Launching: %1\n").arg(executableName()), NormalMessageFormat); appendMessage(tr("Launching: %1\n").arg(executableName()), Utils::NormalMessageFormat);
} }
} }
@@ -337,9 +337,9 @@ void CodaRunControl::handleCreateProcess(const CodaCommandResult &result)
const bool ok = result.type == CodaCommandResult::SuccessReply; const bool ok = result.type == CodaCommandResult::SuccessReply;
if (ok) { if (ok) {
setProgress(maxProgress()); setProgress(maxProgress());
appendMessage(tr("Launched.\n"), NormalMessageFormat); appendMessage(tr("Launched.\n"), Utils::NormalMessageFormat);
} else { } else {
appendMessage(tr("Launch failed: %1\n").arg(result.toString()), ErrorMessageFormat); appendMessage(tr("Launch failed: %1\n").arg(result.toString()), Utils::ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }
} }
@@ -383,7 +383,7 @@ void CodaRunControl::cancelConnection()
return; return;
stop(); stop();
appendMessage(tr("Canceled.\n"), ErrorMessageFormat); appendMessage(tr("Canceled.\n"), Utils::ErrorMessageFormat);
emit finished(); emit finished();
} }
@@ -391,7 +391,7 @@ void CodaRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &device)
{ {
if (m_codaDevice && device.portName() == m_serialPort) { if (m_codaDevice && device.portName() == m_serialPort) {
QString msg = tr("The device '%1' has been disconnected.\n").arg(device.friendlyName()); QString msg = tr("The device '%1' has been disconnected.\n").arg(device.friendlyName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, Utils::ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }
} }

View File

@@ -171,7 +171,7 @@ QWidget *S60DeviceRunConfiguration::createConfigurationWidget()
return new S60DeviceRunConfigurationWidget(this); return new S60DeviceRunConfigurationWidget(this);
} }
ProjectExplorer::OutputFormatter *S60DeviceRunConfiguration::createOutputFormatter() const Utils::OutputFormatter *S60DeviceRunConfiguration::createOutputFormatter() const
{ {
return new QtOutputFormatter(qt4Target()->qt4Project()); return new QtOutputFormatter(qt4Target()->qt4Project());
} }
@@ -491,7 +491,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
if (startParameters().symbolFileName.isEmpty()) { if (startParameters().symbolFileName.isEmpty()) {
const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n"). const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n").
arg(rc->localExecutableFileName()); arg(rc->localExecutableFileName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, Utils::ErrorMessageFormat);
} }
if (masterSlaveEngineTypes.first == Debugger::QmlEngineType) { if (masterSlaveEngineTypes.first == Debugger::QmlEngineType) {
connect(engine(), SIGNAL(requestRemoteSetup()), this, SLOT(remoteSetupRequested())); connect(engine(), SIGNAL(requestRemoteSetup()), this, SLOT(remoteSetupRequested()));
@@ -501,7 +501,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
void S60DeviceDebugRunControl::start() void S60DeviceDebugRunControl::start()
{ {
appendMessage(tr("Launching debugger...\n"), NormalMessageFormat); appendMessage(tr("Launching debugger...\n"), Utils::NormalMessageFormat);
Debugger::DebuggerRunControl::start(); Debugger::DebuggerRunControl::start();
} }
@@ -558,7 +558,7 @@ void S60DeviceDebugRunControl::handleDebuggingFinished()
} }
} }
void S60DeviceDebugRunControl::handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, ProjectExplorer::OutputFormat format) void S60DeviceDebugRunControl::handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format)
{ {
// This only gets used when QmlEngine is the master debug engine. If GDB is running, messages are handled via the gdb adapter // This only gets used when QmlEngine is the master debug engine. If GDB is running, messages are handled via the gdb adapter
Q_UNUSED(aCodaRunControl) Q_UNUSED(aCodaRunControl)

View File

@@ -71,7 +71,7 @@ public:
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const; bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const; Utils::OutputFormatter *createOutputFormatter() const;
QString commandLineArguments() const; QString commandLineArguments() const;
void setCommandLineArguments(const QString &args); void setCommandLineArguments(const QString &args);
@@ -148,7 +148,7 @@ private slots:
void qmlEngineStateChanged(const Debugger::DebuggerState &state); void qmlEngineStateChanged(const Debugger::DebuggerState &state);
void codaFinished(); void codaFinished();
void handleDebuggingFinished(); void handleDebuggingFinished();
void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, ProjectExplorer::OutputFormat format); void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format);
private: private:
CodaRunControl *m_codaRunControl; CodaRunControl *m_codaRunControl;

View File

@@ -155,7 +155,7 @@ QWidget *S60EmulatorRunConfiguration::createConfigurationWidget()
return new S60EmulatorRunConfigurationWidget(this); return new S60EmulatorRunConfigurationWidget(this);
} }
ProjectExplorer::OutputFormatter *S60EmulatorRunConfiguration::createOutputFormatter() const Utils::OutputFormatter *S60EmulatorRunConfiguration::createOutputFormatter() const
{ {
return new QtOutputFormatter(qt4Target()->qt4Project()); return new QtOutputFormatter(qt4Target()->qt4Project());
} }
@@ -342,8 +342,8 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
m_executable = runConfiguration->executable(); m_executable = runConfiguration->executable();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString))); this, SLOT(slotError(QString)));
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString, ProjectExplorer::OutputFormat)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString, Utils::OutputFormat)),
this, SLOT(slotAppendMessage(QString, ProjectExplorer::OutputFormat))); this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)), connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int))); this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
@@ -356,7 +356,7 @@ void S60EmulatorRunControl::start()
emit started(); emit started();
QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
} }
RunControl::StopResult S60EmulatorRunControl::stop() RunControl::StopResult S60EmulatorRunControl::stop()
@@ -377,11 +377,11 @@ QIcon S60EmulatorRunControl::icon() const
void S60EmulatorRunControl::slotError(const QString & err) void S60EmulatorRunControl::slotError(const QString & err)
{ {
appendMessage(err, ErrorMessageFormat); appendMessage(err, Utils::ErrorMessageFormat);
emit finished(); emit finished();
} }
void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat format) void S60EmulatorRunControl::slotAppendMessage(const QString &line, Utils::OutputFormat format)
{ {
static QString prefix = tr("[Qt Message]"); static QString prefix = tr("[Qt Message]");
static int prefixLength = prefix.length(); static int prefixLength = prefix.length();
@@ -393,6 +393,6 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat
void S60EmulatorRunControl::processExited(int exitCode) void S60EmulatorRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2\n"); QString msg = tr("%1 exited with code %2\n");
appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
emit finished(); emit finished();
} }

View File

@@ -72,7 +72,7 @@ public:
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const; bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
ProjectExplorer::OutputFormatter *createOutputFormatter() const; Utils::OutputFormatter *createOutputFormatter() const;
QString executable() const; QString executable() const;
@@ -149,7 +149,7 @@ public:
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotAppendMessage(const QString &line, ProjectExplorer::OutputFormat); void slotAppendMessage(const QString &line, Utils::OutputFormat);
void slotError(const QString & error); void slotError(const QString & error);
private: private:

View File

@@ -119,7 +119,7 @@ void S60RunControlBase::start()
if (m_runSmartInstaller) { //Smart Installer does the running by itself if (m_runSmartInstaller) { //Smart Installer does the running by itself
cancelProgress(); cancelProgress();
appendMessage(tr("Please finalise the installation on your device.\n"), NormalMessageFormat); appendMessage(tr("Please finalise the installation on your device.\n"), Utils::NormalMessageFormat);
emit finished(); emit finished();
return; return;
} }
@@ -172,7 +172,7 @@ void S60RunControlBase::startLaunching()
void S60RunControlBase::handleFinished() void S60RunControlBase::handleFinished()
{ {
appendMessage(tr("Finished.\n"), NormalMessageFormat); appendMessage(tr("Finished.\n"), Utils::NormalMessageFormat);
} }
void S60RunControlBase::setProgress(int value) void S60RunControlBase::setProgress(int value)

View File

@@ -83,12 +83,12 @@ bool TrkRunControl::doStart()
if (m_serialPortName.isEmpty()) { if (m_serialPortName.isEmpty()) {
cancelProgress(); cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again.\n"); QString msg = tr("No device is connected. Please connect a device and try again.\n");
appendMessage(msg, NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
return false; return false;
} }
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())), appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
NormalMessageFormat); Utils::NormalMessageFormat);
return true; return true;
} }
@@ -111,7 +111,7 @@ bool TrkRunControl::setupLauncher()
QString errorMessage; QString errorMessage;
m_launcher = trk::Launcher::acquireFromDeviceManager(m_serialPortName, 0, &errorMessage); m_launcher = trk::Launcher::acquireFromDeviceManager(m_serialPortName, 0, &errorMessage);
if (!m_launcher) { if (!m_launcher) {
appendMessage(errorMessage, ErrorMessageFormat); appendMessage(errorMessage, Utils::ErrorMessageFormat);
return false; return false;
} }
@@ -134,7 +134,7 @@ bool TrkRunControl::setupLauncher()
if (!m_launcher->startServer(&errorMessage)) { if (!m_launcher->startServer(&errorMessage)) {
appendMessage(tr("Could not connect to phone on port '%1': %2\n" appendMessage(tr("Could not connect to phone on port '%1': %2\n"
"Check if the phone is connected and App TRK is running.").arg(m_serialPortName, errorMessage), ErrorMessageFormat); "Check if the phone is connected and App TRK is running.").arg(m_serialPortName, errorMessage), Utils::ErrorMessageFormat);
return false; return false;
} }
return true; return true;
@@ -149,7 +149,7 @@ void TrkRunControl::doStop()
void TrkRunControl::printConnectFailed(const QString &errorMessage) void TrkRunControl::printConnectFailed(const QString &errorMessage)
{ {
appendMessage(tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.\n").arg(errorMessage), appendMessage(tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.\n").arg(errorMessage),
ErrorMessageFormat); Utils::ErrorMessageFormat);
} }
void TrkRunControl::launcherFinished() void TrkRunControl::launcherFinished()
@@ -162,7 +162,7 @@ void TrkRunControl::launcherFinished()
void TrkRunControl::processStopped(uint pc, uint pid, uint tid, const QString &reason) void TrkRunControl::processStopped(uint pc, uint pid, uint tid, const QString &reason)
{ {
appendMessage(trk::Launcher::msgStopped(pid, tid, pc, reason), StdOutFormat); appendMessage(trk::Launcher::msgStopped(pid, tid, pc, reason), Utils::StdOutFormat);
m_launcher->terminate(); m_launcher->terminate();
} }
@@ -193,7 +193,7 @@ void TrkRunControl::slotWaitingForTrkClosed()
{ {
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) { if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop(); stop();
appendMessage(tr("Canceled.\n"), ErrorMessageFormat); appendMessage(tr("Canceled.\n"), Utils::ErrorMessageFormat);
emit finished(); emit finished();
} }
} }
@@ -205,7 +205,7 @@ void TrkRunControl::printApplicationOutput(const QString &output)
void TrkRunControl::printApplicationOutput(const QString &output, bool onStdErr) void TrkRunControl::printApplicationOutput(const QString &output, bool onStdErr)
{ {
appendMessage(output, onStdErr ? StdErrFormat : StdOutFormat); appendMessage(output, onStdErr ? Utils::StdErrFormat : Utils::StdOutFormat);
} }
void TrkRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d) void TrkRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
@@ -215,7 +215,7 @@ void TrkRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
m_launcher->deleteLater(); m_launcher->deleteLater();
m_launcher = 0; m_launcher = 0;
QString msg = tr("The device '%1' has been disconnected.\n").arg(d.friendlyName()); QString msg = tr("The device '%1' has been disconnected.\n").arg(d.friendlyName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, Utils::ErrorMessageFormat);
emit finished(); emit finished();
} }
} }
@@ -232,16 +232,16 @@ void TrkRunControl::initLauncher(const QString &executable, trk::Launcher *launc
void TrkRunControl::printStartingNotice() void TrkRunControl::printStartingNotice()
{ {
appendMessage(tr("Starting application...\n"), NormalMessageFormat); appendMessage(tr("Starting application...\n"), Utils::NormalMessageFormat);
} }
void TrkRunControl::applicationRunNotice(uint pid) void TrkRunControl::applicationRunNotice(uint pid)
{ {
appendMessage(tr("Application running with pid %1.\n").arg(pid), NormalMessageFormat); appendMessage(tr("Application running with pid %1.\n").arg(pid), Utils::NormalMessageFormat);
setProgress(maxProgress()); setProgress(maxProgress());
} }
void TrkRunControl::applicationRunFailedNotice(const QString &errorMessage) void TrkRunControl::applicationRunFailedNotice(const QString &errorMessage)
{ {
appendMessage(tr("Could not start application: %1\n").arg(errorMessage), NormalMessageFormat); appendMessage(tr("Could not start application: %1\n").arg(errorMessage), Utils::NormalMessageFormat);
} }

View File

@@ -91,7 +91,7 @@ LinkResult QtOutputFormatter::matchLine(const QString &line) const
return lr; return lr;
} }
void QtOutputFormatter::appendMessage(const QString &txt, OutputFormat format) void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat format)
{ {
QTextCursor cursor(plainTextEdit()->document()); QTextCursor cursor(plainTextEdit()->document());
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);
@@ -173,7 +173,7 @@ void QtOutputFormatter::appendMessage(const QString &txt, OutputFormat format)
} }
void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr, void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr,
const QString &line, ProjectExplorer::OutputFormat format) const QString &line, Utils::OutputFormat format)
{ {
const QTextCharFormat normalFormat = charFormat(format); const QTextCharFormat normalFormat = charFormat(format);
cursor.insertText(line.left(lr.start), normalFormat); cursor.insertText(line.left(lr.start), normalFormat);

View File

@@ -35,7 +35,7 @@
#include "qt4projectmanager_global.h" #include "qt4projectmanager_global.h"
#include <projectexplorer/outputformatter.h> #include <utils/outputformatter.h>
#include <utils/fileinprojectfinder.h> #include <utils/fileinprojectfinder.h>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
@@ -57,14 +57,14 @@ struct LinkResult
}; };
class QT4PROJECTMANAGER_EXPORT QtOutputFormatter class QT4PROJECTMANAGER_EXPORT QtOutputFormatter
: public ProjectExplorer::OutputFormatter : public Utils::OutputFormatter
{ {
Q_OBJECT Q_OBJECT
public: public:
QtOutputFormatter(ProjectExplorer::Project *project); QtOutputFormatter(ProjectExplorer::Project *project);
virtual void appendMessage(const QString &text, virtual void appendMessage(const QString &text,
ProjectExplorer::OutputFormat format); Utils::OutputFormat format);
virtual void handleLink(const QString &href); virtual void handleLink(const QString &href);
private slots: private slots:
@@ -73,7 +73,7 @@ private slots:
private: private:
LinkResult matchLine(const QString &line) const; LinkResult matchLine(const QString &line) const;
void appendLine(QTextCursor & cursor, LinkResult lr, void appendLine(QTextCursor & cursor, LinkResult lr,
const QString &line, ProjectExplorer::OutputFormat); const QString &line, Utils::OutputFormat);
QRegExp m_qmlError; QRegExp m_qmlError;
QRegExp m_qtError; QRegExp m_qtError;