Qnx: Code cosmetics

Some Qt 5 connects, auto, namespaces, ...

Change-Id: I3e206d95715f988473c9b7c3d01658e6d4d925ae
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-01-23 10:37:02 +01:00
parent 621c834023
commit 1f0594050f
7 changed files with 95 additions and 70 deletions

View File

@@ -72,7 +72,7 @@ protected:
ProjectExplorer::DeviceApplicationRunner *appRunner() const; ProjectExplorer::DeviceApplicationRunner *appRunner() const;
const ProjectExplorer::IDevice::ConstPtr device() const; const ProjectExplorer::IDevice::ConstPtr device() const;
protected slots: public slots:
virtual void handleAdapterSetupRequested(); virtual void handleAdapterSetupRequested();
virtual void handleRemoteProcessStarted(); virtual void handleRemoteProcessStarted();

View File

@@ -39,9 +39,10 @@
#include <qmldebug/qmldebugcommandlinearguments.h> #include <qmldebug/qmldebugcommandlinearguments.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
using namespace Qnx; namespace Qnx {
using namespace Qnx::Internal; namespace Internal {
QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
Analyzer::AnalyzerRunControl *runControl) Analyzer::AnalyzerRunControl *runControl)
@@ -50,34 +51,43 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
, m_qmlPort(-1) , m_qmlPort(-1)
{ {
const DeviceApplicationRunner *runner = appRunner(); const DeviceApplicationRunner *runner = appRunner();
connect(runner, SIGNAL(reportError(QString)), SLOT(handleError(QString))); connect(runner, &DeviceApplicationRunner::reportError,
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); this, &QnxAnalyzeSupport::handleError);
connect(runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); this, &QnxAbstractRunSupport::handleRemoteProcessStarted);
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); connect(runner, &DeviceApplicationRunner::finished,
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); 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*)), connect(m_runControl, &Analyzer::AnalyzerRunControl::starting,
SLOT(handleAdapterSetupRequested())); this, &QnxAnalyzeSupport::handleAdapterSetupRequested);
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)), connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
SLOT(remoteIsRunning())); this, &QnxAnalyzeSupport::remoteIsRunning);
IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit()); IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
QnxDeviceConfiguration::ConstPtr qnxDevice = dev.dynamicCast<const QnxDeviceConfiguration>(); QnxDeviceConfiguration::ConstPtr qnxDevice = dev.dynamicCast<const QnxDeviceConfiguration>();
const QString applicationId = Utils::FileName::fromString(runConfig->remoteExecutableFilePath()).fileName(); const QString applicationId = FileName::fromString(runConfig->remoteExecutableFilePath()).fileName();
m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this); m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
connect(m_slog2Info, SIGNAL(output(QString,Utils::OutputFormat)), this, SLOT(showMessage(QString,Utils::OutputFormat))); connect(m_slog2Info, &Slog2InfoRunner::output,
connect(runner, SIGNAL(remoteProcessStarted()), m_slog2Info, SLOT(start())); this, &QnxAnalyzeSupport::showMessage);
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
m_slog2Info, &Slog2InfoRunner::start);
if (qnxDevice->qnxVersion() > 0x060500) if (qnxDevice->qnxVersion() > 0x060500)
connect(m_slog2Info, SIGNAL(commandMissing()), this, SLOT(printMissingWarning())); connect(m_slog2Info, &Slog2InfoRunner::commandMissing,
this, &QnxAnalyzeSupport::printMissingWarning);
} }
void QnxAnalyzeSupport::handleAdapterSetupRequested() void QnxAnalyzeSupport::handleAdapterSetupRequested()
{ {
QTC_ASSERT(state() == Inactive, return); QTC_ASSERT(state() == Inactive, return);
showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Utils::NormalMessageFormat); showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), NormalMessageFormat);
QnxAbstractRunSupport::handleAdapterSetupRequested(); QnxAbstractRunSupport::handleAdapterSetupRequested();
} }
@@ -92,7 +102,7 @@ void QnxAnalyzeSupport::startExecution()
setState(StartingRemoteProcess); setState(StartingRemoteProcess);
const QStringList args = QStringList() const QStringList args = QStringList()
<< Utils::QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs) << QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs)
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort); << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
appRunner()->setEnvironment(environment()); appRunner()->setEnvironment(environment());
@@ -107,7 +117,7 @@ void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
if (!success) if (!success)
showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), showMessage(tr("The %1 process closed unexpectedly.").arg(executable()),
Utils::NormalMessageFormat); NormalMessageFormat);
m_runControl->notifyRemoteFinished(); m_runControl->notifyRemoteFinished();
m_slog2Info->stop(); m_slog2Info->stop();
@@ -120,22 +130,22 @@ void QnxAnalyzeSupport::handleProfilingFinished()
void QnxAnalyzeSupport::handleProgressReport(const QString &progressOutput) void QnxAnalyzeSupport::handleProgressReport(const QString &progressOutput)
{ {
showMessage(progressOutput + QLatin1Char('\n'), Utils::NormalMessageFormat); showMessage(progressOutput + QLatin1Char('\n'), NormalMessageFormat);
} }
void QnxAnalyzeSupport::handleRemoteOutput(const QByteArray &output) void QnxAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
{ {
QTC_ASSERT(state() == Inactive || state() == Running, return); QTC_ASSERT(state() == Inactive || state() == Running, return);
showMessage(QString::fromUtf8(output), Utils::StdOutFormat); showMessage(QString::fromUtf8(output), StdOutFormat);
} }
void QnxAnalyzeSupport::handleError(const QString &error) void QnxAnalyzeSupport::handleError(const QString &error)
{ {
if (state() == Running) { if (state() == Running) {
showMessage(error, Utils::ErrorMessageFormat); showMessage(error, ErrorMessageFormat);
} else if (state() != Inactive) { } else if (state() != Inactive) {
showMessage(tr("Initial setup failed: %1").arg(error), Utils::NormalMessageFormat); showMessage(tr("Initial setup failed: %1").arg(error), NormalMessageFormat);
setFinished(); setFinished();
} }
} }
@@ -146,7 +156,7 @@ void QnxAnalyzeSupport::remoteIsRunning()
m_runControl->notifyRemoteSetupDone(m_qmlPort); 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) if (state() != Inactive && m_runControl)
m_runControl->logApplicationMessage(msg, format); m_runControl->logApplicationMessage(msg, format);
@@ -155,5 +165,9 @@ void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat form
void QnxAnalyzeSupport::printMissingWarning() 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

View File

@@ -38,21 +38,20 @@ using namespace Qnx::Internal;
QnxAttachDebugDialog::QnxAttachDebugDialog(ProjectExplorer::KitChooser *kitChooser, QWidget *parent) QnxAttachDebugDialog::QnxAttachDebugDialog(ProjectExplorer::KitChooser *kitChooser, QWidget *parent)
: ProjectExplorer::DeviceProcessesDialog(kitChooser, parent) : ProjectExplorer::DeviceProcessesDialog(kitChooser, parent)
{ {
QVBoxLayout *mainLayout = dynamic_cast<QVBoxLayout*>(layout()); auto sourceLabel = new QLabel(tr("Project source directory:"), this);
QTC_ASSERT(mainLayout, return);
QFormLayout *formLayout = new QFormLayout;
QLabel *sourceLabel = new QLabel(tr("Project source directory:"), this);
m_projectSource = new Utils::PathChooser(this); m_projectSource = new Utils::PathChooser(this);
m_projectSource->setExpectedKind(Utils::PathChooser::ExistingDirectory); 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 = new Utils::PathChooser(this);
m_localExecutable->setExpectedKind(Utils::PathChooser::File); m_localExecutable->setExpectedKind(Utils::PathChooser::File);
auto formLayout = new QFormLayout;
formLayout->addRow(sourceLabel, m_projectSource);
formLayout->addRow(binaryLabel, m_localExecutable); formLayout->addRow(binaryLabel, m_localExecutable);
auto mainLayout = dynamic_cast<QVBoxLayout*>(layout());
QTC_ASSERT(mainLayout, return);
mainLayout->insertLayout(mainLayout->count() - 2, formLayout); mainLayout->insertLayout(mainLayout->count() - 2, formLayout);
} }

View File

@@ -28,9 +28,7 @@
#include <projectexplorer/devicesupport/deviceprocessesdialog.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h>
namespace Utils { namespace Utils { class PathChooser; }
class PathChooser;
}
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {
@@ -52,4 +50,5 @@ private:
} // namespace Internal } // namespace Internal
} // namespace Qnx } // namespace Qnx
#endif // QNX_INTERNAL_QNXATTACHDEBUGDIALOG_H #endif // QNX_INTERNAL_QNXATTACHDEBUGDIALOG_H

View File

@@ -46,36 +46,42 @@
#include <utils/portlist.h> #include <utils/portlist.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Qnx; using namespace ProjectExplorer;
using namespace Qnx::Internal;
namespace Qnx {
namespace Internal {
QnxAttachDebugSupport::QnxAttachDebugSupport(QObject *parent) QnxAttachDebugSupport::QnxAttachDebugSupport(QObject *parent)
: QObject(parent) : QObject(parent)
, m_kit(0)
, m_runControl(0)
, m_pdebugPort(-1)
{ {
m_runner = new ProjectExplorer::DeviceApplicationRunner(this); m_runner = new DeviceApplicationRunner(this);
m_portsGatherer = new ProjectExplorer::DeviceUsedPortsGatherer(this); m_portsGatherer = new DeviceUsedPortsGatherer(this);
connect(m_portsGatherer, SIGNAL(portListReady()), this, SLOT(launchPDebug())); connect(m_portsGatherer, &DeviceUsedPortsGatherer::portListReady,
connect(m_portsGatherer, SIGNAL(error(QString)), this, SLOT(handleError(QString))); this, &QnxAttachDebugSupport::launchPDebug);
connect(m_runner, SIGNAL(remoteProcessStarted()), this, SLOT(attachToProcess())); connect(m_portsGatherer, &DeviceUsedPortsGatherer::error,
connect(m_runner, SIGNAL(reportError(QString)), this, SLOT(handleError(QString))); this, &QnxAttachDebugSupport::handleError);
connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); connect(m_runner, &DeviceApplicationRunner::remoteProcessStarted,
connect(m_runner, SIGNAL(remoteStdout(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); this, &QnxAttachDebugSupport::attachToProcess);
connect(m_runner, SIGNAL(remoteStderr(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); 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() void QnxAttachDebugSupport::showProcessesDialog()
{ {
auto kitChooser = new ProjectExplorer::KitChooser; auto kitChooser = new KitChooser;
kitChooser->setKitMatcher([](const ProjectExplorer::Kit *k){ kitChooser->setKitMatcher([](const Kit *k){
return k->isValid() && ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k) == Core::Id(Constants::QNX_QNX_OS_TYPE); return k->isValid() && DeviceTypeKitInformation::deviceTypeId(k) == Core::Id(Constants::QNX_QNX_OS_TYPE);
}); });
QnxAttachDebugDialog dlg(kitChooser, 0); QnxAttachDebugDialog dlg(kitChooser, 0);
dlg.addAcceptButton(ProjectExplorer::DeviceProcessesDialog::tr("&Attach to Process")); dlg.addAcceptButton(DeviceProcessesDialog::tr("&Attach to Process"));
dlg.showAllDevices(); dlg.showAllDevices();
if (dlg.exec() == QDialog::Rejected) if (dlg.exec() == QDialog::Rejected)
return; return;
@@ -84,7 +90,7 @@ void QnxAttachDebugSupport::showProcessesDialog()
if (!m_kit) if (!m_kit)
return; return;
m_device = ProjectExplorer::DeviceKitInformation::device(m_kit); m_device = DeviceKitInformation::device(m_kit);
QTC_ASSERT(m_device, return); QTC_ASSERT(m_device, return);
m_process = dlg.currentProcess(); m_process = dlg.currentProcess();
@@ -134,7 +140,7 @@ void QnxAttachDebugSupport::attachToProcess()
} }
connect(runControl, &Debugger::DebuggerRunControl::stateChanged, connect(runControl, &Debugger::DebuggerRunControl::stateChanged,
this, &QnxAttachDebugSupport::handleDebuggerStateChanged); 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) void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
@@ -165,3 +171,6 @@ void QnxAttachDebugSupport::stopPDebug()
{ {
m_runner->stop(); m_runner->stop();
} }
} // namespace Internal
} // namespace Qnx

View File

@@ -64,15 +64,15 @@ private slots:
private: private:
void stopPDebug(); void stopPDebug();
ProjectExplorer::Kit *m_kit; ProjectExplorer::Kit *m_kit = 0;
ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::IDevice::ConstPtr m_device;
ProjectExplorer::DeviceProcessItem m_process; ProjectExplorer::DeviceProcessItem m_process;
ProjectExplorer::DeviceApplicationRunner *m_runner; ProjectExplorer::DeviceApplicationRunner *m_runner;
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer; 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_projectSourceDirectory;
QString m_localExecutablePath; QString m_localExecutablePath;
}; };

View File

@@ -29,10 +29,11 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Qnx; namespace Qnx {
using namespace Qnx::Internal; 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) : QObject(parent)
, m_applicationId(applicationId) , m_applicationId(applicationId)
, m_found(false) , m_found(false)
@@ -43,17 +44,17 @@ Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId, const RemoteLinux
m_applicationId.truncate(63); m_applicationId.truncate(63);
m_testProcess = new QnxDeviceProcess(device, this); 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); 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); m_logProcess = new QnxDeviceProcess(device, this);
connect(m_logProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readLogStandardOutput())); connect(m_logProcess, &ProjectExplorer::DeviceProcess::readyReadStandardOutput, this, &Slog2InfoRunner::readLogStandardOutput);
connect(m_logProcess, SIGNAL(readyReadStandardError()), this, SLOT(readLogStandardError())); connect(m_logProcess, &ProjectExplorer::DeviceProcess::readyReadStandardError, this, &Slog2InfoRunner::readLogStandardError);
connect(m_logProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleLogError())); connect(m_logProcess, &ProjectExplorer::DeviceProcess::error, this, &Slog2InfoRunner::handleLogError);
connect(m_logProcess, SIGNAL(started()), this, SIGNAL(started())); connect(m_logProcess, &ProjectExplorer::DeviceProcess::started, this, &Slog2InfoRunner::started);
connect(m_logProcess, SIGNAL(finished()), this, SIGNAL(finished())); connect(m_logProcess, &ProjectExplorer::DeviceProcess::finished, this, &Slog2InfoRunner::finished);
} }
void Slog2InfoRunner::start() 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); emit output(tr("Cannot show slog2info output. Error: %1").arg(m_logProcess->errorString()), Utils::StdErrFormat);
} }
} // namespace Internal
} // namespace Qnx