winrt: Code cleanup

Replace 0 with nullptr where applicable
Initialize members in declaration

Change-Id: I3d8bae845be01e27db2c591f8037d3823f25f67d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Oliver Wolff
2018-10-31 13:09:29 +01:00
parent d52ac9a708
commit e0b0c30748
8 changed files with 14 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ using namespace ProjectExplorer;
namespace WinRt {
namespace Internal {
WinRtDevice::WinRtDevice() : m_deviceId(-1)
WinRtDevice::WinRtDevice()
{
initFreePorts();
}
@@ -74,7 +74,7 @@ QString WinRtDevice::displayType() const
IDeviceWidget *WinRtDevice::createWidget()
{
return 0;
return nullptr;
}
QList<Core::Id> WinRtDevice::actionIds() const

View File

@@ -60,7 +60,7 @@ private:
void initFreePorts();
private:
int m_deviceId;
int m_deviceId = -1;
};
} // Internal

View File

@@ -48,8 +48,6 @@ namespace WinRt {
namespace Internal {
WinRtDeviceFactory::WinRtDeviceFactory()
: m_process(0)
, m_initialized(false)
{
if (allPrerequisitesLoaded()) {
onPrerequisitesLoaded();

View File

@@ -55,8 +55,8 @@ private:
QString findRunnerFilePath() const;
void parseRunnerOutput(const QByteArray &output) const;
Utils::QtcProcess *m_process;
bool m_initialized;
Utils::QtcProcess *m_process = nullptr;
bool m_initialized = false;
};
} // Internal

View File

@@ -54,8 +54,8 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::restore(const QString &type,
const QVariantMap &data)
{
if (!canRestore(type))
return 0;
WinRtQtVersion *v = 0;
return nullptr;
WinRtQtVersion *v = nullptr;
if (type == QLatin1String(Constants::WINRT_WINPHONEQT))
v = new WinRtPhoneQtVersion;
else
@@ -74,7 +74,7 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &q
{
QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0;
return nullptr;
bool isWinRt = false;
bool isPhone = false;
@@ -89,7 +89,7 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &q
}
if (!isWinRt)
return 0;
return nullptr;
return isPhone ? new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource)
: new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);

View File

@@ -33,7 +33,7 @@ namespace Internal {
class WinRtQtVersionFactory : public QtSupport::QtVersionFactory
{
public:
explicit WinRtQtVersionFactory(QObject *parent = 0);
explicit WinRtQtVersionFactory(QObject *parent = nullptr);
~WinRtQtVersionFactory();
bool canRestore(const QString &type);

View File

@@ -101,7 +101,7 @@ void WinRtRunner::onProcessError()
QTC_ASSERT(m_runner, return);
m_runner->disconnect();
m_runner->deleteLater();
m_runner = 0;
m_runner = nullptr;
m_state = StoppedState;
reportStopped();
}

View File

@@ -152,7 +152,7 @@ void WinRtRunnerHelper::onProcessFinished(int exitCode, QProcess::ExitStatus exi
QTC_ASSERT(m_process, return);
m_process->disconnect();
m_process->deleteLater();
m_process = 0;
m_process = nullptr;
emit finished(exitCode, exitStatus);
}
@@ -163,7 +163,7 @@ void WinRtRunnerHelper::onProcessError(QProcess::ProcessError processError)
m_process->errorString()), Utils::ErrorMessageFormat);
m_process->disconnect();
m_process->deleteLater();
m_process = 0;
m_process = nullptr;
emit error(processError);
}
@@ -176,7 +176,7 @@ void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf)
QtcProcess::addArg(&runnerArgs, QString::number(m_device->deviceId()));
}
QtcProcess *process = 0;
QtcProcess *process = nullptr;
bool connectProcess = false;
switch (conf) {