diff options
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r-- | src/plugins/winrt/winrtdebugsupport.cpp | 35 | ||||
-rw-r--r-- | src/plugins/winrt/winrtdebugsupport.h | 4 | ||||
-rw-r--r-- | src/plugins/winrt/winrtrunfactories.cpp | 11 |
3 files changed, 24 insertions, 26 deletions
diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp index 352ac3f3f9..7499200df1 100644 --- a/src/plugins/winrt/winrtdebugsupport.cpp +++ b/src/plugins/winrt/winrtdebugsupport.cpp @@ -45,7 +45,7 @@ using namespace ProjectExplorer; namespace WinRt { namespace Internal { -WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl, QString *errorMessage) +WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl) : DebuggerRunTool(runControl) { // FIXME: This is just working for local debugging; @@ -57,35 +57,38 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl, QString *errorMessa QFileInfo debuggerHelper(QCoreApplication::applicationDirPath() + QLatin1String("/winrtdebughelper.exe")); if (!debuggerHelper.isExecutable()) { - *errorMessage = tr("The WinRT debugging helper is missing from your Qt Creator " - "installation. It was assumed to be located at %1").arg( - debuggerHelper.absoluteFilePath()); + reportFailure(tr("The WinRT debugging helper is missing from your Qt Creator " + "installation. It was assumed to be located at %1").arg( + debuggerHelper.absoluteFilePath())); return; } if (isQmlDebugging()) { Utils::Port qmlDebugPort; - if (!getFreePort(qmlDebugPort, errorMessage)) + if (!getFreePort(qmlDebugPort)) return; params.qmlServer.host = QHostAddress(QHostAddress::LocalHost).toString(); params.qmlServer.port = qmlDebugPort; } - m_runner = new WinRtRunnerHelper(this, errorMessage); - if (!errorMessage->isEmpty()) + QString errorMessage; + m_runner = new WinRtRunnerHelper(this, &errorMessage); + if (!errorMessage.isEmpty()) { + reportFailure(errorMessage); return; + } QLocalServer server; server.listen(QLatin1String("QtCreatorWinRtDebugPIDPipe")); m_runner->debug(debuggerHelper.absoluteFilePath()); if (!m_runner->waitForStarted()) { - *errorMessage = tr("Cannot start the WinRT Runner Tool."); + reportFailure(tr("Cannot start the WinRT Runner Tool.")); return; } if (!server.waitForNewConnection(10000)) { - *errorMessage = tr("Cannot establish connection to the WinRT debugging helper."); + reportFailure(tr("Cannot establish connection to the WinRT debugging helper.")); return; } @@ -98,12 +101,12 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl, QString *errorMessa bool ok =false; params.attachPID = Utils::ProcessHandle(arg.last().toInt(&ok)); if (!ok) { - *errorMessage = tr("Cannot extract the PID from the WinRT debugging helper. " - "(output: %1)").arg(QString::fromLocal8Bit(output)); + reportFailure(tr("Cannot extract the PID from the WinRT debugging helper. " + "(output: %1)").arg(QString::fromLocal8Bit(output))); return; } server.close(); - setStartParameters(params, errorMessage); + setStartParameters(params); return; } } @@ -111,16 +114,16 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl, QString *errorMessa server.close(); - *errorMessage = tr("Cannot create an appropriate run control for " - "the current run configuration."); + reportFailure(tr("Cannot create an appropriate run control for " + "the current run configuration.")); } -bool WinRtDebugSupport::getFreePort(Utils::Port &qmlDebuggerPort, QString *errorMessage) +bool WinRtDebugSupport::getFreePort(Utils::Port &qmlDebuggerPort) { QTcpServer server; if (!server.listen(QHostAddress::LocalHost, qmlDebuggerPort.isValid() ? qmlDebuggerPort.number() : 0)) { - *errorMessage = tr("Not enough free ports for QML debugging."); + reportFailure(tr("Not enough free ports for QML debugging.")); return false; } qmlDebuggerPort = Utils::Port(server.serverPort()); diff --git a/src/plugins/winrt/winrtdebugsupport.h b/src/plugins/winrt/winrtdebugsupport.h index 995c3a0b73..0a8ed4e31a 100644 --- a/src/plugins/winrt/winrtdebugsupport.h +++ b/src/plugins/winrt/winrtdebugsupport.h @@ -38,11 +38,11 @@ class WinRtDebugSupport : public Debugger::DebuggerRunTool Q_OBJECT public: - WinRtDebugSupport(ProjectExplorer::RunControl *runControl, QString *errorMessage); + explicit WinRtDebugSupport(ProjectExplorer::RunControl *runControl); ~WinRtDebugSupport(); private: - static bool getFreePort(Utils::Port &qmlDebuggerPort, QString *errorMessage); + bool getFreePort(Utils::Port &qmlDebuggerPort); WinRtRunnerHelper *m_runner = nullptr; }; diff --git a/src/plugins/winrt/winrtrunfactories.cpp b/src/plugins/winrt/winrtrunfactories.cpp index af4914c9bd..3269b32d64 100644 --- a/src/plugins/winrt/winrtrunfactories.cpp +++ b/src/plugins/winrt/winrtrunfactories.cpp @@ -151,7 +151,7 @@ bool WinRtRunControlFactory::canRun(RunConfiguration *runConfiguration, } RunControl *WinRtRunControlFactory::create( - RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) + RunConfiguration *runConfiguration, Core::Id mode, QString *) { RunControl *runControl = nullptr; if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) { @@ -161,15 +161,10 @@ RunControl *WinRtRunControlFactory::create( } else if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) { runControl = new RunControl(runConfiguration, mode); - (void) new WinRtDebugSupport(runControl, errorMessage); - } else { - *errorMessage = tr("Unsupported run mode %1.").arg(mode.toString()); - } - - if (errorMessage->isEmpty()) + (void) new WinRtDebugSupport(runControl); return runControl; + } - delete runControl; return nullptr; } |