Qnx: Modernize

modernize-*

Change-Id: I8aae8e3edac885f23b191333d8b0d803c846af43
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2018-11-24 15:03:28 +01:00
parent f52f25e150
commit ba4c434211
24 changed files with 59 additions and 71 deletions

View File

@@ -42,7 +42,7 @@ QnxBaseQtConfigWidget::QnxBaseQtConfigWidget(QnxQtVersion *version) :
{
QTC_ASSERT(version, return);
QHBoxLayout *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->addWidget(m_sdpPathChooser);
m_sdpPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);

View File

@@ -67,8 +67,7 @@ const QLatin1String QNXVersionKey("QNXVersion");
// For backward compatibility
const QLatin1String SdpEnvFileKey("NDKEnvFile");
QnxConfiguration::QnxConfiguration()
{ }
QnxConfiguration::QnxConfiguration() = default;
QnxConfiguration::QnxConfiguration(const FileName &sdpEnvFile)
{
@@ -220,7 +219,7 @@ QnxQtVersion *QnxConfiguration::qnxQtVersion(const Target &target) const
foreach (BaseQtVersion *version,
QtVersionManager::instance()->versions(Utils::equal(&BaseQtVersion::type,
QString::fromLatin1(Constants::QNX_QNX_QT)))) {
QnxQtVersion *qnxQt = dynamic_cast<QnxQtVersion *>(version);
auto qnxQt = dynamic_cast<QnxQtVersion *>(version);
if (qnxQt && FileName::fromString(qnxQt->sdpPath()) == sdpPath()) {
foreach (const Abi &qtAbi, version->qtAbis()) {
if ((qtAbi == target.m_abi) && (qnxQt->cpuDir() == target.cpuDir()))
@@ -266,7 +265,7 @@ QVariant QnxConfiguration::createDebugger(const Target &target)
QnxToolChain *QnxConfiguration::createToolChain(const Target &target)
{
QnxToolChain *toolChain = new QnxToolChain(ToolChain::AutoDetection);
auto toolChain = new QnxToolChain(ToolChain::AutoDetection);
toolChain->setLanguage(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
toolChain->setTargetAbi(target.m_abi);
toolChain->setDisplayName(

View File

@@ -61,7 +61,7 @@ QnxConfigurationManager *QnxConfigurationManager::instance()
QnxConfigurationManager::~QnxConfigurationManager()
{
m_instance = 0;
m_instance = nullptr;
qDeleteAll(m_configurations);
delete m_writer;
}
@@ -101,7 +101,7 @@ QnxConfiguration *QnxConfigurationManager::configurationFromEnvFile(const Utils:
return c;
}
return 0;
return nullptr;
}
void QnxConfigurationManager::saveConfigs()
@@ -138,7 +138,7 @@ void QnxConfigurationManager::restoreConfigurations()
continue;
const QVariantMap dMap = data.value(key).toMap();
QnxConfiguration *configuration = new QnxConfiguration(dMap);
auto configuration = new QnxConfiguration(dMap);
addConfiguration(configuration);
}
}

View File

@@ -39,7 +39,7 @@ class QnxConfigurationManager: public QObject
Q_OBJECT
public:
QnxConfigurationManager();
~QnxConfigurationManager();
~QnxConfigurationManager() override;
static QnxConfigurationManager *instance();
QList<QnxConfiguration*> configurations() const;

View File

@@ -229,7 +229,7 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles()
m_ui->qtLibraryCombo->itemData(m_ui->qtLibraryCombo->currentIndex()).toInt();
QnxQtVersion *qtVersion = dynamic_cast<QnxQtVersion *>(QtVersionManager::version(qtVersionId));
auto qtVersion = dynamic_cast<const QnxQtVersion *>(QtVersionManager::version(qtVersionId));
QTC_ASSERT(qtVersion, return result);
@@ -260,8 +260,7 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles(
QFileInfoList list = dir.entryInfoList(nameFilters,
QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
for (auto &fileInfo : list) {
if (fileInfo.isDir()) {
result.append(gatherFiles(fileInfo.absoluteFilePath(), baseDirPath.isEmpty() ?
dirPath : baseDirPath));

View File

@@ -58,13 +58,13 @@ public:
};
explicit QnxDeployQtLibrariesDialog(const ProjectExplorer::IDevice::ConstPtr &device,
QWidget *parent = 0);
~QnxDeployQtLibrariesDialog();
QWidget *parent = nullptr);
~QnxDeployQtLibrariesDialog() override;
int execAndDeploy(int qtVersionId, const QString &remoteDirectory);
protected:
void closeEvent(QCloseEvent *event);
void closeEvent(QCloseEvent *event) override;
private slots:
void deployLibraries();

View File

@@ -90,11 +90,7 @@ QnxDevice::QnxDevice(const QString &name, Core::Id type, MachineType machineType
{
}
QnxDevice::QnxDevice(const QnxDevice &other)
: RemoteLinux::LinuxDevice(other)
, m_versionNumber(other.m_versionNumber)
{
}
QnxDevice::QnxDevice(const QnxDevice &other) = default;
QnxDevice::Ptr QnxDevice::create()
{

View File

@@ -36,8 +36,8 @@ class QNX_EXPORT QnxDevice : public RemoteLinux::LinuxDevice
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxDevice)
public:
typedef QSharedPointer<QnxDevice> Ptr;
typedef QSharedPointer<const QnxDevice> ConstPtr;
using Ptr = QSharedPointer<QnxDevice>;
using ConstPtr = QSharedPointer<const QnxDevice>;
static Ptr create();
static Ptr create(const QString &name, Core::Id type, MachineType machineType,

View File

@@ -37,10 +37,10 @@ class QnxDeviceProcess : public ProjectExplorer::SshDeviceProcess
public:
QnxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent);
void interrupt() { doSignal(2); }
void terminate() { doSignal(15); }
void kill() { doSignal(9); }
QString fullCommandLine(const ProjectExplorer::Runnable &runnable) const;
void interrupt() override { doSignal(2); }
void terminate() override { doSignal(15); }
void kill() override { doSignal(9); }
QString fullCommandLine(const ProjectExplorer::Runnable &runnable) const override;
private:
void doSignal(int sig);

View File

@@ -36,12 +36,12 @@ class QnxDeviceProcessList : public ProjectExplorer::SshDeviceProcessList
Q_OBJECT
public:
explicit QnxDeviceProcessList(
const ProjectExplorer::IDevice::ConstPtr &device, QObject *parent = 0);
const ProjectExplorer::IDevice::ConstPtr &device, QObject *parent = nullptr);
private:
virtual QString listProcessesCommandLine() const;
virtual QList<ProjectExplorer::DeviceProcessItem> buildProcessList(
const QString &listProcessesReply) const;
QString listProcessesCommandLine() const override;
QList<ProjectExplorer::DeviceProcessItem> buildProcessList(
const QString &listProcessesReply) const override;
};
} // namespace Internal

View File

@@ -39,8 +39,8 @@ protected:
explicit QnxDeviceProcessSignalOperation(const QSsh::SshConnectionParameters &sshParameters);
private:
QString killProcessByNameCommandLine(const QString &filePath) const;
QString interruptProcessByNameCommandLine(const QString &filePath) const;
QString killProcessByNameCommandLine(const QString &filePath) const override;
QString interruptProcessByNameCommandLine(const QString &filePath) const override;
friend class Qnx::QnxDevice;
};

View File

@@ -159,9 +159,9 @@ void QnxDeviceTester::testNextCommand()
void QnxDeviceTester::setFinished()
{
m_state = Inactive;
disconnect(m_genericTester, 0, this, 0);
disconnect(m_genericTester, nullptr, this, nullptr);
if (m_processRunner)
disconnect(m_processRunner, 0, this, 0);
disconnect(m_processRunner, nullptr, this, nullptr);
emit finished(m_result);
}

View File

@@ -38,7 +38,7 @@ class QnxDeviceTester : public ProjectExplorer::DeviceTester
{
Q_OBJECT
public:
explicit QnxDeviceTester(QObject *parent = 0);
explicit QnxDeviceTester(QObject *parent = nullptr);
void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration) override;
void stopTest() override;

View File

@@ -44,7 +44,7 @@ public:
RemoteLinux::GenericLinuxDeviceConfigurationWizardSetupPage(parent)
{}
QString defaultConfigurationName() const { return QnxDeviceWizard::tr("QNX Device"); }
QString defaultConfigurationName() const override { return QnxDeviceWizard::tr("QNX Device"); }
};
QnxDeviceWizard::QnxDeviceWizard(QWidget *parent) :

View File

@@ -41,7 +41,7 @@ class QnxDeviceWizard : public Utils::Wizard
Q_OBJECT
public:
explicit QnxDeviceWizard(QWidget *parent = 0);
explicit QnxDeviceWizard(QWidget *parent = nullptr);
ProjectExplorer::IDevice::Ptr device();

View File

@@ -36,7 +36,6 @@ class QnxPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Qnx.json")
public:
QnxPlugin() {}
~QnxPlugin() final;
private:

View File

@@ -44,8 +44,7 @@ namespace Internal {
static char SDP_PATH_KEY[] = "SDKPath";
QnxQtVersion::QnxQtVersion()
{ }
QnxQtVersion::QnxQtVersion() = default;
QnxQtVersion::QnxQtVersion(const Utils::FileName &path, bool isAutoDetected,
const QString &autoDetectionSource) :

View File

@@ -41,9 +41,7 @@ QnxQtVersionFactory::QnxQtVersionFactory(QObject *parent) :
{
}
QnxQtVersionFactory::~QnxQtVersionFactory()
{
}
QnxQtVersionFactory::~QnxQtVersionFactory() = default;
bool QnxQtVersionFactory::canRestore(const QString &type)
{
@@ -53,8 +51,8 @@ bool QnxQtVersionFactory::canRestore(const QString &type)
QtSupport::BaseQtVersion *QnxQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
QnxQtVersion *v = new QnxQtVersion();
return nullptr;
auto v = new QnxQtVersion;
v->fromMap(data);
return v;
}
@@ -71,11 +69,11 @@ QtSupport::BaseQtVersion *QnxQtVersionFactory::create(const Utils::FileName &qma
{
QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0;
return nullptr;
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
return new QnxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
}
return 0;
return nullptr;
}

View File

@@ -34,17 +34,17 @@ class QnxQtVersionFactory : public QtSupport::QtVersionFactory
{
Q_OBJECT
public:
explicit QnxQtVersionFactory(QObject *parent = 0);
~QnxQtVersionFactory();
explicit QnxQtVersionFactory(QObject *parent = nullptr);
~QnxQtVersionFactory() override;
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
bool canRestore(const QString &type) override;
QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data) override;
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator,
bool isAutoDetected = false,
const QString &autoDetectionSource = QString());
int priority() const override;
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator,
bool isAutoDetected = false,
const QString &autoDetectionSource = QString()) override;
};
} // namespace Internal

View File

@@ -38,10 +38,10 @@ class QnxSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit QnxSettingsPage(QObject *parent = 0);
QWidget *widget();
void apply();
void finish();
explicit QnxSettingsPage(QObject *parent = nullptr);
QWidget *widget() override;
void apply() override;
void finish() override;
private:
QPointer<QnxSettingsWidget> m_widget;

View File

@@ -63,8 +63,8 @@ public:
State state;
};
explicit QnxSettingsWidget(QWidget *parent = 0);
~QnxSettingsWidget();
explicit QnxSettingsWidget(QWidget *parent = nullptr);
~QnxSettingsWidget() override;
QList<ConfigState> changedConfigs();
protected slots:

View File

@@ -238,12 +238,12 @@ bool QnxToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *QnxToolChainFactory::restore(const QVariantMap &data)
{
QnxToolChain *tc = new QnxToolChain(ToolChain::ManualDetection);
auto tc = new QnxToolChain(ToolChain::ManualDetection);
if (tc->fromMap(data))
return tc;
delete tc;
return 0;
return nullptr;
}
bool QnxToolChainFactory::canCreate()
@@ -296,7 +296,7 @@ void QnxToolChainConfigWidget::applyImpl()
if (toolChain()->isAutoDetected())
return;
QnxToolChain *tc = static_cast<QnxToolChain *>(toolChain());
auto tc = static_cast<QnxToolChain *>(toolChain());
Q_ASSERT(tc);
QString displayName = tc->displayName();
tc->setDisplayName(displayName); // reset display name
@@ -309,7 +309,7 @@ void QnxToolChainConfigWidget::discardImpl()
{
// subwidgets are not yet connected!
QSignalBlocker blocker(this);
QnxToolChain *tc = static_cast<QnxToolChain *>(toolChain());
auto tc = static_cast<const QnxToolChain *>(toolChain());
m_compilerCommand->setFileName(tc->compilerCommand());
m_sdpPath->setPath(tc->sdpPath());
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
@@ -319,7 +319,7 @@ void QnxToolChainConfigWidget::discardImpl()
bool QnxToolChainConfigWidget::isDirtyImpl() const
{
QnxToolChain *tc = static_cast<QnxToolChain *>(toolChain());
auto tc = static_cast<const QnxToolChain *>(toolChain());
Q_ASSERT(tc);
return m_compilerCommand->fileName() != tc->compilerCommand()
|| m_sdpPath->path() != tc->sdpPath()

View File

@@ -55,7 +55,7 @@ public:
bool operator ==(const ToolChain &) const override;
protected:
virtual DetectedAbisResult detectSupportedAbis() const override;
DetectedAbisResult detectSupportedAbis() const override;
private:
QString m_sdpPath;

View File

@@ -43,9 +43,7 @@ QnxVersionNumber::QnxVersionNumber(const QString &version)
m_segments = version.split(QLatin1Char('.'));
}
QnxVersionNumber::QnxVersionNumber()
{
}
QnxVersionNumber::QnxVersionNumber() = default;
QString QnxVersionNumber::toString() const
{