#ifndef OUTPUTFORMAT_H
#define OUTPUTFORMAT_H
-namespace ProjectExplorer {
+namespace Utils {
enum OutputFormat
{
NumberOfFormats // Keep this entry last.
};
-} // namespace ProjectExplorer
+} // namespace Utils
#endif // OUTPUTFORMATR_H
#include "outputformatter.h"
-#include <texteditor/fontsettings.h>
-#include <texteditor/texteditorsettings.h>
-
#include <QtGui/QPlainTextEdit>
#include <QtGui/QColor>
#include <QtCore/QString>
-using namespace ProjectExplorer;
-using namespace TextEditor;
+using namespace Utils;
OutputFormatter::OutputFormatter()
: QObject()
+ , m_plainTextEdit(0)
, m_formats(0)
{
void OutputFormatter::initFormats()
{
+ if (!plainTextEdit())
+ return;
QPalette p = plainTextEdit()->palette();
- FontSettings fs = TextEditorSettings::instance()->fontSettings();
- QFont font = fs.font();
- QFont boldFont = font;
+ QFont boldFont = m_font;
boldFont.setBold(true);
m_formats = new QTextCharFormat[NumberOfFormats];
m_formats[ErrorMessageFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red)));
// StdOutFormat
- m_formats[StdOutFormat].setFont(font);
+ m_formats[StdOutFormat].setFont(m_font);
m_formats[StdOutFormat].setForeground(p.color(QPalette::Text));
m_formats[StdOutFormatSameLine] = m_formats[StdOutFormat];
// 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[StdErrFormatSameLine] = m_formats[StdErrFormat];
}
{
Q_UNUSED(href);
}
+
+QFont OutputFormatter::font() const
+{
+ return m_font;
+}
+
+void OutputFormatter::setFont(const QFont &font)
+{
+ m_font = font;
+ initFormats();
+}
#ifndef OUTPUTFORMATTER_H
#define OUTPUTFORMATTER_H
-#include "projectexplorer_export.h"
+#include "utils_global.h"
#include "outputformat.h"
#include <QtCore/QObject>
+#include <QtGui/QFont>
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
class QColor;
QT_END_NAMESPACE
-namespace ProjectExplorer {
+namespace Utils {
-class PROJECTEXPLORER_EXPORT OutputFormatter : public QObject
+class QTCREATOR_UTILS_EXPORT OutputFormatter : public QObject
{
Q_OBJECT
QPlainTextEdit *plainTextEdit() const;
void setPlainTextEdit(QPlainTextEdit *plainText);
+ QFont font() const;
+ void setFont(const QFont &font);
+
virtual void appendMessage(const QString &text, OutputFormat format);
virtual void handleLink(const QString &href);
private:
QPlainTextEdit *m_plainTextEdit;
QTextCharFormat *m_formats;
+ QFont m_font;
};
-} // namespace ProjectExplorer
+} // namespace Utils
#endif // OUTPUTFORMATTER_H
$$PWD/ssh/sftpdefs.cpp \
$$PWD/ssh/sftpchannel.cpp \
$$PWD/ssh/sshremoteprocessrunner.cpp \
- $$PWD/ssh/sshconnectionmanager.cpp
+ $$PWD/ssh/sshconnectionmanager.cpp \
+ $$PWD/outputformatter.cpp
win32 {
SOURCES += $$PWD/abstractprocess_win.cpp \
$$PWD/ssh/sshremoteprocessrunner.h \
$$PWD/ssh/sshconnectionmanager.h \
$$PWD/ssh/sshpseudoterminal.h \
- $$PWD/statuslabel.h
+ $$PWD/statuslabel.h \
+ $$PWD/outputformatter.h \
+ $$PWD/outputformat.h
FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \
void AnalyzerRunControl::receiveStandardOutput(const QString &text)
{
- appendMessage(text, ProjectExplorer::StdOutFormat);
+ appendMessage(text, Utils::StdOutFormat);
}
void AnalyzerRunControl::receiveStandardError(const QString &text)
{
- appendMessage(text, ProjectExplorer::StdErrFormat);
+ appendMessage(text, Utils::StdErrFormat);
}
void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h>
-#include <projectexplorer/outputformat.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication*
+#include <utils/outputformat.h>
#include <utils/synchronousprocess.h>
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
// User canceled input dialog asking for executable when working on library project.
if (d->m_engine->startParameters().startMode == StartInternal
&& d->m_engine->startParameters().executable.isEmpty()) {
- appendMessage(tr("No executable specified.\n"), ErrorMessageFormat);
+ appendMessage(tr("No executable specified.\n"), Utils::ErrorMessageFormat);
emit started();
emit finished();
return;
d->m_engine->startDebugger(this);
if (d->m_running)
- appendMessage(tr("Debugging starts\n"), NormalMessageFormat);
+ appendMessage(tr("Debugging starts\n"), Utils::NormalMessageFormat);
}
void DebuggerRunControl::startFailed()
{
- appendMessage(tr("Debugging has failed\n"), NormalMessageFormat);
+ appendMessage(tr("Debugging has failed\n"), Utils::NormalMessageFormat);
d->m_running = false;
emit finished();
d->m_engine->handleStartFailed();
void DebuggerRunControl::handleFinished()
{
- appendMessage(tr("Debugging has finished\n"), NormalMessageFormat);
+ appendMessage(tr("Debugging has finished\n"), Utils::NormalMessageFormat);
if (d->m_engine)
d->m_engine->handleFinished();
debuggerCore()->runControlFinished(d->m_engine);
{
switch (channel) {
case AppOutput:
- appendMessage(msg, StdOutFormatSameLine);
+ appendMessage(msg, Utils::StdOutFormatSameLine);
break;
case AppError:
- appendMessage(msg, StdErrFormatSameLine);
+ appendMessage(msg, Utils::StdErrFormatSameLine);
break;
case AppStuff:
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
break;
}
}
SIGNAL(processExited(int)),
SLOT(disconnected()));
connect(&d->m_applicationLauncher,
- SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)),
- SLOT(appendMessage(QString,ProjectExplorer::OutputFormat)));
+ SIGNAL(appendMessage(QString,Utils::OutputFormat)),
+ SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(&d->m_applicationLauncher,
SIGNAL(bringToForegroundRequested(qint64)),
runControl(),
}
}
-void QmlEngine::appendMessage(const QString &msg, OutputFormat /* format */)
+void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
{
showMessage(msg, AppOutput); // FIXME: Redirect to RunControl
}
QDir::toNativeSeparators(startParameters().executable),
startParameters().processArgs)
+ QLatin1Char('\n')
- , NormalMessageFormat);
+ , Utils::NormalMessageFormat);
d->m_applicationLauncher.start(ApplicationLauncher::Gui,
startParameters().executable,
startParameters().processArgs);
#include "debuggerengine.h"
-#include <projectexplorer/outputformat.h>
+#include <utils/outputformat.h>
#include <QtCore/QScopedPointer>
#include <QtNetwork/QAbstractSocket>
void connectionStartupFailed();
void connectionError(QAbstractSocket::SocketError error);
void serviceConnectionError(const QString &service);
- void appendMessage(const QString &msg, ProjectExplorer::OutputFormat);
+ void appendMessage(const QString &msg, Utils::OutputFormat);
void synchronizeWatchers();
#define APPLICATIONLAUNCHER_H
#include "projectexplorer_export.h"
-#include "outputformat.h"
+
+#include <utils/outputformat.h>
#include <QtCore/QProcess>
qint64 applicationPID() const;
signals:
- void appendMessage(const QString &message, ProjectExplorer::OutputFormat format);
+ void appendMessage(const QString &message, Utils::OutputFormat format);
void processExited(int exitCode);
void bringToForegroundRequested(qint64 pid);
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,
bool onStdErr)
{
- emit appendMessage(output, onStdErr ? StdErrFormat : StdOutFormat);
+ emit appendMessage(output, onStdErr ? Utils::StdErrFormat : Utils::StdOutFormat);
}
void ApplicationLauncher::processStopped()
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)
default:
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());
}
QByteArray data = d->m_guiProcess.readAllStandardOutput();
QString msg = d->m_outputCodec->toUnicode(
data.constData(), data.length(), &d->m_outputCodecState);
- emit appendMessage(msg, StdOutFormatSameLine);
+ emit appendMessage(msg, Utils::StdOutFormatSameLine);
}
void ApplicationLauncher::readStandardError()
QByteArray data = d->m_guiProcess.readAllStandardError();
QString msg = d->m_outputCodec->toUnicode(
data.constData(), data.length(), &d->m_outputCodecState);
- emit appendMessage(msg, StdErrFormatSameLine);
+ emit appendMessage(msg, Utils::StdErrFormatSameLine);
}
void ApplicationLauncher::processStopped()
m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
m_commandLineArguments = rc->commandLineArguments();
- connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)),
- this, SLOT(slotAppendMessage(QString,ProjectExplorer::OutputFormat)));
+ connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
+ this, SLOT(slotAppendMessage(QString,Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
{
emit started();
if (m_executable.isEmpty()) {
- appendMessage(tr("No executable specified.\n"), ErrorMessageFormat);
+ appendMessage(tr("No executable specified.\n"), Utils::ErrorMessageFormat);
emit finished();
} else {
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
}
}
}
void LocalApplicationRunControl::slotAppendMessage(const QString &err,
- OutputFormat format)
+ Utils::OutputFormat format)
{
appendMessage(err, format);
}
{
QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
emit finished();
}
virtual QIcon icon() const;
private slots:
void processExited(int exitCode);
- void slotAppendMessage(const QString &err, ProjectExplorer::OutputFormat isError);
+ void slotAppendMessage(const QString &err, Utils::OutputFormat isError);
private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
QString m_executable;
#include "projectexplorersettings.h"
#include "runconfiguration.h"
#include "session.h"
-#include "outputformatter.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/icontext.h>
#include <find/basetextfind.h>
#include <aggregation/aggregate.h>
+
#include <texteditor/basetexteditor.h>
+#include <texteditor/fontsettings.h>
+#include <texteditor/texteditorsettings.h>
+
#include <projectexplorer/project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <utils/qtcassert.h>
+#include <utils/outputformatter.h>
#include <QtGui/QIcon>
#include <QtGui/QScrollBar>
enum { debug = 0 };
+using namespace Utils;
+
namespace ProjectExplorer {
namespace Internal {
this, SLOT(runControlStarted()));
connect(rc, SIGNAL(finished()),
this, SLOT(runControlFinished()));
- connect(rc, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,ProjectExplorer::OutputFormat)),
- this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,ProjectExplorer::OutputFormat)));
+ connect(rc, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)),
+ this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
// First look if we can reuse a tab
const int size = m_runControlTabs.size();
void OutputWindow::setFormatter(OutputFormatter *formatter)
{
m_formatter = formatter;
+ m_formatter->setFont(TextEditor::TextEditorSettings::instance()->fontSettings().font());
m_formatter->setPlainTextEdit(this);
}
#include "outputformat.h"
#include <coreplugin/ioutputpane.h>
+#include <utils/outputformatter.h>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QIcon>
}
namespace ProjectExplorer {
-class OutputFormatter;
class RunControl;
class Project;
void projectRemoved();
void appendMessage(ProjectExplorer::RunControl *rc, const QString &out,
- ProjectExplorer::OutputFormat format);
+ Utils::OutputFormat format);
private slots:
void reRunRunControl();
OutputWindow(QWidget *parent = 0);
~OutputWindow();
- OutputFormatter* formatter() const;
- void setFormatter(OutputFormatter *formatter);
+ Utils::OutputFormatter* formatter() const;
+ 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
void appendText(const QString &text, const QTextCharFormat &format, int maxLineCount);
QString doNewlineEnfocement(const QString &out);
Core::IContext *m_outputWindowContext;
- OutputFormatter *m_formatter;
+ Utils::OutputFormatter *m_formatter;
bool m_enforceNewline;
bool m_scrollToBottom;
buildenvironmentwidget.h \
ldparser.h \
linuxiccparser.h \
- outputformat.h \
- outputformatter.h \
runconfigurationmodel.h \
buildconfigurationmodel.h \
processparameters.h \
buildenvironmentwidget.cpp \
ldparser.cpp \
linuxiccparser.cpp \
- outputformatter.cpp \
runconfigurationmodel.cpp \
buildconfigurationmodel.cpp \
taskhub.cpp \
#include "runconfiguration.h"
-#include "outputformatter.h"
#include "project.h"
#include "target.h"
#include "toolchain.h"
return m_aspects;
}
-ProjectExplorer::OutputFormatter *RunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *RunConfiguration::createOutputFormatter() const
{
- return new OutputFormatter();
+ return new Utils::OutputFormatter();
}
/*!
}
// We need to ensure that there's always a OutputFormatter
if (!m_outputFormatter)
- m_outputFormatter = new OutputFormatter();
+ m_outputFormatter = new Utils::OutputFormatter();
}
RunControl::~RunControl()
delete m_outputFormatter;
}
-OutputFormatter *RunControl::outputFormatter()
+Utils::OutputFormatter *RunControl::outputFormatter()
{
return m_outputFormatter;
}
#endif
}
-void RunControl::appendMessage(const QString &msg, OutputFormat format)
+void RunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
{
emit appendMessage(this, msg, format);
}
#include "abi.h"
#include "projectconfiguration.h"
#include "projectexplorer_export.h"
-#include "outputformat.h"
+
+#include <utils/outputformatter.h>
#include <QtCore/QMetaType>
#include <QtCore/QWeakPointer>
class BuildConfiguration;
class IRunConfigurationAspect;
-class OutputFormatter;
class RunControl;
class Target;
Target *target() const;
- virtual ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ virtual Utils::OutputFormatter *createOutputFormatter() const;
void setUseQmlDebugger(bool value);
void setUseCppDebugger(bool value);
bool sameRunConfiguration(const RunControl *other) const;
- OutputFormatter *outputFormatter();
+ Utils::OutputFormatter *outputFormatter();
QString runMode() const;
public slots:
void bringApplicationToForeground(qint64 pid);
- void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format);
+ void appendMessage(const QString &msg, Utils::OutputFormat format);
signals:
void appendMessage(ProjectExplorer::RunControl *runControl,
- const QString &msg, ProjectExplorer::OutputFormat format);
+ const QString &msg, Utils::OutputFormat format);
void started();
void finished();
QString m_displayName;
QString m_runMode;
const QWeakPointer<RunConfiguration> m_runConfiguration;
- OutputFormatter *m_outputFormatter;
+ Utils::OutputFormatter *m_outputFormatter;
#ifdef Q_OS_MAC
//these two are used to bring apps in the foreground on Mac
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;
}
#define QMLPROFILERENGINE_H
#include <analyzerbase/ianalyzerengine.h>
-#include <projectexplorer/outputformat.h>
+#include <utils/outputformat.h>
namespace QmlProfiler {
namespace Internal {
void setFetchingData(bool);
void dataReceived();
void finishProcess();
- void logApplicationMessage(const QString &msg, ProjectExplorer::OutputFormat format);
+ void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
private:
class QmlProfilerEnginePrivate;
return m_configurationWidget.data();
}
-ProjectExplorer::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
{
return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject());
}
// RunConfiguration
bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const;
virtual QWidget *createConfigurationWidget();
- ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ Utils::OutputFormatter *createOutputFormatter() const;
QVariantMap toMap() const;
ProjectExplorer::Abi abi() const;
}
m_commandLineArguments = runConfiguration->viewerArguments();
- connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,ProjectExplorer::OutputFormat)),
- this, SLOT(slotAppendMessage(QString, ProjectExplorer::OutputFormat)));
+ connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
+ this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
emit started();
QString msg = tr("Starting %1 %2\n")
.arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
}
RunControl::StopResult QmlRunControl::stop()
bringApplicationToForeground(pid);
}
-void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format)
+void QmlRunControl::slotAppendMessage(const QString &line, Utils::OutputFormat format)
{
appendMessage(line, format);
}
{
QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
- appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
+ appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
emit finished();
}
private slots:
void processExited(int exitCode);
void slotBringApplicationToForeground(qint64 pid);
- void slotAppendMessage(const QString &line, ProjectExplorer::OutputFormat);
+ void slotAppendMessage(const QString &line, Utils::OutputFormat);
private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
return m_baseEnvironmentBase;
}
-ProjectExplorer::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
{
return new QtOutputFormatter(qt4Target()->qt4Project());
}
// TODO detectQtShadowBuild() ? how did this work ?
QVariantMap toMap() const;
- ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ Utils::OutputFormatter *createOutputFormatter() const;
signals:
void commandLineArgumentsChanged(const QString&);
return new MaemoRunConfigurationWidget(this);
}
-ProjectExplorer::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const
{
return new QtOutputFormatter(maemoTarget()->qt4Project());
}
using ProjectExplorer::RunConfiguration::isEnabled;
bool isEnabled(ProjectExplorer::BuildConfiguration *config) const;
QWidget *createConfigurationWidget();
- ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ Utils::OutputFormatter *createOutputFormatter() const;
AbstractQt4MaemoTarget *maemoTarget() const;
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
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")
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(),
m_runner->connection()->connectionParameters().userName,
{
if (exitCode != MaemoSshRunner::InvalidExitCode) {
appendMessage(tr("Finished running remote process. Exit code was %1.\n")
- .arg(exitCode), NormalMessageFormat);
+ .arg(exitCode), Utils::NormalMessageFormat);
}
setFinished();
}
void MaemoRunControl::handleRemoteOutput(const QByteArray &output)
{
- appendMessage(QString::fromUtf8(output), StdOutFormatSameLine);
+ appendMessage(QString::fromUtf8(output), Utils::StdOutFormatSameLine);
}
void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output)
{
- appendMessage(QString::fromUtf8(output), StdErrFormatSameLine);
+ appendMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
}
void MaemoRunControl::handleProgressReport(const QString &progressString)
{
- appendMessage(progressString + QLatin1Char('\n'), NormalMessageFormat);
+ appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat);
}
void MaemoRunControl::handleMountDebugOutput(const QString &output)
{
- appendMessage(output, StdErrFormatSameLine);
+ appendMessage(output, Utils::StdErrFormatSameLine);
}
bool MaemoRunControl::isRunning() const
void MaemoRunControl::handleError(const QString &errString)
{
stop();
- appendMessage(errString, ErrorMessageFormat);
+ appendMessage(errString, Utils::ErrorMessageFormat);
QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
}
if (m_address.isEmpty() && m_serialPort.isEmpty()) {
cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again.\n");
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
return false;
}
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
- NormalMessageFormat);
+ Utils::NormalMessageFormat);
return true;
}
if (m_serialPort.length()) {
// 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);
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;
}
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;
}
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
m_codaDevice->setDevice(codaSocket);
codaSocket->connectToHost(m_address, m_port);
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()));
if (debug)
void CodaRunControl::slotError(const QString &error)
{
- appendMessage(tr("Error: %1\n").arg(error), ErrorMessageFormat);
+ appendMessage(tr("Error: %1\n").arg(error), Utils::ErrorMessageFormat);
finishRunControl();
}
if (m_state >= StateConnected)
return;
m_state = StateConnected;
- appendMessage(tr("Connected.\n"), NormalMessageFormat);
+ appendMessage(tr("Connected.\n"), Utils::NormalMessageFormat);
setProgress(maxProgress()*0.80);
emit connected();
if (!m_stopAfterConnect)
= static_cast<const CodaRunControlContextRemovedEvent &>(event).ids();
if (!m_runningProcessId.isEmpty()
&& removedItems.contains(m_runningProcessId.toAscii())) {
- appendMessage(tr("Process has finished.\n"), NormalMessageFormat);
+ appendMessage(tr("Process has finished.\n"), Utils::NormalMessageFormat);
finishRunControl();
}
}
switch (me.reason()) {
case TcfSuspendEvent::Other:
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)
stop();
void CodaRunControl::handleLogging(const CodaEvent &event)
{
const CodaLoggingWriteEvent &me = static_cast<const CodaLoggingWriteEvent &>(event);
- appendMessage(me.message(), StdOutFormat);
+ appendMessage(me.message(), Utils::StdOutFormat);
}
void CodaRunControl::handleAddListener(const CodaCommandResult &result)
{
if (result.values.size() && result.values.at(0).type() == JsonValue::Array && result.values.at(0).children().count()) {
//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();
} else {
setProgress(maxProgress()*0.90);
commandLineArguments().split(' '),
QString(),
true);
- appendMessage(tr("Launching: %1\n").arg(executableName()), NormalMessageFormat);
+ appendMessage(tr("Launching: %1\n").arg(executableName()), Utils::NormalMessageFormat);
}
}
const bool ok = result.type == CodaCommandResult::SuccessReply;
if (ok) {
setProgress(maxProgress());
- appendMessage(tr("Launched.\n"), NormalMessageFormat);
+ appendMessage(tr("Launched.\n"), Utils::NormalMessageFormat);
} else {
- appendMessage(tr("Launch failed: %1\n").arg(result.toString()), ErrorMessageFormat);
+ appendMessage(tr("Launch failed: %1\n").arg(result.toString()), Utils::ErrorMessageFormat);
finishRunControl();
}
}
return;
stop();
- appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
+ appendMessage(tr("Canceled.\n"), Utils::ErrorMessageFormat);
emit finished();
}
{
if (m_codaDevice && device.portName() == m_serialPort) {
QString msg = tr("The device '%1' has been disconnected.\n").arg(device.friendlyName());
- appendMessage(msg, ErrorMessageFormat);
+ appendMessage(msg, Utils::ErrorMessageFormat);
finishRunControl();
}
}
return new S60DeviceRunConfigurationWidget(this);
}
-ProjectExplorer::OutputFormatter *S60DeviceRunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *S60DeviceRunConfiguration::createOutputFormatter() const
{
return new QtOutputFormatter(qt4Target()->qt4Project());
}
if (startParameters().symbolFileName.isEmpty()) {
const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n").
arg(rc->localExecutableFileName());
- appendMessage(msg, ErrorMessageFormat);
+ appendMessage(msg, Utils::ErrorMessageFormat);
}
if (masterSlaveEngineTypes.first == Debugger::QmlEngineType) {
connect(engine(), SIGNAL(requestRemoteSetup()), this, SLOT(remoteSetupRequested()));
void S60DeviceDebugRunControl::start()
{
- appendMessage(tr("Launching debugger...\n"), NormalMessageFormat);
+ appendMessage(tr("Launching debugger...\n"), Utils::NormalMessageFormat);
Debugger::DebuggerRunControl::start();
}
}
}
-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
Q_UNUSED(aCodaRunControl)
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
QWidget *createConfigurationWidget();
- ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ Utils::OutputFormatter *createOutputFormatter() const;
QString commandLineArguments() const;
void setCommandLineArguments(const QString &args);
void qmlEngineStateChanged(const Debugger::DebuggerState &state);
void codaFinished();
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:
CodaRunControl *m_codaRunControl;
return new S60EmulatorRunConfigurationWidget(this);
}
-ProjectExplorer::OutputFormatter *S60EmulatorRunConfiguration::createOutputFormatter() const
+Utils::OutputFormatter *S60EmulatorRunConfiguration::createOutputFormatter() const
{
return new QtOutputFormatter(qt4Target()->qt4Project());
}
m_executable = runConfiguration->executable();
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
this, SLOT(slotError(QString)));
- connect(&m_applicationLauncher, SIGNAL(appendMessage(QString, ProjectExplorer::OutputFormat)),
- this, SLOT(slotAppendMessage(QString, ProjectExplorer::OutputFormat)));
+ connect(&m_applicationLauncher, SIGNAL(appendMessage(QString, Utils::OutputFormat)),
+ this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(processExited(int)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
emit started();
QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
}
RunControl::StopResult S60EmulatorRunControl::stop()
void S60EmulatorRunControl::slotError(const QString & err)
{
- appendMessage(err, ErrorMessageFormat);
+ appendMessage(err, Utils::ErrorMessageFormat);
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 int prefixLength = prefix.length();
void S60EmulatorRunControl::processExited(int exitCode)
{
QString msg = tr("%1 exited with code %2\n");
- appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
+ appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
emit finished();
}
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
QWidget *createConfigurationWidget();
- ProjectExplorer::OutputFormatter *createOutputFormatter() const;
+ Utils::OutputFormatter *createOutputFormatter() const;
QString executable() const;
private slots:
void processExited(int exitCode);
- void slotAppendMessage(const QString &line, ProjectExplorer::OutputFormat);
+ void slotAppendMessage(const QString &line, Utils::OutputFormat);
void slotError(const QString & error);
private:
if (m_runSmartInstaller) { //Smart Installer does the running by itself
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();
return;
}
void S60RunControlBase::handleFinished()
{
- appendMessage(tr("Finished.\n"), NormalMessageFormat);
+ appendMessage(tr("Finished.\n"), Utils::NormalMessageFormat);
}
void S60RunControlBase::setProgress(int value)
if (m_serialPortName.isEmpty()) {
cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again.\n");
- appendMessage(msg, NormalMessageFormat);
+ appendMessage(msg, Utils::NormalMessageFormat);
return false;
}
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
- NormalMessageFormat);
+ Utils::NormalMessageFormat);
return true;
}
QString errorMessage;
m_launcher = trk::Launcher::acquireFromDeviceManager(m_serialPortName, 0, &errorMessage);
if (!m_launcher) {
- appendMessage(errorMessage, ErrorMessageFormat);
+ appendMessage(errorMessage, Utils::ErrorMessageFormat);
return false;
}
if (!m_launcher->startServer(&errorMessage)) {
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 true;
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),
- ErrorMessageFormat);
+ Utils::ErrorMessageFormat);
}
void TrkRunControl::launcherFinished()
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();
}
{
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop();
- appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
+ appendMessage(tr("Canceled.\n"), Utils::ErrorMessageFormat);
emit finished();
}
}
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)
m_launcher->deleteLater();
m_launcher = 0;
QString msg = tr("The device '%1' has been disconnected.\n").arg(d.friendlyName());
- appendMessage(msg, ErrorMessageFormat);
+ appendMessage(msg, Utils::ErrorMessageFormat);
emit finished();
}
}
void TrkRunControl::printStartingNotice()
{
- appendMessage(tr("Starting application...\n"), NormalMessageFormat);
+ appendMessage(tr("Starting application...\n"), Utils::NormalMessageFormat);
}
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());
}
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);
}
return lr;
}
-void QtOutputFormatter::appendMessage(const QString &txt, OutputFormat format)
+void QtOutputFormatter::appendMessage(const QString &txt, Utils::OutputFormat format)
{
QTextCursor cursor(plainTextEdit()->document());
cursor.movePosition(QTextCursor::End);
}
void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr,
- const QString &line, ProjectExplorer::OutputFormat format)
+ const QString &line, Utils::OutputFormat format)
{
const QTextCharFormat normalFormat = charFormat(format);
cursor.insertText(line.left(lr.start), normalFormat);
#include "qt4projectmanager_global.h"
-#include <projectexplorer/outputformatter.h>
+#include <utils/outputformatter.h>
#include <utils/fileinprojectfinder.h>
#include <QtCore/QRegExp>
};
class QT4PROJECTMANAGER_EXPORT QtOutputFormatter
- : public ProjectExplorer::OutputFormatter
+ : public Utils::OutputFormatter
{
Q_OBJECT
public:
QtOutputFormatter(ProjectExplorer::Project *project);
virtual void appendMessage(const QString &text,
- ProjectExplorer::OutputFormat format);
+ Utils::OutputFormat format);
virtual void handleLink(const QString &href);
private slots:
private:
LinkResult matchLine(const QString &line) const;
void appendLine(QTextCursor & cursor, LinkResult lr,
- const QString &line, ProjectExplorer::OutputFormat);
+ const QString &line, Utils::OutputFormat);
QRegExp m_qmlError;
QRegExp m_qtError;