Commit 1b1663a2 authored by hjk's avatar hjk
Browse files

introduce a appendMessage overload not requiring the 'this' parameter

parent 4170843f
...@@ -445,12 +445,12 @@ void DebuggerRunControl::start() ...@@ -445,12 +445,12 @@ void DebuggerRunControl::start()
d->m_engine->startDebugger(this); d->m_engine->startDebugger(this);
if (d->m_running) if (d->m_running)
emit appendMessage(this, tr("Debugging starts"), NormalMessageFormat); appendMessage(tr("Debugging starts"), NormalMessageFormat);
} }
void DebuggerRunControl::startFailed() void DebuggerRunControl::startFailed()
{ {
emit appendMessage(this, tr("Debugging has failed"), NormalMessageFormat); appendMessage(tr("Debugging has failed"), NormalMessageFormat);
d->m_running = false; d->m_running = false;
emit finished(); emit finished();
d->m_engine->handleStartFailed(); d->m_engine->handleStartFailed();
...@@ -458,7 +458,7 @@ void DebuggerRunControl::startFailed() ...@@ -458,7 +458,7 @@ void DebuggerRunControl::startFailed()
void DebuggerRunControl::handleFinished() void DebuggerRunControl::handleFinished()
{ {
emit appendMessage(this, tr("Debugging has finished"), NormalMessageFormat); appendMessage(tr("Debugging has finished"), 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);
...@@ -468,13 +468,13 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel) ...@@ -468,13 +468,13 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
{ {
switch (channel) { switch (channel) {
case AppOutput: case AppOutput:
emit appendMessage(this, msg, StdOutFormatSameLine); appendMessage(msg, StdOutFormatSameLine);
break; break;
case AppError: case AppError:
emit appendMessage(this, msg, StdErrFormatSameLine); appendMessage(msg, StdErrFormatSameLine);
break; break;
case AppStuff: case AppStuff:
emit appendMessage(this, msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
break; break;
} }
} }
...@@ -648,7 +648,7 @@ DebuggerRunControl *DebuggerRunControlFactory::create ...@@ -648,7 +648,7 @@ DebuggerRunControl *DebuggerRunControlFactory::create
if (!DebuggerRunControl::checkDebugConfiguration(sp.toolChainType, if (!DebuggerRunControl::checkDebugConfiguration(sp.toolChainType,
&errorMessage, &settingsCategory, &settingsPage)) { &errorMessage, &settingsCategory, &settingsPage)) {
//emit appendMessage(this, errorMessage, true); //appendMessage(errorMessage, true);
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"), Core::ICore::instance()->showWarningWithOptions(tr("Debugger"),
errorMessage, QString(), settingsCategory, settingsPage); errorMessage, QString(), settingsCategory, settingsPage);
return 0; return 0;
......
...@@ -108,7 +108,7 @@ void LocalApplicationRunControl::start() ...@@ -108,7 +108,7 @@ void LocalApplicationRunControl::start()
emit started(); emit started();
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable));
emit appendMessage(this, msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop() LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
...@@ -125,14 +125,14 @@ bool LocalApplicationRunControl::isRunning() const ...@@ -125,14 +125,14 @@ bool LocalApplicationRunControl::isRunning() const
void LocalApplicationRunControl::slotAppendMessage(const QString &err, void LocalApplicationRunControl::slotAppendMessage(const QString &err,
OutputFormat format) OutputFormat format)
{ {
emit appendMessage(this, err, format); appendMessage(err, format);
} }
void LocalApplicationRunControl::processExited(int exitCode) void LocalApplicationRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2") QString msg = tr("%1 exited with code %2")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
emit appendMessage(this, msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
emit finished(); emit finished();
} }
......
...@@ -367,3 +367,8 @@ void RunControl::bringApplicationToForegroundInternal() ...@@ -367,3 +367,8 @@ void RunControl::bringApplicationToForegroundInternal()
} }
#endif #endif
} }
void RunControl::appendMessage(const QString &msg, OutputFormat format)
{
emit appendMessage(this, msg, format);
}
...@@ -201,16 +201,16 @@ public: ...@@ -201,16 +201,16 @@ public:
OutputFormatter *outputFormatter(); OutputFormatter *outputFormatter();
QString runMode() const; QString runMode() const;
public slots:
void bringApplicationToForeground(qint64 pid);
void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format);
signals: signals:
void appendMessage(ProjectExplorer::RunControl *, const QString &error, void appendMessage(ProjectExplorer::RunControl *runControl,
ProjectExplorer::OutputFormat); const QString &msg, ProjectExplorer::OutputFormat format);
void started(); void started();
void finished(); void finished();
public slots:
void bringApplicationToForeground(qint64 pid);
void appendMessage(const QString &error, ProjectExplorer::OutputFormat);
private slots: private slots:
void bringApplicationToForegroundInternal(); void bringApplicationToForegroundInternal();
......
...@@ -98,7 +98,7 @@ void QmlRunControl::start() ...@@ -98,7 +98,7 @@ void QmlRunControl::start()
emit started(); emit started();
QString msg = tr("Starting %1 %2") QString msg = tr("Starting %1 %2")
.arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments); .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
appendMessage(this, msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
RunControl::StopResult QmlRunControl::stop() RunControl::StopResult QmlRunControl::stop()
...@@ -119,14 +119,14 @@ void QmlRunControl::slotBringApplicationToForeground(qint64 pid) ...@@ -119,14 +119,14 @@ void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format) void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format)
{ {
emit appendMessage(this, line, format); appendMessage(line, format);
} }
void QmlRunControl::processExited(int exitCode) void QmlRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2") QString msg = tr("%1 exited with code %2")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
emit appendMessage(this, msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
emit finished(); emit finished();
} }
......
...@@ -100,7 +100,7 @@ void MaemoRunControl::handleSshError(const QString &error) ...@@ -100,7 +100,7 @@ void MaemoRunControl::handleSshError(const QString &error)
void MaemoRunControl::startExecution() void MaemoRunControl::startExecution()
{ {
emit appendMessage(this, tr("Starting remote process ..."), NormalMessageFormat); appendMessage(tr("Starting remote process ..."), NormalMessageFormat);
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4") m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->remoteExecutable())) .arg(MaemoGlobal::remoteCommandPrefix(m_runner->remoteExecutable()))
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges())) .arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
...@@ -111,8 +111,7 @@ void MaemoRunControl::startExecution() ...@@ -111,8 +111,7 @@ void MaemoRunControl::startExecution()
void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode) void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
{ {
if (exitCode != MaemoSshRunner::InvalidExitCode) { if (exitCode != MaemoSshRunner::InvalidExitCode) {
emit appendMessage(this, appendMessage(tr("Finished running remote process. Exit code was %1.")
tr("Finished running remote process. Exit code was %1.")
.arg(exitCode), NormalMessageFormat); .arg(exitCode), NormalMessageFormat);
} }
setFinished(); setFinished();
...@@ -120,22 +119,22 @@ void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode) ...@@ -120,22 +119,22 @@ void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
void MaemoRunControl::handleRemoteOutput(const QByteArray &output) void MaemoRunControl::handleRemoteOutput(const QByteArray &output)
{ {
emit appendMessage(this, QString::fromUtf8(output), StdOutFormatSameLine); appendMessage(QString::fromUtf8(output), StdOutFormatSameLine);
} }
void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output) void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output)
{ {
emit appendMessage(this, QString::fromUtf8(output), StdErrFormatSameLine); appendMessage(QString::fromUtf8(output), StdErrFormatSameLine);
} }
void MaemoRunControl::handleProgressReport(const QString &progressString) void MaemoRunControl::handleProgressReport(const QString &progressString)
{ {
emit appendMessage(this, progressString, NormalMessageFormat); appendMessage(progressString, NormalMessageFormat);
} }
void MaemoRunControl::handleMountDebugOutput(const QString &output) void MaemoRunControl::handleMountDebugOutput(const QString &output)
{ {
emit appendMessage(this, output, StdErrFormatSameLine); appendMessage(output, StdErrFormatSameLine);
} }
bool MaemoRunControl::isRunning() const bool MaemoRunControl::isRunning() const
...@@ -146,7 +145,7 @@ bool MaemoRunControl::isRunning() const ...@@ -146,7 +145,7 @@ bool MaemoRunControl::isRunning() const
void MaemoRunControl::handleError(const QString &errString) void MaemoRunControl::handleError(const QString &errString)
{ {
stop(); stop();
emit appendMessage(this, errString, ErrorMessageFormat); appendMessage(errString, ErrorMessageFormat);
QMessageBox::critical(0, tr("Remote Execution Failure"), errString); QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
} }
......
...@@ -542,12 +542,12 @@ void S60DeviceRunControl::start() ...@@ -542,12 +542,12 @@ void S60DeviceRunControl::start()
if (m_serialPortName.isEmpty()) { if (m_serialPortName.isEmpty()) {
m_launchProgress->reportCanceled(); m_launchProgress->reportCanceled();
QString msg = tr("No device is connected. Please connect a device and try again."); QString msg = tr("No device is connected. Please connect a device and try again.");
appendMessage(this, msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
emit finished(); emit finished();
return; return;
} }
emit appendMessage(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName)), appendMessage(tr("Executable file: %1").arg(msgListFile(m_executableFileName)),
NormalMessageFormat); NormalMessageFormat);
QString errorMessage; QString errorMessage;
...@@ -555,7 +555,7 @@ void S60DeviceRunControl::start() ...@@ -555,7 +555,7 @@ void S60DeviceRunControl::start()
QString settingsPage; QString settingsPage;
if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) { if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) {
m_launchProgress->reportCanceled(); m_launchProgress->reportCanceled();
appendMessage(this, errorMessage, ErrorMessageFormat); appendMessage(errorMessage, ErrorMessageFormat);
emit finished(); emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"), Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
errorMessage, QString(), errorMessage, QString(),
...@@ -588,7 +588,7 @@ void S60DeviceRunControl::startLaunching() ...@@ -588,7 +588,7 @@ void S60DeviceRunControl::startLaunching()
m_launchProgress->setProgressValue(PROGRESS_MAX/2); m_launchProgress->setProgressValue(PROGRESS_MAX/2);
} else { } else {
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
appendMessage(this, errorMessage, ErrorMessageFormat); appendMessage(errorMessage, ErrorMessageFormat);
stop(); stop();
emit finished(); emit finished();
} }
...@@ -629,7 +629,7 @@ bool S60DeviceRunControl::setupLauncher(QString &errorMessage) ...@@ -629,7 +629,7 @@ bool S60DeviceRunControl::setupLauncher(QString &errorMessage)
void S60DeviceRunControl::printConnectFailed(const QString &errorMessage) void S60DeviceRunControl::printConnectFailed(const QString &errorMessage)
{ {
emit appendMessage(this, tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage), appendMessage(tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage),
ErrorMessageFormat); ErrorMessageFormat);
} }
...@@ -652,7 +652,7 @@ void S60DeviceRunControl::reportDeployFinished() ...@@ -652,7 +652,7 @@ void S60DeviceRunControl::reportDeployFinished()
void S60DeviceRunControl::processStopped(uint pc, uint pid, uint tid, const QString &reason) void S60DeviceRunControl::processStopped(uint pc, uint pid, uint tid, const QString &reason)
{ {
appendMessage(this, trk::Launcher::msgStopped(pid, tid, pc, reason), StdOutFormat); appendMessage(trk::Launcher::msgStopped(pid, tid, pc, reason), StdOutFormat);
m_launcher->terminate(); m_launcher->terminate();
} }
...@@ -683,7 +683,7 @@ void S60DeviceRunControl::slotWaitingForTrkClosed() ...@@ -683,7 +683,7 @@ void S60DeviceRunControl::slotWaitingForTrkClosed()
{ {
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) { if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop(); stop();
appendMessage(this, tr("Canceled."), ErrorMessageFormat); appendMessage(tr("Canceled."), ErrorMessageFormat);
emit finished(); emit finished();
} }
} }
...@@ -695,7 +695,7 @@ void S60DeviceRunControl::printApplicationOutput(const QString &output) ...@@ -695,7 +695,7 @@ void S60DeviceRunControl::printApplicationOutput(const QString &output)
void S60DeviceRunControl::printApplicationOutput(const QString &output, bool onStdErr) void S60DeviceRunControl::printApplicationOutput(const QString &output, bool onStdErr)
{ {
appendMessage(this, output, onStdErr ? StdErrFormat : StdOutFormat); appendMessage(output, onStdErr ? StdErrFormat : StdOutFormat);
} }
void S60DeviceRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d) void S60DeviceRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
...@@ -705,7 +705,7 @@ void S60DeviceRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d) ...@@ -705,7 +705,7 @@ void S60DeviceRunControl::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").arg(d.friendlyName()); QString msg = tr("The device '%1' has been disconnected").arg(d.friendlyName());
appendMessage(this, msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
emit finished(); emit finished();
} }
} }
...@@ -730,24 +730,24 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher ...@@ -730,24 +730,24 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher
void S60DeviceRunControl::handleLauncherFinished() void S60DeviceRunControl::handleLauncherFinished()
{ {
emit finished(); emit finished();
emit appendMessage(this, tr("Finished."), NormalMessageFormat); appendMessage(tr("Finished."), NormalMessageFormat);
} }
void S60DeviceRunControl::printStartingNotice() void S60DeviceRunControl::printStartingNotice()
{ {
emit appendMessage(this, tr("Starting application..."), NormalMessageFormat); appendMessage(tr("Starting application..."), NormalMessageFormat);
} }
void S60DeviceRunControl::applicationRunNotice(uint pid) void S60DeviceRunControl::applicationRunNotice(uint pid)
{ {
emit appendMessage(this, tr("Application running with pid %1.").arg(pid), NormalMessageFormat); appendMessage(tr("Application running with pid %1.").arg(pid), NormalMessageFormat);
if (m_launchProgress) if (m_launchProgress)
m_launchProgress->setProgressValue(PROGRESS_MAX); m_launchProgress->setProgressValue(PROGRESS_MAX);
} }
void S60DeviceRunControl::applicationRunFailedNotice(const QString &errorMessage) void S60DeviceRunControl::applicationRunFailedNotice(const QString &errorMessage)
{ {
emit appendMessage(this, tr("Could not start application: %1").arg(errorMessage), NormalMessageFormat); appendMessage(tr("Could not start application: %1").arg(errorMessage), NormalMessageFormat);
} }
// ======== S60DeviceDebugRunControl // ======== S60DeviceDebugRunControl
...@@ -812,7 +812,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc ...@@ -812,7 +812,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."). const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.").
arg(localExecutable(rc)); arg(localExecutable(rc));
emit appendMessage(this, msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
} }
} }
...@@ -823,7 +823,7 @@ void S60DeviceDebugRunControl::start() ...@@ -823,7 +823,7 @@ void S60DeviceDebugRunControl::start()
QString settingsPage; QString settingsPage;
if (!Debugger::DebuggerRunControl::checkDebugConfiguration(startParameters().toolChainType, if (!Debugger::DebuggerRunControl::checkDebugConfiguration(startParameters().toolChainType,
&errorMessage, &settingsCategory, &settingsPage)) { &errorMessage, &settingsCategory, &settingsPage)) {
appendMessage(this, errorMessage, ErrorMessageFormat); appendMessage(errorMessage, ErrorMessageFormat);
emit finished(); emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"), Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
errorMessage, QString(), errorMessage, QString(),
...@@ -831,6 +831,6 @@ void S60DeviceDebugRunControl::start() ...@@ -831,6 +831,6 @@ void S60DeviceDebugRunControl::start()
return; return;
} }
emit appendMessage(this, tr("Launching debugger..."), NormalMessageFormat); appendMessage(tr("Launching debugger..."), NormalMessageFormat);
Debugger::DebuggerRunControl::start(); Debugger::DebuggerRunControl::start();
} }
...@@ -349,7 +349,7 @@ void S60EmulatorRunControl::start() ...@@ -349,7 +349,7 @@ void S60EmulatorRunControl::start()
emit started(); emit started();
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable));
emit appendMessage(this, msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
RunControl::StopResult S60EmulatorRunControl::stop() RunControl::StopResult S60EmulatorRunControl::stop()
...@@ -365,7 +365,7 @@ bool S60EmulatorRunControl::isRunning() const ...@@ -365,7 +365,7 @@ bool S60EmulatorRunControl::isRunning() const
void S60EmulatorRunControl::slotError(const QString & err) void S60EmulatorRunControl::slotError(const QString & err)
{ {
emit appendMessage(this, err, ErrorMessageFormat); appendMessage(err, ErrorMessageFormat);
emit finished(); emit finished();
} }
...@@ -375,12 +375,12 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat ...@@ -375,12 +375,12 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat
static int prefixLength = prefix.length(); static int prefixLength = prefix.length();
int index = line.indexOf(prefix); int index = line.indexOf(prefix);
if (index != -1) if (index != -1)
emit appendMessage(this, line.mid(index + prefixLength + 1), format); appendMessage(line.mid(index + prefixLength + 1), format);
} }
void S60EmulatorRunControl::processExited(int exitCode) void S60EmulatorRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2"); QString msg = tr("%1 exited with code %2");
emit appendMessage(this, msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
emit finished(); emit finished();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment