diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index a0ed64d0921c09d46eb042f22d9b2b942379b898..806da13131870cdfa03d2f29410e66047fc88ef8 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -82,8 +82,8 @@ void AbstractProcessStep::setOutputParser(ProjectExplorer::IOutputParser *parser m_outputParserChain = parser; if (m_outputParserChain) { - connect(parser, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(outputAdded(QString, QTextCharFormat))); + connect(parser, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(outputAdded(QString, ProjectExplorer::BuildStep::OutputFormat))); connect(parser, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(taskAdded(ProjectExplorer::Task))); } @@ -199,34 +199,27 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi) void AbstractProcessStep::processStarted() { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::blue); - emit addOutput(tr("Starting: \"%1\" %2\n").arg(QDir::toNativeSeparators(m_command), m_arguments.join(" ")), textCharFormat); + emit addOutput(tr("Starting: \"%1\" %2\n").arg(QDir::toNativeSeparators(m_command), m_arguments.join(" ")), BuildStep::MessageOutput); } void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus status) { - QTextCharFormat textCharFormat; if (status == QProcess::NormalExit && exitCode == 0) { - textCharFormat.setForeground(Qt::blue); - emit addOutput(tr("The process \"%1\" exited normally.").arg(QDir::toNativeSeparators(m_command)), textCharFormat); + emit addOutput(tr("The process \"%1\" exited normally.") + .arg(QDir::toNativeSeparators(m_command)), + BuildStep::MessageOutput); } else if (status == QProcess::NormalExit) { - textCharFormat.setForeground(Qt::red); - textCharFormat.setFontWeight(QFont::Bold); - emit addOutput(tr("The process \"%1\" exited with code %2.").arg(QDir::toNativeSeparators(m_command), QString::number(m_process->exitCode())), textCharFormat); + emit addOutput(tr("The process \"%1\" exited with code %2.") + .arg(QDir::toNativeSeparators(m_command), QString::number(m_process->exitCode())), + BuildStep::ErrorMessageOutput); } else { - textCharFormat.setForeground(Qt::red); - textCharFormat.setFontWeight(QFont::Bold); - emit addOutput(tr("The process \"%1\" crashed.").arg(QDir::toNativeSeparators(m_command)), textCharFormat); + emit addOutput(tr("The process \"%1\" crashed.").arg(QDir::toNativeSeparators(m_command)), BuildStep::ErrorMessageOutput); } } void AbstractProcessStep::processStartupFailed() { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - textCharFormat.setFontWeight(QFont::Bold); - emit addOutput(tr("Could not start process \"%1\"").arg(QDir::toNativeSeparators(m_command)), textCharFormat); + emit addOutput(tr("Could not start process \"%1\"").arg(QDir::toNativeSeparators(m_command)), BuildStep::ErrorMessageOutput); } bool AbstractProcessStep::processSucceeded(int exitCode, QProcess::ExitStatus status) @@ -247,8 +240,7 @@ void AbstractProcessStep::stdOutput(const QString &line) { if (m_outputParserChain) m_outputParserChain->stdOutput(line); - QTextCharFormat textCharFormat; - emit addOutput(line, textCharFormat); + emit addOutput(line, BuildStep::NormalOutput); } void AbstractProcessStep::processReadyReadStdError() @@ -264,9 +256,7 @@ void AbstractProcessStep::stdError(const QString &line) { if (m_outputParserChain) m_outputParserChain->stdError(line); - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - emit addOutput(line, textCharFormat); + emit addOutput(line, BuildStep::ErrorOutput); } void AbstractProcessStep::checkForCancel() @@ -327,9 +317,9 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::Task &task) emit addTask(editable); } -void AbstractProcessStep::outputAdded(const QString &string, const QTextCharFormat &textCharFormat) +void AbstractProcessStep::outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format) { - emit addOutput(string, textCharFormat); + emit addOutput(string, format); } void AbstractProcessStep::slotProcessFinished(int, QProcess::ExitStatus) diff --git a/src/plugins/projectexplorer/abstractprocessstep.h b/src/plugins/projectexplorer/abstractprocessstep.h index de4498a8f431d0bdb38b0e637c990d97884a07fa..603708132b8adbf807ca37e63e204ce2fb8c393a 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.h +++ b/src/plugins/projectexplorer/abstractprocessstep.h @@ -148,7 +148,7 @@ private slots: void taskAdded(const ProjectExplorer::Task &task); - void outputAdded(const QString &string, const QTextCharFormat &format); + void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format); private: QTimer *m_timer; QFutureInterface<bool> *m_futureInterface; diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index c94f5452cf98011af968a014ace6b207d53b7c54..8a3e42393f5d9192b8bec40db47e08554890a088 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -50,6 +50,7 @@ #include <QtCore/QDir> #include <QtCore/QTimer> +#include <QtCore/QMetaType> #include <qtconcurrent/QtConcurrentTools> @@ -96,6 +97,8 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent) m_taskWindow = new TaskWindow(m_taskHub); pm->addObject(m_taskWindow); + qRegisterMetaType<ProjectExplorer::BuildStep::OutputFormat>(); + connect(m_taskWindow, SIGNAL(tasksChanged()), this, SLOT(updateTaskCount())); @@ -156,8 +159,8 @@ void BuildManager::cancel() disconnect(m_currentBuildStep, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(addToTaskWindow(ProjectExplorer::Task))); - disconnect(m_currentBuildStep, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(addToOutputWindow(QString, QTextCharFormat))); + disconnect(m_currentBuildStep, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat))); decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->target()->project()); m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Build canceled")); //TODO NBS fix in qtconcurrent @@ -185,9 +188,7 @@ void BuildManager::finish() void BuildManager::emitCancelMessage() { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - emit addToOutputWindow(tr("Canceled build."), textCharFormat); + emit addToOutputWindow(tr("Canceled build."), BuildStep::ErrorMessageOutput); } void BuildManager::clearBuildQueue() @@ -196,8 +197,8 @@ void BuildManager::clearBuildQueue() decrementActiveBuildSteps(bs->buildConfiguration()->target()->project()); disconnect(bs, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(addToTaskWindow(ProjectExplorer::Task))); - disconnect(bs, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(addToOutputWindow(QString, QTextCharFormat))); + disconnect(bs, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat))); } m_buildQueue.clear(); @@ -287,7 +288,7 @@ void BuildManager::addToTaskWindow(const ProjectExplorer::Task &task) m_taskHub->addTask(task); } -void BuildManager::addToOutputWindow(const QString &string, const QTextCharFormat &format) +void BuildManager::addToOutputWindow(const QString &string, ProjectExplorer::BuildStep::OutputFormat format) { m_outputWindow->appendText(string, format); } @@ -299,8 +300,8 @@ void BuildManager::nextBuildQueue() disconnect(m_currentBuildStep, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(addToTaskWindow(ProjectExplorer::Task))); - disconnect(m_currentBuildStep, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(addToOutputWindow(QString, QTextCharFormat))); + disconnect(m_currentBuildStep, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat))); ++m_progress; m_progressFutureInterface->setProgressValueAndText(m_progress*100, msgProgress(m_progress, m_maxProgress)); @@ -311,10 +312,8 @@ void BuildManager::nextBuildQueue() // Build Failure const QString projectName = m_currentBuildStep->buildConfiguration()->target()->project()->displayName(); const QString targetName = m_currentBuildStep->buildConfiguration()->target()->displayName(); - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - addToOutputWindow(tr("Error while building project %1 (target: %2)").arg(projectName, targetName), textCharFormat); - addToOutputWindow(tr("When executing build step '%1'").arg(m_currentBuildStep->displayName()), textCharFormat); + addToOutputWindow(tr("Error while building project %1 (target: %2)").arg(projectName, targetName), BuildStep::ErrorOutput); + addToOutputWindow(tr("When executing build step '%1'").arg(m_currentBuildStep->displayName()), BuildStep::ErrorOutput); // NBS TODO fix in qtconcurrent m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1 (target: %2)").arg(projectName, targetName)); } @@ -344,10 +343,8 @@ void BuildManager::nextStep() if (m_currentBuildStep->buildConfiguration()->target()->project() != m_previousBuildStepProject) { const QString projectName = m_currentBuildStep->buildConfiguration()->target()->project()->displayName(); - QTextCharFormat textCharFormat; - textCharFormat.setFontWeight(QFont::Bold); addToOutputWindow(tr("Running build steps for project %1...") - .arg(projectName), textCharFormat); + .arg(projectName), BuildStep::MessageOutput); m_previousBuildStepProject = m_currentBuildStep->buildConfiguration()->target()->project(); } m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep)); @@ -373,8 +370,8 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps) BuildStep *bs = steps.at(i); connect(bs, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(addToTaskWindow(ProjectExplorer::Task))); - connect(bs, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(addToOutputWindow(QString, QTextCharFormat))); + connect(bs, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat))); init = bs->init(); if (!init) break; @@ -386,18 +383,16 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps) // print something for the user const QString projectName = bs->buildConfiguration()->target()->project()->displayName(); const QString targetName = bs->buildConfiguration()->target()->displayName(); - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - addToOutputWindow(tr("Error while building project %1 (target: %2)").arg(projectName, targetName), textCharFormat); - addToOutputWindow(tr("When executing build step '%1'").arg(bs->displayName()), textCharFormat); + addToOutputWindow(tr("Error while building project %1 (target: %2)").arg(projectName, targetName), BuildStep::ErrorOutput); + addToOutputWindow(tr("When executing build step '%1'").arg(bs->displayName()), BuildStep::ErrorOutput); // disconnect the buildsteps again for (int j = 0; j <= i; ++j) { BuildStep *bs = steps.at(j); disconnect(bs, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(addToTaskWindow(ProjectExplorer::Task))); - disconnect(bs, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(addToOutputWindow(QString, QTextCharFormat))); + disconnect(bs, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat))); } return false; } diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index 0423d9e807471e4e09ec67da704e27fcd43e9072..04565d5c96faa94ae1583f2baff67093392fb779 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -32,6 +32,7 @@ #include "projectexplorer_export.h" #include "task.h" +#include "buildstep.h" #include <QtCore/QObject> #include <QtCore/QStringList> @@ -99,7 +100,7 @@ signals: private slots: void addToTaskWindow(const ProjectExplorer::Task &task); - void addToOutputWindow(const QString &string, const QTextCharFormat &textCharFormat); + void addToOutputWindow(const QString &string, ProjectExplorer::BuildStep::OutputFormat); void nextBuildQueue(); void progressChanged(); diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index 790646184f3073d6ed9e3cb5defccad8ddb4bde0..065289121f05bb83fc25b93d31675d8cf37474cc 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -104,13 +104,15 @@ public: BuildConfiguration *buildConfiguration() const; + enum OutputFormat { NormalOutput, ErrorOutput, MessageOutput, ErrorMessageOutput }; + signals: // Add a task. void addTask(const ProjectExplorer::Task &task); // The string is added to the generated output, usually in the output // window. // It should be in plain text, with the format in the parameter - void addOutput(const QString &string, const QTextCharFormat &textCharFormat); + void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format); private: BuildConfiguration *m_buildConfiguration; @@ -171,4 +173,6 @@ signals: } // namespace ProjectExplorer +Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputFormat) + #endif // BUILDSTEP_H diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 6424438b7f4945f5cbd72c04d2c7c4231df3397c..f29b31690f36797337adb40c38dd2658c3642e07 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -95,9 +95,36 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *) return m_outputWindow; } -void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat &textCharFormat) -{ - m_outputWindow->appendText(text, textCharFormat, MAX_LINECOUNT); +static QColor mix_colors(QColor a, QColor b) +{ + return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2, + (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2); +} + +void CompileOutputWindow::appendText(const QString &text, ProjectExplorer::BuildStep::OutputFormat format) +{ + QPalette p = m_outputWindow->palette(); + QTextCharFormat textFormat; + switch (format) { + case BuildStep::NormalOutput: + textFormat.setForeground(p.color(QPalette::Text)); + textFormat.setFontWeight(QFont::Normal); + break; + case BuildStep::ErrorOutput: + textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); + textFormat.setFontWeight(QFont::Normal); + break; + case BuildStep::MessageOutput: + textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::blue))); + break; + case BuildStep::ErrorMessageOutput: + textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); + textFormat.setFontWeight(QFont::Bold); + break; + + } + + m_outputWindow->appendText(text, textFormat, MAX_LINECOUNT); } void CompileOutputWindow::clearContents() diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index 5b4e7b8adb257e391b1108a7fbadf307e3ae94fb..aabe740ef2d0bd0b20b7eef1dd0a64e3a9fefb8b 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -31,6 +31,7 @@ #define COMPILEOUTPUTWINDOW_H #include "outputwindow.h" +#include "buildstep.h" #include <coreplugin/ioutputpane.h> #include <QtCore/QHash> @@ -63,7 +64,7 @@ public: int priorityInStatusBar() const; void clearContents(); void visibilityChanged(bool visible); - void appendText(const QString &text, const QTextCharFormat &textCharFormat); + void appendText(const QString &text, ProjectExplorer::BuildStep::OutputFormat format); bool canFocus(); bool hasFocus(); void setFocus(); diff --git a/src/plugins/projectexplorer/ioutputparser.cpp b/src/plugins/projectexplorer/ioutputparser.cpp index ca5b8ba6eb928d926e21a058b064c05c8e4f05a5..fa6c97b3b762da82630f29b279e463f1b61b974c 100644 --- a/src/plugins/projectexplorer/ioutputparser.cpp +++ b/src/plugins/projectexplorer/ioutputparser.cpp @@ -50,8 +50,8 @@ void IOutputParser::appendOutputParser(IOutputParser *parser) } m_parser = parser; - connect(parser, SIGNAL(addOutput(QString, QTextCharFormat)), - this, SLOT(outputAdded(QString, QTextCharFormat)), Qt::DirectConnection); + connect(parser, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)), + this, SLOT(outputAdded(QString, ProjectExplorer::BuildStep::OutputFormat)), Qt::DirectConnection); connect(parser, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(taskAdded(ProjectExplorer::Task)), Qt::DirectConnection); } @@ -84,9 +84,9 @@ void IOutputParser::stdError(const QString &line) m_parser->stdError(line); } -void IOutputParser::outputAdded(const QString &string, const QTextCharFormat &textCharFormat) +void IOutputParser::outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format) { - emit addOutput(string, textCharFormat); + emit addOutput(string, format); } void IOutputParser::taskAdded(const ProjectExplorer::Task &task) diff --git a/src/plugins/projectexplorer/ioutputparser.h b/src/plugins/projectexplorer/ioutputparser.h index ea1a590890edf6300b4c7cf69905233d2e52193c..ba8dfbb47e5564da5c98039805b4d967fc5371f2 100644 --- a/src/plugins/projectexplorer/ioutputparser.h +++ b/src/plugins/projectexplorer/ioutputparser.h @@ -32,6 +32,7 @@ #include "projectexplorer_export.h" #include "task.h" +#include "buildstep.h" #include <QtCore/QObject> #include <QtCore/QString> @@ -67,14 +68,14 @@ signals: /// added to the output. /// Note: This is additional information. There is no need to add each /// line! - void addOutput(const QString &string, const QTextCharFormat &format); + void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format); /// Should be emitted for each task seen in the output. void addTask(const ProjectExplorer::Task &task); public slots: /// Subparsers have their addOutput signal connected to this slot. /// This method can be overwritten to change the string. - virtual void outputAdded(const QString &string, const QTextCharFormat &color); + virtual void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format); /// Subparsers have their addTask signal connected to this slot. /// This method can be overwritten to change the task. virtual void taskAdded(const ProjectExplorer::Task &task); diff --git a/src/plugins/projectexplorer/outputparser_test.cpp b/src/plugins/projectexplorer/outputparser_test.cpp index 2214aa0128eaadba51f6f846c9ce8680843e9dcc..e1ea1a61f122c910d1c7cfd030048dc07b6438fd 100644 --- a/src/plugins/projectexplorer/outputparser_test.cpp +++ b/src/plugins/projectexplorer/outputparser_test.cpp @@ -104,8 +104,7 @@ void OutputParserTester::testOutputMangling(const QString &input, { reset(); - QTextCharFormat textCharFormat; - childParser()->outputAdded(input, textCharFormat); + childParser()->outputAdded(input, BuildStep::NormalOutput); QCOMPARE(m_receivedOutput, output); QVERIFY(m_receivedStdErrChildLine.isNull()); diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index ec9528bd2364392e1cd62b349cd50e2a82884b89..94f6500981d51f482c01b6015720e472138afa38 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -135,9 +135,7 @@ bool MakeStep::init() // Try to detect command in environment const QString tmp = environment.searchInPath(makeCmd); if (tmp.isEmpty()) { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::red); - emit addOutput(tr("Could not find make command: %1 in the build environment").arg(makeCmd), textCharFormat); + emit addOutput(tr("Could not find make command: %1 in the build environment").arg(makeCmd), BuildStep::ErrorOutput); return false; } makeCmd = tmp; diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index c95e1125d3853cbfe3436aaf702c749fad4c4d71..ca97410d735ad28e2571d73a69d1ef0adcf7b866 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -201,17 +201,13 @@ void QMakeStep::run(QFutureInterface<bool> &fi) canContinue = false; } if (!canContinue) { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::blue); - emit addOutput(tr("Configuration is faulty, please check the Build Issues view for details."), textCharFormat); + emit addOutput(tr("Configuration is faulty, please check the Build Issues view for details."), BuildStep::MessageOutput); fi.reportResult(false); return; } if (!m_needToRunQMake) { - QTextCharFormat textCharFormat; - textCharFormat.setForeground(Qt::blue); - emit addOutput(tr("Configuration unchanged, skipping qmake step."), textCharFormat); + emit addOutput(tr("Configuration unchanged, skipping qmake step."), BuildStep::MessageOutput); fi.reportResult(true); return; } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp index 200923f9ffb295080e51dd75ba92fd0070d6b8be..46d562a1a4bd6910925ce11ba973faf2ac0aa0a9 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp @@ -170,7 +170,7 @@ void MaemoDeployStep::raiseError(const QString &errorString) } void MaemoDeployStep::writeOutput(const QString &text, - const QTextCharFormat &format) + ProjectExplorer::BuildStep::OutputFormat format) { emit addOutput(text, format); } @@ -435,9 +435,7 @@ void MaemoDeployStep::handleInstallerOutput(const QByteArray &output) void MaemoDeployStep::handleInstallerErrorOutput(const QByteArray &output) { - QTextCharFormat format; - format.setForeground(QBrush(QColor("red"))); - writeOutput(output, format); + writeOutput(output, BuildStep::ErrorOutput); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h index 2363e1ea85d6ee350179d4c87b51d7a33e79271e..5a11ab166b044625c281a767bc0686ba3032d960 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h @@ -99,8 +99,7 @@ private: void ctor(); void raiseError(const QString &error); - void writeOutput(const QString &text, - const QTextCharFormat &format = QTextCharFormat()); + void writeOutput(const QString &text, ProjectExplorer::BuildStep::OutputFormat = BuildStep::NormalOutput); void addDeployTimesToMap(QVariantMap &map) const; void getDeployTimesFromMap(const QVariantMap &map); const MaemoPackageCreationStep *packagingStep() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 3d8b061557889c940c85728fa340d237646ed931..cb99af65b334cfccdffeedc8ea98f965479d8cf8 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -127,8 +127,7 @@ bool MaemoPackageCreationStep::createPackage() if (!packagingNeeded()) return true; - QTextCharFormat textCharFormat; - emit addOutput(tr("Creating package file ..."), textCharFormat); + emit addOutput(tr("Creating package file ..."), BuildStep::MessageOutput); QFile configFile(targetRoot() % QLatin1String("/config.sh")); if (!configFile.open(QIODevice::ReadOnly)) { raiseError(tr("Cannot open MADDE config file '%1'.") @@ -243,15 +242,14 @@ bool MaemoPackageCreationStep::createPackage() } } - emit addOutput(tr("Package created."), textCharFormat); + emit addOutput(tr("Package created."), BuildStep::MessageOutput); deployStep()->deployables()->setUnmodified(); return true; } bool MaemoPackageCreationStep::runCommand(const QString &command) { - QTextCharFormat textCharFormat; - emit addOutput(tr("Package Creation: Running command '%1'.").arg(command), textCharFormat); + emit addOutput(tr("Package Creation: Running command '%1'.").arg(command), BuildStep::MessageOutput); QString perl; #ifdef Q_OS_WIN perl = maddeRoot() + QLatin1String("/bin/perl.exe "); @@ -281,13 +279,11 @@ bool MaemoPackageCreationStep::runCommand(const QString &command) void MaemoPackageCreationStep::handleBuildOutput() { const QByteArray &stdOut = m_buildProc->readAllStandardOutput(); - QTextCharFormat textCharFormat; if (!stdOut.isEmpty()) - emit addOutput(QString::fromLocal8Bit(stdOut), textCharFormat); + emit addOutput(QString::fromLocal8Bit(stdOut), BuildStep::NormalOutput); const QByteArray &errorOut = m_buildProc->readAllStandardError(); if (!errorOut.isEmpty()) { - textCharFormat.setForeground(QBrush(QColor("red"))); - emit addOutput(QString::fromLocal8Bit(errorOut), textCharFormat); + emit addOutput(QString::fromLocal8Bit(errorOut), BuildStep::ErrorOutput); } } @@ -373,8 +369,7 @@ QString MaemoPackageCreationStep::nativePath(const QFile &file) const void MaemoPackageCreationStep::raiseError(const QString &shortMsg, const QString &detailedMsg) { - QTextCharFormat textCharFormat; - emit addOutput(detailedMsg.isNull() ? shortMsg : detailedMsg, textCharFormat); + emit addOutput(detailedMsg.isNull() ? shortMsg : detailedMsg, BuildStep::ErrorOutput); emit addTask(Task(Task::Error, shortMsg, QString(), -1, TASK_CATEGORY_BUILDSYSTEM)); }