diff --git a/src/plugins/qnx/qnxabstractrunsupport.h b/src/plugins/qnx/qnxabstractrunsupport.h index 51208298707..d59b7941e2a 100644 --- a/src/plugins/qnx/qnxabstractrunsupport.h +++ b/src/plugins/qnx/qnxabstractrunsupport.h @@ -72,7 +72,7 @@ protected: ProjectExplorer::DeviceApplicationRunner *appRunner() const; const ProjectExplorer::IDevice::ConstPtr device() const; -protected slots: +public slots: virtual void handleAdapterSetupRequested(); virtual void handleRemoteProcessStarted(); diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index fd1e192ca2c..56a9c405788 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -39,9 +39,10 @@ #include using namespace ProjectExplorer; +using namespace Utils; -using namespace Qnx; -using namespace Qnx::Internal; +namespace Qnx { +namespace Internal { QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Analyzer::AnalyzerRunControl *runControl) @@ -50,34 +51,43 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, , m_qmlPort(-1) { const DeviceApplicationRunner *runner = appRunner(); - connect(runner, SIGNAL(reportError(QString)), SLOT(handleError(QString))); - connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); - connect(runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); - connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); - connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); - connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); + connect(runner, &DeviceApplicationRunner::reportError, + this, &QnxAnalyzeSupport::handleError); + connect(runner, &DeviceApplicationRunner::remoteProcessStarted, + this, &QnxAbstractRunSupport::handleRemoteProcessStarted); + connect(runner, &DeviceApplicationRunner::finished, + this, &QnxAnalyzeSupport::handleRemoteProcessFinished); + connect(runner, &DeviceApplicationRunner::reportProgress, + this, &QnxAnalyzeSupport::handleProgressReport); + connect(runner, &DeviceApplicationRunner::remoteStdout, + this, &QnxAnalyzeSupport::handleRemoteOutput); + connect(runner, &DeviceApplicationRunner::remoteStderr, + this, &QnxAnalyzeSupport::handleRemoteOutput); - connect(m_runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), - SLOT(handleAdapterSetupRequested())); - connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)), - SLOT(remoteIsRunning())); + connect(m_runControl, &Analyzer::AnalyzerRunControl::starting, + this, &QnxAnalyzeSupport::handleAdapterSetupRequested); + connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort, + this, &QnxAnalyzeSupport::remoteIsRunning); IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit()); QnxDeviceConfiguration::ConstPtr qnxDevice = dev.dynamicCast(); - const QString applicationId = Utils::FileName::fromString(runConfig->remoteExecutableFilePath()).fileName(); + const QString applicationId = FileName::fromString(runConfig->remoteExecutableFilePath()).fileName(); m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this); - connect(m_slog2Info, SIGNAL(output(QString,Utils::OutputFormat)), this, SLOT(showMessage(QString,Utils::OutputFormat))); - connect(runner, SIGNAL(remoteProcessStarted()), m_slog2Info, SLOT(start())); + connect(m_slog2Info, &Slog2InfoRunner::output, + this, &QnxAnalyzeSupport::showMessage); + connect(runner, &DeviceApplicationRunner::remoteProcessStarted, + m_slog2Info, &Slog2InfoRunner::start); if (qnxDevice->qnxVersion() > 0x060500) - connect(m_slog2Info, SIGNAL(commandMissing()), this, SLOT(printMissingWarning())); + connect(m_slog2Info, &Slog2InfoRunner::commandMissing, + this, &QnxAnalyzeSupport::printMissingWarning); } void QnxAnalyzeSupport::handleAdapterSetupRequested() { QTC_ASSERT(state() == Inactive, return); - showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Utils::NormalMessageFormat); + showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), NormalMessageFormat); QnxAbstractRunSupport::handleAdapterSetupRequested(); } @@ -92,7 +102,7 @@ void QnxAnalyzeSupport::startExecution() setState(StartingRemoteProcess); const QStringList args = QStringList() - << Utils::QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs) + << QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs) << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort); appRunner()->setEnvironment(environment()); @@ -107,7 +117,7 @@ void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) if (!success) showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), - Utils::NormalMessageFormat); + NormalMessageFormat); m_runControl->notifyRemoteFinished(); m_slog2Info->stop(); @@ -120,22 +130,22 @@ void QnxAnalyzeSupport::handleProfilingFinished() void QnxAnalyzeSupport::handleProgressReport(const QString &progressOutput) { - showMessage(progressOutput + QLatin1Char('\n'), Utils::NormalMessageFormat); + showMessage(progressOutput + QLatin1Char('\n'), NormalMessageFormat); } void QnxAnalyzeSupport::handleRemoteOutput(const QByteArray &output) { QTC_ASSERT(state() == Inactive || state() == Running, return); - showMessage(QString::fromUtf8(output), Utils::StdOutFormat); + showMessage(QString::fromUtf8(output), StdOutFormat); } void QnxAnalyzeSupport::handleError(const QString &error) { if (state() == Running) { - showMessage(error, Utils::ErrorMessageFormat); + showMessage(error, ErrorMessageFormat); } else if (state() != Inactive) { - showMessage(tr("Initial setup failed: %1").arg(error), Utils::NormalMessageFormat); + showMessage(tr("Initial setup failed: %1").arg(error), NormalMessageFormat); setFinished(); } } @@ -146,7 +156,7 @@ void QnxAnalyzeSupport::remoteIsRunning() m_runControl->notifyRemoteSetupDone(m_qmlPort); } -void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format) +void QnxAnalyzeSupport::showMessage(const QString &msg, OutputFormat format) { if (state() != Inactive && m_runControl) m_runControl->logApplicationMessage(msg, format); @@ -155,5 +165,9 @@ void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat form void QnxAnalyzeSupport::printMissingWarning() { - showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Utils::ErrorMessageFormat); + showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), + ErrorMessageFormat); } + +} // namespace Internal +} // namespace Qnx diff --git a/src/plugins/qnx/qnxattachdebugdialog.cpp b/src/plugins/qnx/qnxattachdebugdialog.cpp index abe496c91b5..6c780bad153 100644 --- a/src/plugins/qnx/qnxattachdebugdialog.cpp +++ b/src/plugins/qnx/qnxattachdebugdialog.cpp @@ -38,21 +38,20 @@ using namespace Qnx::Internal; QnxAttachDebugDialog::QnxAttachDebugDialog(ProjectExplorer::KitChooser *kitChooser, QWidget *parent) : ProjectExplorer::DeviceProcessesDialog(kitChooser, parent) { - QVBoxLayout *mainLayout = dynamic_cast(layout()); - QTC_ASSERT(mainLayout, return); - - QFormLayout *formLayout = new QFormLayout; - - QLabel *sourceLabel = new QLabel(tr("Project source directory:"), this); + auto sourceLabel = new QLabel(tr("Project source directory:"), this); m_projectSource = new Utils::PathChooser(this); m_projectSource->setExpectedKind(Utils::PathChooser::ExistingDirectory); - formLayout->addRow(sourceLabel, m_projectSource); - QLabel *binaryLabel = new QLabel(tr("Local executable:"), this); + auto binaryLabel = new QLabel(tr("Local executable:"), this); m_localExecutable = new Utils::PathChooser(this); m_localExecutable->setExpectedKind(Utils::PathChooser::File); + + auto formLayout = new QFormLayout; + formLayout->addRow(sourceLabel, m_projectSource); formLayout->addRow(binaryLabel, m_localExecutable); + auto mainLayout = dynamic_cast(layout()); + QTC_ASSERT(mainLayout, return); mainLayout->insertLayout(mainLayout->count() - 2, formLayout); } diff --git a/src/plugins/qnx/qnxattachdebugdialog.h b/src/plugins/qnx/qnxattachdebugdialog.h index d0b2f9643af..4b1bed635ae 100644 --- a/src/plugins/qnx/qnxattachdebugdialog.h +++ b/src/plugins/qnx/qnxattachdebugdialog.h @@ -28,9 +28,7 @@ #include -namespace Utils { -class PathChooser; -} +namespace Utils { class PathChooser; } namespace Qnx { namespace Internal { @@ -52,4 +50,5 @@ private: } // namespace Internal } // namespace Qnx + #endif // QNX_INTERNAL_QNXATTACHDEBUGDIALOG_H diff --git a/src/plugins/qnx/qnxattachdebugsupport.cpp b/src/plugins/qnx/qnxattachdebugsupport.cpp index 4856450fb67..a96c0feeafc 100644 --- a/src/plugins/qnx/qnxattachdebugsupport.cpp +++ b/src/plugins/qnx/qnxattachdebugsupport.cpp @@ -46,36 +46,42 @@ #include #include -using namespace Qnx; -using namespace Qnx::Internal; +using namespace ProjectExplorer; + +namespace Qnx { +namespace Internal { QnxAttachDebugSupport::QnxAttachDebugSupport(QObject *parent) : QObject(parent) - , m_kit(0) - , m_runControl(0) - , m_pdebugPort(-1) { - m_runner = new ProjectExplorer::DeviceApplicationRunner(this); - m_portsGatherer = new ProjectExplorer::DeviceUsedPortsGatherer(this); + m_runner = new DeviceApplicationRunner(this); + m_portsGatherer = new DeviceUsedPortsGatherer(this); - connect(m_portsGatherer, SIGNAL(portListReady()), this, SLOT(launchPDebug())); - connect(m_portsGatherer, SIGNAL(error(QString)), this, SLOT(handleError(QString))); - connect(m_runner, SIGNAL(remoteProcessStarted()), this, SLOT(attachToProcess())); - connect(m_runner, SIGNAL(reportError(QString)), this, SLOT(handleError(QString))); - connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); - connect(m_runner, SIGNAL(remoteStdout(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteStderr(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); + connect(m_portsGatherer, &DeviceUsedPortsGatherer::portListReady, + this, &QnxAttachDebugSupport::launchPDebug); + connect(m_portsGatherer, &DeviceUsedPortsGatherer::error, + this, &QnxAttachDebugSupport::handleError); + connect(m_runner, &DeviceApplicationRunner::remoteProcessStarted, + this, &QnxAttachDebugSupport::attachToProcess); + connect(m_runner, &DeviceApplicationRunner::reportError, + this, &QnxAttachDebugSupport::handleError); + connect(m_runner, &DeviceApplicationRunner::reportProgress, + this, &QnxAttachDebugSupport::handleProgressReport); + connect(m_runner, &DeviceApplicationRunner::remoteStdout, + this, &QnxAttachDebugSupport::handleRemoteOutput); + connect(m_runner, &DeviceApplicationRunner::remoteStderr, + this, &QnxAttachDebugSupport::handleRemoteOutput); } void QnxAttachDebugSupport::showProcessesDialog() { - auto kitChooser = new ProjectExplorer::KitChooser; - kitChooser->setKitMatcher([](const ProjectExplorer::Kit *k){ - return k->isValid() && ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k) == Core::Id(Constants::QNX_QNX_OS_TYPE); + auto kitChooser = new KitChooser; + kitChooser->setKitMatcher([](const Kit *k){ + return k->isValid() && DeviceTypeKitInformation::deviceTypeId(k) == Core::Id(Constants::QNX_QNX_OS_TYPE); }); QnxAttachDebugDialog dlg(kitChooser, 0); - dlg.addAcceptButton(ProjectExplorer::DeviceProcessesDialog::tr("&Attach to Process")); + dlg.addAcceptButton(DeviceProcessesDialog::tr("&Attach to Process")); dlg.showAllDevices(); if (dlg.exec() == QDialog::Rejected) return; @@ -84,7 +90,7 @@ void QnxAttachDebugSupport::showProcessesDialog() if (!m_kit) return; - m_device = ProjectExplorer::DeviceKitInformation::device(m_kit); + m_device = DeviceKitInformation::device(m_kit); QTC_ASSERT(m_device, return); m_process = dlg.currentProcess(); @@ -134,7 +140,7 @@ void QnxAttachDebugSupport::attachToProcess() } connect(runControl, &Debugger::DebuggerRunControl::stateChanged, this, &QnxAttachDebugSupport::handleDebuggerStateChanged); - ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::DEBUG_RUN_MODE); + ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::DEBUG_RUN_MODE); } void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state) @@ -165,3 +171,6 @@ void QnxAttachDebugSupport::stopPDebug() { m_runner->stop(); } + +} // namespace Internal +} // namespace Qnx diff --git a/src/plugins/qnx/qnxattachdebugsupport.h b/src/plugins/qnx/qnxattachdebugsupport.h index c7ff3b2848e..2044a2d833f 100644 --- a/src/plugins/qnx/qnxattachdebugsupport.h +++ b/src/plugins/qnx/qnxattachdebugsupport.h @@ -64,15 +64,15 @@ private slots: private: void stopPDebug(); - ProjectExplorer::Kit *m_kit; + ProjectExplorer::Kit *m_kit = 0; ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::DeviceProcessItem m_process; ProjectExplorer::DeviceApplicationRunner *m_runner; ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer; - Debugger::DebuggerRunControl *m_runControl; + Debugger::DebuggerRunControl *m_runControl = 0; - int m_pdebugPort; + int m_pdebugPort = -1; QString m_projectSourceDirectory; QString m_localExecutablePath; }; diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp index d3a5687f580..15233d29817 100644 --- a/src/plugins/qnx/slog2inforunner.cpp +++ b/src/plugins/qnx/slog2inforunner.cpp @@ -29,10 +29,11 @@ #include -using namespace Qnx; -using namespace Qnx::Internal; +namespace Qnx { +namespace Internal { -Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId, const RemoteLinux::LinuxDevice::ConstPtr &device, QObject *parent) +Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId, + const RemoteLinux::LinuxDevice::ConstPtr &device, QObject *parent) : QObject(parent) , m_applicationId(applicationId) , m_found(false) @@ -43,17 +44,17 @@ Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId, const RemoteLinux m_applicationId.truncate(63); m_testProcess = new QnxDeviceProcess(device, this); - connect(m_testProcess, SIGNAL(finished()), this, SLOT(handleTestProcessCompleted())); + connect(m_testProcess, &ProjectExplorer::DeviceProcess::finished, this, &Slog2InfoRunner::handleTestProcessCompleted); m_launchDateTimeProcess = new ProjectExplorer::SshDeviceProcess(device, this); - connect(m_launchDateTimeProcess, SIGNAL(finished()), this, SLOT(launchSlog2Info())); + connect(m_launchDateTimeProcess, &ProjectExplorer::DeviceProcess::finished, this, &Slog2InfoRunner::launchSlog2Info); m_logProcess = new QnxDeviceProcess(device, this); - connect(m_logProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readLogStandardOutput())); - connect(m_logProcess, SIGNAL(readyReadStandardError()), this, SLOT(readLogStandardError())); - connect(m_logProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleLogError())); - connect(m_logProcess, SIGNAL(started()), this, SIGNAL(started())); - connect(m_logProcess, SIGNAL(finished()), this, SIGNAL(finished())); + connect(m_logProcess, &ProjectExplorer::DeviceProcess::readyReadStandardOutput, this, &Slog2InfoRunner::readLogStandardOutput); + connect(m_logProcess, &ProjectExplorer::DeviceProcess::readyReadStandardError, this, &Slog2InfoRunner::readLogStandardError); + connect(m_logProcess, &ProjectExplorer::DeviceProcess::error, this, &Slog2InfoRunner::handleLogError); + connect(m_logProcess, &ProjectExplorer::DeviceProcess::started, this, &Slog2InfoRunner::started); + connect(m_logProcess, &ProjectExplorer::DeviceProcess::finished, this, &Slog2InfoRunner::finished); } void Slog2InfoRunner::start() @@ -177,3 +178,6 @@ void Slog2InfoRunner::handleLogError() { emit output(tr("Cannot show slog2info output. Error: %1").arg(m_logProcess->errorString()), Utils::StdErrFormat); } + +} // namespace Internal +} // namespace Qnx