OSDN Git Service

introduce a appendMessage overload not requiring the 'this' parameter
authorhjk <qtc-committer@nokia.com>
Fri, 7 Jan 2011 17:57:54 +0000 (18:57 +0100)
committerhjk <qtc-committer@nokia.com>
Mon, 10 Jan 2011 09:18:45 +0000 (10:18 +0100)
src/plugins/debugger/debuggerrunner.cpp
src/plugins/projectexplorer/localapplicationruncontrol.cpp
src/plugins/projectexplorer/runconfiguration.cpp
src/plugins/projectexplorer/runconfiguration.h
src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp

index 1b0e4c1..201e093 100644 (file)
@@ -445,12 +445,12 @@ void DebuggerRunControl::start()
     d->m_engine->startDebugger(this);
 
     if (d->m_running)
-        emit appendMessage(this, tr("Debugging starts"), NormalMessageFormat);
+        appendMessage(tr("Debugging starts"), NormalMessageFormat);
 }
 
 void DebuggerRunControl::startFailed()
 {
-    emit appendMessage(this, tr("Debugging has failed"), NormalMessageFormat);
+    appendMessage(tr("Debugging has failed"), NormalMessageFormat);
     d->m_running = false;
     emit finished();
     d->m_engine->handleStartFailed();
@@ -458,7 +458,7 @@ void DebuggerRunControl::startFailed()
 
 void DebuggerRunControl::handleFinished()
 {
-    emit appendMessage(this, tr("Debugging has finished"), NormalMessageFormat);
+    appendMessage(tr("Debugging has finished"), NormalMessageFormat);
     if (d->m_engine)
         d->m_engine->handleFinished();
     debuggerCore()->runControlFinished(d->m_engine);
@@ -468,13 +468,13 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
 {
     switch (channel) {
         case AppOutput:
-            emit appendMessage(this, msg, StdOutFormatSameLine);
+            appendMessage(msg, StdOutFormatSameLine);
             break;
         case AppError:
-            emit appendMessage(this, msg, StdErrFormatSameLine);
+            appendMessage(msg, StdErrFormatSameLine);
             break;
         case AppStuff:
-            emit appendMessage(this, msg, NormalMessageFormat);
+            appendMessage(msg, NormalMessageFormat);
             break;
     }
 }
@@ -648,7 +648,7 @@ DebuggerRunControl *DebuggerRunControlFactory::create
 
     if (!DebuggerRunControl::checkDebugConfiguration(sp.toolChainType,
             &errorMessage, &settingsCategory, &settingsPage)) {
-        //emit appendMessage(this, errorMessage, true);
+        //appendMessage(errorMessage, true);
         Core::ICore::instance()->showWarningWithOptions(tr("Debugger"),
             errorMessage, QString(), settingsCategory, settingsPage);
         return 0;
index cb36a0d..6e4f2a4 100644 (file)
@@ -108,7 +108,7 @@ void LocalApplicationRunControl::start()
     emit started();
 
     QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable));
-    emit appendMessage(this, msg, NormalMessageFormat);
+    appendMessage(msg, NormalMessageFormat);
 }
 
 LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
@@ -125,14 +125,14 @@ bool LocalApplicationRunControl::isRunning() const
 void LocalApplicationRunControl::slotAppendMessage(const QString &err,
                                                    OutputFormat format)
 {
-    emit appendMessage(this, err, format);
+    appendMessage(err, format);
 }
 
 void LocalApplicationRunControl::processExited(int exitCode)
 {
     QString msg = tr("%1 exited with code %2")
         .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
-    emit appendMessage(this, msg, ErrorMessageFormat);
+    appendMessage(msg, ErrorMessageFormat);
     emit finished();
 }
 
index 7bfa07c..6d12c89 100644 (file)
@@ -367,3 +367,8 @@ void RunControl::bringApplicationToForegroundInternal()
     }
 #endif
 }
+
+void RunControl::appendMessage(const QString &msg, OutputFormat format)
+{
+    emit appendMessage(this, msg, format);
+}
index 9695b07..1d51e8f 100644 (file)
@@ -201,16 +201,16 @@ public:
     OutputFormatter *outputFormatter();
     QString runMode() const;
 
+public slots:
+    void bringApplicationToForeground(qint64 pid);
+    void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format);
+
 signals:
-    void appendMessage(ProjectExplorer::RunControl *, const QString &error,
-        ProjectExplorer::OutputFormat);
+    void appendMessage(ProjectExplorer::RunControl *runControl,
+        const QString &msg, ProjectExplorer::OutputFormat format);
     void started();
     void finished();
 
-public slots:
-    void bringApplicationToForeground(qint64 pid);
-    void appendMessage(const QString &error, ProjectExplorer::OutputFormat);
-
 private slots:
     void bringApplicationToForegroundInternal();
 
index cec33a8..e0673de 100644 (file)
@@ -98,7 +98,7 @@ void QmlRunControl::start()
     emit started();
     QString msg = tr("Starting %1 %2")
         .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
-    appendMessage(this, msg, NormalMessageFormat);
+    appendMessage(msg, NormalMessageFormat);
 }
 
 RunControl::StopResult QmlRunControl::stop()
@@ -119,14 +119,14 @@ void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
 
 void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format)
 {
-    emit appendMessage(this, line, format);
+    appendMessage(line, format);
 }
 
 void QmlRunControl::processExited(int exitCode)
 {
     QString msg = tr("%1 exited with code %2")
         .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
-    emit appendMessage(this, msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
+    appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
     emit finished();
 }
 
index 673dc63..b3b74cc 100644 (file)
@@ -100,7 +100,7 @@ void MaemoRunControl::handleSshError(const QString &error)
 
 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")
         .arg(MaemoGlobal::remoteCommandPrefix(m_runner->remoteExecutable()))
         .arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
@@ -111,8 +111,7 @@ void MaemoRunControl::startExecution()
 void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
 {
     if (exitCode != MaemoSshRunner::InvalidExitCode) {
-        emit appendMessage(this,
-            tr("Finished running remote process. Exit code was %1.")
+        appendMessage(tr("Finished running remote process. Exit code was %1.")
             .arg(exitCode), NormalMessageFormat);
     }
     setFinished();
@@ -120,22 +119,22 @@ void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
 
 void MaemoRunControl::handleRemoteOutput(const QByteArray &output)
 {
-    emit appendMessage(this, QString::fromUtf8(output), StdOutFormatSameLine);
+    appendMessage(QString::fromUtf8(output), StdOutFormatSameLine);
 }
 
 void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output)
 {
-    emit appendMessage(this, QString::fromUtf8(output), StdErrFormatSameLine);
+    appendMessage(QString::fromUtf8(output), StdErrFormatSameLine);
 }
 
 void MaemoRunControl::handleProgressReport(const QString &progressString)
 {
-    emit appendMessage(this, progressString, NormalMessageFormat);
+    appendMessage(progressString, NormalMessageFormat);
 }
 
 void MaemoRunControl::handleMountDebugOutput(const QString &output)
 {
-    emit appendMessage(this, output, StdErrFormatSameLine);
+    appendMessage(output, StdErrFormatSameLine);
 }
 
 bool MaemoRunControl::isRunning() const
@@ -146,7 +145,7 @@ bool MaemoRunControl::isRunning() const
 void MaemoRunControl::handleError(const QString &errString)
 {
     stop();
-    emit appendMessage(this, errString, ErrorMessageFormat);
+    appendMessage(errString, ErrorMessageFormat);
     QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
 }
 
index c02743c..5afd7df 100644 (file)
@@ -542,12 +542,12 @@ void S60DeviceRunControl::start()
     if (m_serialPortName.isEmpty()) {
         m_launchProgress->reportCanceled();
         QString msg = tr("No device is connected. Please connect a device and try again.");
-        appendMessage(this, msg, NormalMessageFormat);
+        appendMessage(msg, NormalMessageFormat);
         emit finished();
         return;
     }
 
-    emit appendMessage(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName)),
+    appendMessage(tr("Executable file: %1").arg(msgListFile(m_executableFileName)),
         NormalMessageFormat);
 
     QString errorMessage;
@@ -555,7 +555,7 @@ void S60DeviceRunControl::start()
     QString settingsPage;
     if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) {
         m_launchProgress->reportCanceled();
-        appendMessage(this, errorMessage, ErrorMessageFormat);
+        appendMessage(errorMessage, ErrorMessageFormat);
         emit finished();
         Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
                                                         errorMessage, QString(),
@@ -588,7 +588,7 @@ void S60DeviceRunControl::startLaunching()
                     m_launchProgress->setProgressValue(PROGRESS_MAX/2);
     } else {
         if (!errorMessage.isEmpty())
-            appendMessage(this, errorMessage, ErrorMessageFormat);
+            appendMessage(errorMessage, ErrorMessageFormat);
         stop();
         emit finished();
     }
@@ -629,7 +629,7 @@ bool S60DeviceRunControl::setupLauncher(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);
 }
 
@@ -652,7 +652,7 @@ void S60DeviceRunControl::reportDeployFinished()
 
 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();
 }
 
@@ -683,7 +683,7 @@ void S60DeviceRunControl::slotWaitingForTrkClosed()
 {
     if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
         stop();
-        appendMessage(this, tr("Canceled."), ErrorMessageFormat);
+        appendMessage(tr("Canceled."), ErrorMessageFormat);
         emit finished();
     }
 }
@@ -695,7 +695,7 @@ void S60DeviceRunControl::printApplicationOutput(const QString &output)
 
 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)
@@ -705,7 +705,7 @@ void S60DeviceRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
         m_launcher->deleteLater();
         m_launcher = 0;
         QString msg = tr("The device '%1' has been disconnected").arg(d.friendlyName());
-        appendMessage(this, msg, ErrorMessageFormat);
+        appendMessage(msg, ErrorMessageFormat);
         emit finished();
     }
 }
@@ -730,24 +730,24 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher
 void S60DeviceRunControl::handleLauncherFinished()
 {
      emit finished();
-     emit appendMessage(this, tr("Finished."), NormalMessageFormat);
+     appendMessage(tr("Finished."), NormalMessageFormat);
  }
 
 void S60DeviceRunControl::printStartingNotice()
 {
-    emit appendMessage(this, tr("Starting application..."), NormalMessageFormat);
+    appendMessage(tr("Starting application..."), NormalMessageFormat);
 }
 
 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)
         m_launchProgress->setProgressValue(PROGRESS_MAX);
 }
 
 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
@@ -812,7 +812,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
     if (startParameters().symbolFileName.isEmpty()) {
         const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.").
                                arg(localExecutable(rc));
-        emit appendMessage(this, msg, ErrorMessageFormat);
+        appendMessage(msg, ErrorMessageFormat);
     }
 }
 
@@ -823,7 +823,7 @@ void S60DeviceDebugRunControl::start()
     QString settingsPage;
     if (!Debugger::DebuggerRunControl::checkDebugConfiguration(startParameters().toolChainType,
                                                                &errorMessage, &settingsCategory, &settingsPage)) {
-        appendMessage(this, errorMessage, ErrorMessageFormat);
+        appendMessage(errorMessage, ErrorMessageFormat);
         emit finished();
         Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
                                                         errorMessage, QString(),
@@ -831,6 +831,6 @@ void S60DeviceDebugRunControl::start()
         return;
     }
 
-    emit appendMessage(this, tr("Launching debugger..."), NormalMessageFormat);
+    appendMessage(tr("Launching debugger..."), NormalMessageFormat);
     Debugger::DebuggerRunControl::start();
 }
index 434c0fb..614b864 100644 (file)
@@ -349,7 +349,7 @@ void S60EmulatorRunControl::start()
     emit started();
 
     QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable));
-    emit appendMessage(this, msg, NormalMessageFormat);
+    appendMessage(msg, NormalMessageFormat);
 }
 
 RunControl::StopResult S60EmulatorRunControl::stop()
@@ -365,7 +365,7 @@ bool S60EmulatorRunControl::isRunning() const
 
 void S60EmulatorRunControl::slotError(const QString & err)
 {
-    emit appendMessage(this, err, ErrorMessageFormat);
+    appendMessage(err, ErrorMessageFormat);
     emit finished();
 }
 
@@ -375,12 +375,12 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat
     static int prefixLength = prefix.length();
     int index = line.indexOf(prefix);
     if (index != -1)
-        emit appendMessage(this, line.mid(index + prefixLength + 1), format);
+        appendMessage(line.mid(index + prefixLength + 1), format);
 }
 
 void S60EmulatorRunControl::processExited(int exitCode)
 {
     QString msg = tr("%1 exited with code %2");
-    emit appendMessage(this, msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
+    appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
     emit finished();
 }