forked from qt-creator/qt-creator
IDevice: Replace QSharedPointer with std::shared_ptr
According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews QSharedPointer impl is poor and it's going to be removed from Qt 7. Replace QWeakPointer with std::weak_ptr. Replace QEnableSharedFromThis with std::enable_shared_from_this. Use std::static_pointer_cast and std::dynamic_pointer_cast for casts used with QSharedPointer before. Change-Id: If255a100c790860934f36d52906b93f33c31cfe8 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -218,7 +218,7 @@ bool AndroidDeployQtStep::init()
|
||||
|
||||
if (!info.isValid()) {
|
||||
const auto dev =
|
||||
static_cast<const AndroidDevice *>(DeviceKitAspect::device(kit()).data());
|
||||
static_cast<const AndroidDevice *>(DeviceKitAspect::device(kit()).get());
|
||||
if (!dev) {
|
||||
reportWarningOrError(Tr::tr("No valid deployment device is set."), Task::Error);
|
||||
return false;
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
AndroidDeviceWidget::AndroidDeviceWidget(const IDevice::Ptr &device)
|
||||
: IDeviceWidget(device)
|
||||
{
|
||||
const auto dev = qSharedPointerCast<AndroidDevice>(device);
|
||||
const auto dev = std::static_pointer_cast<AndroidDevice>(device);
|
||||
const auto formLayout = new QFormLayout(this);
|
||||
formLayout->setFormAlignment(Qt::AlignLeft);
|
||||
formLayout->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -383,7 +383,7 @@ IDevice::DeviceInfo AndroidDevice::deviceInformation() const
|
||||
|
||||
IDeviceWidget *AndroidDevice::createWidget()
|
||||
{
|
||||
return new AndroidDeviceWidget(sharedFromThis());
|
||||
return new AndroidDeviceWidget(shared_from_this());
|
||||
}
|
||||
|
||||
DeviceProcessSignalOperation::Ptr AndroidDevice::signalOperation() const
|
||||
@@ -431,7 +431,7 @@ IDevice::DeviceState AndroidDeviceManager::getDeviceState(const QString &serial,
|
||||
|
||||
void AndroidDeviceManager::updateDeviceState(const ProjectExplorer::IDevice::ConstPtr &device)
|
||||
{
|
||||
const AndroidDevice *dev = static_cast<const AndroidDevice *>(device.data());
|
||||
const AndroidDevice *dev = static_cast<const AndroidDevice *>(device.get());
|
||||
const QString serial = dev->serialNumber();
|
||||
DeviceManager *const devMgr = DeviceManager::instance();
|
||||
const Id id = dev->id();
|
||||
@@ -444,7 +444,7 @@ void AndroidDeviceManager::updateDeviceState(const ProjectExplorer::IDevice::Con
|
||||
void AndroidDeviceManager::startAvd(const ProjectExplorer::IDevice::Ptr &device, QWidget *parent)
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
const AndroidDevice *androidDev = static_cast<const AndroidDevice *>(device.data());
|
||||
const AndroidDevice *androidDev = static_cast<const AndroidDevice *>(device.get());
|
||||
const QString name = androidDev->avdName();
|
||||
qCDebug(androidDeviceLog, "Starting Android AVD id \"%s\".", qPrintable(name));
|
||||
auto future = Utils::asyncRun([this, name, device] {
|
||||
@@ -460,13 +460,13 @@ void AndroidDeviceManager::startAvd(const ProjectExplorer::IDevice::Ptr &device,
|
||||
|
||||
void AndroidDeviceManager::eraseAvd(const IDevice::Ptr &device, QWidget *parent)
|
||||
{
|
||||
if (device.isNull())
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
if (device->machineType() == IDevice::Hardware)
|
||||
return;
|
||||
|
||||
const QString name = static_cast<const AndroidDevice *>(device.data())->avdName();
|
||||
const QString name = static_cast<const AndroidDevice *>(device.get())->avdName();
|
||||
const QString question
|
||||
= Tr::tr("Erase the Android AVD \"%1\"?\nThis cannot be undone.").arg(name);
|
||||
if (!AndroidDeviceWidget::questionDialog(question, parent))
|
||||
@@ -503,7 +503,7 @@ void AndroidDeviceManager::setupWifiForDevice(const IDevice::Ptr &device, QWidge
|
||||
return;
|
||||
}
|
||||
|
||||
const auto androidDev = static_cast<const AndroidDevice *>(device.data());
|
||||
const auto androidDev = static_cast<const AndroidDevice *>(device.get());
|
||||
const QStringList adbSelector = AndroidDeviceInfo::adbSelector(androidDev->serialNumber());
|
||||
// prepare port
|
||||
QStringList args = adbSelector;
|
||||
@@ -679,8 +679,8 @@ void AndroidDeviceManager::HandleAvdsListChange()
|
||||
const Id deviceId = AndroidDevice::idFromDeviceInfo(item);
|
||||
const QString displayName = AndroidDevice::displayNameFromInfo(item);
|
||||
IDevice::ConstPtr dev = devMgr->find(deviceId);
|
||||
if (!dev.isNull()) {
|
||||
const auto androidDev = static_cast<const AndroidDevice *>(dev.data());
|
||||
if (dev) {
|
||||
const auto androidDev = static_cast<const AndroidDevice *>(dev.get());
|
||||
// DeviceManager doens't seem to have a way to directly update the name, if the name
|
||||
// of the device has changed, remove it and register it again with the new name.
|
||||
// Also account for the case of an AVD registered through old QC which might have
|
||||
@@ -843,7 +843,7 @@ public:
|
||||
return IDevice::Ptr();
|
||||
|
||||
const IDevice::Ptr dev = dialog.device();
|
||||
if (const auto androidDev = static_cast<AndroidDevice *>(dev.data())) {
|
||||
if (const auto androidDev = static_cast<AndroidDevice *>(dev.get())) {
|
||||
qCDebug(androidDeviceLog, "Created new Android AVD id \"%s\".",
|
||||
qPrintable(androidDev->avdName()));
|
||||
} else {
|
||||
|
@@ -581,7 +581,7 @@ void installQASIPackage(Target *target, const FilePath &packagePath)
|
||||
if (appAbis.isEmpty())
|
||||
return;
|
||||
const IDevice::ConstPtr device = DeviceKitAspect::device(target->kit());
|
||||
AndroidDeviceInfo info = AndroidDevice::androidDeviceInfoFromIDevice(device.data());
|
||||
AndroidDeviceInfo info = AndroidDevice::androidDeviceInfoFromIDevice(device.get());
|
||||
if (!info.isValid()) // aborted
|
||||
return;
|
||||
|
||||
|
@@ -269,7 +269,7 @@ bool AndroidQmlPreviewWorker::ensureAvdIsRunning()
|
||||
devSN = m_serialNumber;
|
||||
|
||||
if (!avdMananager.isAvdBooted(devSN)) {
|
||||
const IDevice *dev = DeviceKitAspect::device(m_rc->target()->kit()).data();
|
||||
const IDevice *dev = DeviceKitAspect::device(m_rc->target()->kit()).get();
|
||||
if (!dev) {
|
||||
appendMessage(Tr::tr("Selected device is invalid."), ErrorMessageFormat);
|
||||
return false;
|
||||
|
@@ -4,11 +4,8 @@
|
||||
|
||||
#include "androidavdmanager.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androiddeployqtstep.h"
|
||||
#include "androiddevice.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidrunner.h"
|
||||
#include "androidrunnerworker.h"
|
||||
#include "androidtr.h"
|
||||
@@ -167,7 +164,7 @@ void AndroidRunner::launchAVD()
|
||||
|
||||
// Get AVD info
|
||||
const IDevice::ConstPtr device = DeviceKitAspect::device(m_target->kit());
|
||||
AndroidDeviceInfo info = AndroidDevice::androidDeviceInfoFromIDevice(device.data());
|
||||
AndroidDeviceInfo info = AndroidDevice::androidDeviceInfoFromIDevice(device.get());
|
||||
AndroidManager::setDeviceSerialNumber(m_target, info.serialNumber);
|
||||
emit androidDeviceInfoChanged(info);
|
||||
if (info.isValid()) {
|
||||
|
@@ -39,7 +39,7 @@ public:
|
||||
explicit BareMetalDebugSupport(RunControl *runControl)
|
||||
: Debugger::DebuggerRunTool(runControl)
|
||||
{
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(device());
|
||||
if (!dev) {
|
||||
reportFailure(Tr::tr("Cannot debug: Kit has no device."));
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
private:
|
||||
void start() final
|
||||
{
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, reportFailure(); return);
|
||||
IDebugServerProvider *p = DebugServerProviderManager::findProvider(
|
||||
dev->debugServerProviderId());
|
||||
|
@@ -90,7 +90,7 @@ Store BareMetalDevice::toMap() const
|
||||
|
||||
IDeviceWidget *BareMetalDevice::createWidget()
|
||||
{
|
||||
return new BareMetalDeviceConfigurationWidget(sharedFromThis());
|
||||
return new BareMetalDeviceConfigurationWidget(shared_from_this());
|
||||
}
|
||||
|
||||
// Factory
|
||||
|
@@ -11,8 +11,8 @@ namespace BareMetal::Internal {
|
||||
class BareMetalDevice final : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using Ptr = QSharedPointer<BareMetalDevice>;
|
||||
using ConstPtr = QSharedPointer<const BareMetalDevice>;
|
||||
using Ptr = std::shared_ptr<BareMetalDevice>;
|
||||
using ConstPtr = std::shared_ptr<const BareMetalDevice>;
|
||||
|
||||
static Ptr create() { return Ptr(new BareMetalDevice); }
|
||||
~BareMetalDevice() final;
|
||||
|
@@ -19,7 +19,7 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
||||
const ProjectExplorer::IDevice::Ptr &deviceConfig)
|
||||
: IDeviceWidget(deviceConfig)
|
||||
{
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<const BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, return);
|
||||
|
||||
const auto formLayout = new QFormLayout(this);
|
||||
@@ -36,7 +36,7 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
||||
|
||||
void BareMetalDeviceConfigurationWidget::debugServerProviderChanged()
|
||||
{
|
||||
const auto dev = qSharedPointerCast<BareMetalDevice>(device());
|
||||
const auto dev = std::static_pointer_cast<BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, return);
|
||||
dev->setDebugServerProviderId(m_debugServerProviderChooser->currentProviderId());
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ ProjectExplorer::IDeviceWidget *QdbDevice::createWidget()
|
||||
|
||||
ProcessInterface *QdbDevice::createProcessInterface() const
|
||||
{
|
||||
return new QdbProcessImpl(sharedFromThis());
|
||||
return new QdbProcessImpl(shared_from_this());
|
||||
}
|
||||
|
||||
void QdbDevice::setSerialNumber(const QString &serial)
|
||||
|
@@ -11,8 +11,8 @@ namespace Qdb::Internal {
|
||||
class QdbDevice final : public RemoteLinux::LinuxDevice
|
||||
{
|
||||
public:
|
||||
typedef QSharedPointer<QdbDevice> Ptr;
|
||||
typedef QSharedPointer<const QdbDevice> ConstPtr;
|
||||
typedef std::shared_ptr<QdbDevice> Ptr;
|
||||
typedef std::shared_ptr<const QdbDevice> ConstPtr;
|
||||
|
||||
static Ptr create() { return Ptr(new QdbDevice); }
|
||||
|
||||
|
@@ -534,7 +534,7 @@ CommandLine DockerDevice::createCommandLine() const
|
||||
|
||||
IDeviceWidget *DockerDevice::createWidget()
|
||||
{
|
||||
return new DockerDeviceWidget(sharedFromThis());
|
||||
return new DockerDeviceWidget(shared_from_this());
|
||||
}
|
||||
|
||||
Tasks DockerDevice::validate() const
|
||||
@@ -979,7 +979,7 @@ Store DockerDevice::toMap() const
|
||||
|
||||
ProcessInterface *DockerDevice::createProcessInterface() const
|
||||
{
|
||||
return new DockerProcessImpl(this->sharedFromThis(), d);
|
||||
return new DockerProcessImpl(shared_from_this(), d);
|
||||
}
|
||||
|
||||
DeviceTester *DockerDevice::createDeviceTester() const
|
||||
@@ -1051,7 +1051,7 @@ expected_str<Environment> DockerDevice::systemEnvironmentWithError() const
|
||||
|
||||
void DockerDevice::aboutToBeRemoved() const
|
||||
{
|
||||
KitDetector detector(sharedFromThis());
|
||||
KitDetector detector(shared_from_this());
|
||||
detector.undoAutoDetect(id().toString());
|
||||
}
|
||||
|
||||
@@ -1305,7 +1305,7 @@ void DockerDeviceFactory::shutdownExistingDevices()
|
||||
{
|
||||
QMutexLocker lk(&m_deviceListMutex);
|
||||
for (const auto &weakDevice : m_existingDevices) {
|
||||
if (QSharedPointer<DockerDevice> device = weakDevice.lock())
|
||||
if (std::shared_ptr<DockerDevice> device = weakDevice.lock())
|
||||
device->shutdown();
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dockersettings.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
@@ -42,8 +40,8 @@ public:
|
||||
class DockerDevice : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using Ptr = QSharedPointer<DockerDevice>;
|
||||
using ConstPtr = QSharedPointer<const DockerDevice>;
|
||||
using Ptr = std::shared_ptr<DockerDevice>;
|
||||
using ConstPtr = std::shared_ptr<const DockerDevice>;
|
||||
|
||||
explicit DockerDevice(std::unique_ptr<DockerDeviceSettings> settings);
|
||||
~DockerDevice();
|
||||
@@ -104,7 +102,7 @@ public:
|
||||
|
||||
private:
|
||||
QMutex m_deviceListMutex;
|
||||
std::vector<QWeakPointer<DockerDevice>> m_existingDevices;
|
||||
std::vector<std::weak_ptr<DockerDevice>> m_existingDevices;
|
||||
};
|
||||
|
||||
} // namespace Docker::Internal
|
||||
|
@@ -31,7 +31,7 @@ namespace Docker::Internal {
|
||||
DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
||||
: IDeviceWidget(device), m_kitItemDetector(device)
|
||||
{
|
||||
auto dockerDevice = device.dynamicCast<DockerDevice>();
|
||||
auto dockerDevice = std::dynamic_pointer_cast<DockerDevice>(device);
|
||||
QTC_ASSERT(dockerDevice, return);
|
||||
|
||||
DockerDeviceSettings *deviceSettings = static_cast<DockerDeviceSettings *>(device->settings());
|
||||
|
@@ -403,7 +403,7 @@ void IosConfigurations::updateSimulators()
|
||||
DeviceManager *devManager = DeviceManager::instance();
|
||||
Id devId = Constants::IOS_SIMULATOR_DEVICE_ID;
|
||||
IDevice::ConstPtr dev = devManager->find(devId);
|
||||
if (dev.isNull()) {
|
||||
if (!dev) {
|
||||
dev = IDevice::ConstPtr(new IosSimulator(devId));
|
||||
devManager->addDevice(dev);
|
||||
}
|
||||
|
@@ -202,7 +202,7 @@ IosDeployStep::IosDeployStep(BuildStepList *parent, Utils::Id id)
|
||||
void IosDeployStep::updateDisplayNames()
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
|
||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||
const QString devName = dev ? dev->displayName() : IosDevice::name();
|
||||
setDisplayName(Tr::tr("Deploy to %1").arg(devName));
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ GroupItem IosDeployStep::runRecipe()
|
||||
}
|
||||
// otherwise use iostool:
|
||||
const auto onSetup = [this](IosTransfer &transfer) {
|
||||
if (m_device.isNull()) {
|
||||
if (!m_device) {
|
||||
TaskHub::addTask(
|
||||
DeploymentTask(Task::Error, Tr::tr("Deployment failed. No iOS device found.")));
|
||||
return SetupResult::StopWithError;
|
||||
@@ -273,15 +273,15 @@ QWidget *IosDeployStep::createConfigWidget()
|
||||
|
||||
QString IosDeployStep::deviceId() const
|
||||
{
|
||||
if (iosdevice().isNull())
|
||||
return QString();
|
||||
if (!iosdevice())
|
||||
return {};
|
||||
return iosdevice()->uniqueDeviceID();
|
||||
}
|
||||
|
||||
bool IosDeployStep::checkProvisioningProfile()
|
||||
{
|
||||
IosDevice::ConstPtr device = iosdevice();
|
||||
if (device.isNull())
|
||||
if (!device)
|
||||
return true;
|
||||
|
||||
const FilePath provisioningFilePath = m_bundlePath.pathAppended("embedded.mobileprovision");
|
||||
@@ -330,12 +330,12 @@ bool IosDeployStep::checkProvisioningProfile()
|
||||
|
||||
IosDevice::ConstPtr IosDeployStep::iosdevice() const
|
||||
{
|
||||
return m_device.dynamicCast<const IosDevice>();
|
||||
return std::dynamic_pointer_cast<const IosDevice>(m_device);
|
||||
}
|
||||
|
||||
IosSimulator::ConstPtr IosDeployStep::iossimulator() const
|
||||
{
|
||||
return m_device.dynamicCast<const IosSimulator>();
|
||||
return std::dynamic_pointer_cast<const IosSimulator>(m_device);
|
||||
}
|
||||
|
||||
// IosDeployStepFactory
|
||||
|
@@ -127,7 +127,7 @@ IDevice::DeviceInfo IosDevice::deviceInformation() const
|
||||
|
||||
IDeviceWidget *IosDevice::createWidget()
|
||||
{
|
||||
return new IosDeviceInfoWidget(sharedFromThis());
|
||||
return new IosDeviceInfoWidget(shared_from_this());
|
||||
}
|
||||
|
||||
void IosDevice::fromMap(const Store &map)
|
||||
@@ -222,7 +222,7 @@ void IosDeviceManager::deviceConnected(const QString &uid, const QString &name)
|
||||
Utils::Id devType(Constants::IOS_DEVICE_TYPE);
|
||||
Utils::Id devId = baseDevId.withSuffix(uid);
|
||||
IDevice::ConstPtr dev = devManager->find(devId);
|
||||
if (dev.isNull()) {
|
||||
if (!dev) {
|
||||
auto newDev = new IosDevice(uid);
|
||||
if (!name.isNull())
|
||||
newDev->settings()->displayName.setValue(name);
|
||||
@@ -250,10 +250,10 @@ void IosDeviceManager::deviceDisconnected(const QString &uid)
|
||||
Utils::Id devType(Constants::IOS_DEVICE_TYPE);
|
||||
Utils::Id devId = baseDevId.withSuffix(uid);
|
||||
IDevice::ConstPtr dev = devManager->find(devId);
|
||||
if (dev.isNull() || dev->type() != devType) {
|
||||
if (!dev || dev->type() != devType) {
|
||||
qCWarning(detectLog) << "ignoring disconnection of ios device " << uid; // should neve happen
|
||||
} else {
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.data());
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.get());
|
||||
if (iosDev->m_extraInfo.isEmpty()
|
||||
|| iosDev->m_extraInfo.value(kDeviceName) == QLatin1String("*unknown*")) {
|
||||
devManager->removeDevice(iosDev->id());
|
||||
@@ -325,8 +325,8 @@ void IosDeviceManager::deviceInfo(const QString &uid,
|
||||
IDevice::ConstPtr dev = devManager->find(devId);
|
||||
bool skipUpdate = false;
|
||||
IosDevice *newDev = nullptr;
|
||||
if (!dev.isNull() && dev->type() == devType) {
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.data());
|
||||
if (dev && dev->type() == devType) {
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.get());
|
||||
if (iosDev->m_handler == handler && iosDev->m_extraInfo == info) {
|
||||
skipUpdate = true;
|
||||
newDev = const_cast<IosDevice *>(iosDev);
|
||||
@@ -570,9 +570,9 @@ void IosDeviceManager::updateAvailableDevices(const QStringList &devices)
|
||||
for (int iDevice = 0; iDevice < devManager->deviceCount(); ++iDevice) {
|
||||
IDevice::ConstPtr dev = devManager->deviceAt(iDevice);
|
||||
Utils::Id devType(Constants::IOS_DEVICE_TYPE);
|
||||
if (dev.isNull() || dev->type() != devType)
|
||||
if (!dev || dev->type() != devType)
|
||||
continue;
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.data());
|
||||
auto iosDev = static_cast<const IosDevice *>(dev.get());
|
||||
if (devices.contains(iosDev->uniqueDeviceID()))
|
||||
continue;
|
||||
if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
|
||||
@@ -604,7 +604,7 @@ bool IosDeviceFactory::canRestore(const Store &map) const
|
||||
IosDeviceInfoWidget::IosDeviceInfoWidget(const IDevice::Ptr &device)
|
||||
: IDeviceWidget(device)
|
||||
{
|
||||
const auto iosDevice = qSharedPointerCast<IosDevice>(device);
|
||||
const auto iosDevice = std::static_pointer_cast<IosDevice>(device);
|
||||
using namespace Layouting;
|
||||
// clang-format off
|
||||
Form {
|
||||
|
@@ -24,8 +24,8 @@ class IosDevice final : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using Dict = QMap<QString, QString>;
|
||||
using ConstPtr = QSharedPointer<const IosDevice>;
|
||||
using Ptr = QSharedPointer<IosDevice>;
|
||||
using ConstPtr = std::shared_ptr<const IosDevice>;
|
||||
using Ptr = std::shared_ptr<IosDevice>;
|
||||
|
||||
enum class Handler { IosTool, DeviceCtl };
|
||||
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
|
@@ -65,7 +65,7 @@ IosRunConfiguration::IosRunConfiguration(Target *target, Id id)
|
||||
|
||||
setUpdater([this, target] {
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||
const QString devName = dev ? dev->displayName() : IosDevice::name();
|
||||
setDefaultDisplayName(Tr::tr("Run on %1").arg(devName));
|
||||
setDisplayName(Tr::tr("Run %1 on %2").arg(applicationName()).arg(devName));
|
||||
|
||||
@@ -97,10 +97,10 @@ bool IosRunConfiguration::isEnabled(Id runMode) const
|
||||
return true;
|
||||
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
|
||||
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
|
||||
if (!dev || dev->deviceState() != IDevice::DeviceReadyToUse)
|
||||
return false;
|
||||
|
||||
IosDevice::ConstPtr iosdevice = dev.dynamicCast<const IosDevice>();
|
||||
IosDevice::ConstPtr iosdevice = std::dynamic_pointer_cast<const IosDevice>(dev);
|
||||
if (iosdevice && iosdevice->handler() == IosDevice::Handler::DeviceCtl
|
||||
&& runMode != ProjectExplorer::Constants::NORMAL_RUN_MODE) {
|
||||
return false;
|
||||
@@ -242,7 +242,7 @@ QString IosRunConfiguration::disabledReason(Id runMode) const
|
||||
DeviceManager *dm = DeviceManager::instance();
|
||||
for (int idev = 0; idev < dm->deviceCount(); ++idev) {
|
||||
IDevice::ConstPtr availDev = dm->deviceAt(idev);
|
||||
if (!availDev.isNull() && availDev->type() == Constants::IOS_DEVICE_TYPE) {
|
||||
if (availDev && availDev->type() == Constants::IOS_DEVICE_TYPE) {
|
||||
if (availDev->deviceState() == IDevice::DeviceReadyToUse) {
|
||||
validDevName += QLatin1Char(' ');
|
||||
validDevName += availDev->displayName();
|
||||
@@ -253,7 +253,7 @@ QString IosRunConfiguration::disabledReason(Id runMode) const
|
||||
}
|
||||
}
|
||||
|
||||
if (dev.isNull()) {
|
||||
if (!dev) {
|
||||
if (!validDevName.isEmpty())
|
||||
return Tr::tr("No device chosen. Select %1.").arg(validDevName); // should not happen
|
||||
else if (hasConncetedDev)
|
||||
@@ -277,7 +277,7 @@ QString IosRunConfiguration::disabledReason(Id runMode) const
|
||||
else
|
||||
return Tr::tr("%1 is not connected.").arg(dev->displayName());
|
||||
}
|
||||
IosDevice::ConstPtr iosdevice = dev.dynamicCast<const IosDevice>();
|
||||
IosDevice::ConstPtr iosdevice = std::dynamic_pointer_cast<const IosDevice>(dev);
|
||||
if (iosdevice && iosdevice->handler() == IosDevice::Handler::DeviceCtl
|
||||
&& runMode != ProjectExplorer::Constants::NORMAL_RUN_MODE) {
|
||||
return Tr::tr("Debugging and profiling is currently not supported for devices with iOS "
|
||||
|
@@ -118,7 +118,7 @@ DeviceCtlRunner::DeviceCtlRunner(RunControl *runControl)
|
||||
QTC_ASSERT(data, return);
|
||||
m_bundlePath = data->bundleDirectory;
|
||||
m_arguments = ProcessArgs::splitArgs(runControl->commandLine().arguments(), OsTypeMac);
|
||||
m_device = DeviceKitAspect::device(runControl->kit()).dynamicCast<const IosDevice>();
|
||||
m_device = std::dynamic_pointer_cast<const IosDevice>(DeviceKitAspect::device(runControl->kit()));
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
m_pollTimer.setInterval(500ms); // not too often since running devicectl takes time
|
||||
@@ -465,9 +465,9 @@ FilePath IosRunner::bundlePath() const
|
||||
|
||||
QString IosRunner::deviceId() const
|
||||
{
|
||||
IosDevice::ConstPtr dev = m_device.dynamicCast<const IosDevice>();
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(m_device);
|
||||
if (!dev)
|
||||
return QString();
|
||||
return {};
|
||||
return dev->uniqueDeviceID();
|
||||
}
|
||||
|
||||
@@ -502,16 +502,16 @@ void IosRunner::start()
|
||||
return;
|
||||
}
|
||||
if (m_device->type() == Ios::Constants::IOS_DEVICE_TYPE) {
|
||||
IosDevice::ConstPtr iosDevice = m_device.dynamicCast<const IosDevice>();
|
||||
if (m_device.isNull()) {
|
||||
IosDevice::ConstPtr iosDevice = std::dynamic_pointer_cast<const IosDevice>(m_device);
|
||||
if (!m_device) {
|
||||
reportFailure();
|
||||
return;
|
||||
}
|
||||
if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices)
|
||||
m_qmlServerPort = iosDevice->nextPort();
|
||||
} else {
|
||||
IosSimulator::ConstPtr sim = m_device.dynamicCast<const IosSimulator>();
|
||||
if (sim.isNull()) {
|
||||
IosSimulator::ConstPtr sim = std::dynamic_pointer_cast<const IosSimulator>(m_device);
|
||||
if (!sim) {
|
||||
reportFailure();
|
||||
return;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ IosRunSupport::IosRunSupport(RunControl *runControl)
|
||||
setId("IosRunSupport");
|
||||
runControl->setIcon(Icons::RUN_SMALL_TOOLBAR);
|
||||
runControl->setDisplayName(QString("Run on %1")
|
||||
.arg(device().isNull() ? QString() : device()->displayName()));
|
||||
.arg(device() ? device()->displayName() : QString()));
|
||||
}
|
||||
|
||||
IosRunSupport::~IosRunSupport()
|
||||
@@ -798,7 +798,7 @@ void IosDebugSupport::start()
|
||||
}
|
||||
|
||||
if (device()->type() == Ios::Constants::IOS_DEVICE_TYPE) {
|
||||
IosDevice::ConstPtr dev = device().dynamicCast<const IosDevice>();
|
||||
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(device());
|
||||
setStartMode(AttachToRemoteProcess);
|
||||
setIosPlatform("remote-ios");
|
||||
const QString osVersion = dev->osVersion();
|
||||
@@ -877,7 +877,7 @@ void IosDebugSupport::start()
|
||||
IosRunWorkerFactory::IosRunWorkerFactory()
|
||||
{
|
||||
setProducer([](RunControl *control) -> RunWorker * {
|
||||
IosDevice::ConstPtr iosdevice = control->device().dynamicCast<const IosDevice>();
|
||||
IosDevice::ConstPtr iosdevice = std::dynamic_pointer_cast<const IosDevice>(control->device());
|
||||
if (iosdevice && iosdevice->handler() == IosDevice::Handler::DeviceCtl) {
|
||||
return new DeviceCtlRunner(control);
|
||||
}
|
||||
|
@@ -42,8 +42,8 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType);
|
||||
class IosSimulator final : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using ConstPtr = QSharedPointer<const IosSimulator>;
|
||||
using Ptr = QSharedPointer<IosSimulator>;
|
||||
using ConstPtr = std::shared_ptr<const IosSimulator>;
|
||||
using Ptr = std::shared_ptr<IosSimulator>;
|
||||
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
|
||||
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
|
@@ -127,7 +127,7 @@ PerfConfigWidget::PerfConfigWidget(PerfSettings *settings, Target *target)
|
||||
if (target)
|
||||
device = DeviceKitAspect::device(target->kit());
|
||||
|
||||
if (device.isNull()) {
|
||||
if (!device) {
|
||||
useTracePointsButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
@@ -234,9 +234,9 @@ static int queue(const QList<Project *> &projects, const QList<Id> &stepIds,
|
||||
const FilePath executable = rc->commandLine().executable();
|
||||
IDevice::ConstPtr device = DeviceManager::deviceForPath(executable);
|
||||
for (const Target * const t : targetsForSelection(p, configSelection)) {
|
||||
if (device.isNull())
|
||||
if (!device)
|
||||
device = DeviceKitAspect::device(t->kit());
|
||||
if (device.isNull() || device->type() != Constants::DESKTOP_DEVICE_TYPE)
|
||||
if (!device || device->type() != Constants::DESKTOP_DEVICE_TYPE)
|
||||
continue;
|
||||
for (const BuildConfiguration * const bc
|
||||
: buildConfigsForSelection(t, configSelection)) {
|
||||
@@ -295,9 +295,8 @@ static int queue(const QList<Project *> &projects, const QList<Id> &stepIds,
|
||||
for (const Project *pro : projects) {
|
||||
for (const Target *const t : targetsForSelection(pro, configSelection)) {
|
||||
for (const BuildConfiguration *bc : buildConfigsForSelection(t, configSelection)) {
|
||||
const IDevice::Ptr device = BuildDeviceKitAspect::device(bc->kit())
|
||||
.constCast<IDevice>();
|
||||
|
||||
const IDevice::Ptr device = std::const_pointer_cast<IDevice>(
|
||||
BuildDeviceKitAspect::device(bc->kit()));
|
||||
if (device && !device->prepareForBuild(t)) {
|
||||
preambleMessage.append(
|
||||
Tr::tr("The build device failed to prepare for the build of %1 (%2).")
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
}
|
||||
|
||||
IDevice::Ptr newDevice = factory->create();
|
||||
if (newDevice.isNull()) {
|
||||
if (!newDevice) {
|
||||
emit addOutput(Tr::tr("No device configured."), OutputFormat::ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ Id DeviceManagerModel::deviceId(int pos) const
|
||||
|
||||
int DeviceManagerModel::indexOf(IDevice::ConstPtr dev) const
|
||||
{
|
||||
if (dev.isNull())
|
||||
if (!dev)
|
||||
return -1;
|
||||
for (int i = 0; i < d->devices.count(); ++i) {
|
||||
IDevice::ConstPtr current = d->devices.at(i);
|
||||
|
@@ -186,7 +186,7 @@ void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device)
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
processList.reset(new ProcessList(device->sharedFromThis(), this));
|
||||
processList.reset(new ProcessList(device->shared_from_this(), this));
|
||||
|
||||
QTC_ASSERT(processList, return);
|
||||
proxyModel.setSourceModel(processList->model());
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "idevicefactory.h"
|
||||
#include "idevicewidget.h"
|
||||
#include "../projectexplorerconstants.h"
|
||||
#include "../projectexplorericons.h"
|
||||
#include "../projectexplorertr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -226,7 +225,7 @@ void DeviceSettingsWidget::addDevice()
|
||||
if (!factory)
|
||||
return;
|
||||
IDevice::Ptr device = factory->create();
|
||||
if (device.isNull())
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
Utils::asyncRun([device] { device->checkOsType(); });
|
||||
@@ -329,7 +328,7 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
|
||||
m_configWidget = nullptr;
|
||||
m_additionalActionButtons.clear();
|
||||
const IDevice::ConstPtr device = m_deviceManagerModel->device(index);
|
||||
if (device.isNull()) {
|
||||
if (!device) {
|
||||
setDeviceInfoWidgetsEnabled(false);
|
||||
m_removeConfigButton->setEnabled(false);
|
||||
clearDetails();
|
||||
|
@@ -92,7 +92,7 @@ public:
|
||||
};
|
||||
|
||||
// See cpp file for documentation.
|
||||
class PROJECTEXPLORER_EXPORT IDevice : public QEnableSharedFromThis<IDevice>
|
||||
class PROJECTEXPLORER_EXPORT IDevice : public std::enable_shared_from_this<IDevice>
|
||||
{
|
||||
friend class Internal::IDevicePrivate;
|
||||
public:
|
||||
|
@@ -3,18 +3,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
template <class T>
|
||||
class QSharedPointer;
|
||||
QT_END_NAMESPACE
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class IDevice;
|
||||
|
||||
using IDevicePtr = QSharedPointer<IDevice>;
|
||||
using IDeviceConstPtr = QSharedPointer<const IDevice>;
|
||||
using IDevicePtr = std::shared_ptr<IDevice>;
|
||||
using IDeviceConstPtr = std::shared_ptr<const IDevice>;
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -986,7 +986,7 @@ Tasks DeviceKitAspectFactory::validate(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
Tasks result;
|
||||
if (dev.isNull())
|
||||
if (!dev)
|
||||
result.append(BuildSystemTask(Task::Warning, Tr::tr("No device set.")));
|
||||
else if (!dev->isCompatibleWith(k))
|
||||
result.append(BuildSystemTask(Task::Error, Tr::tr("Device is incompatible with this kit.")));
|
||||
@@ -1000,7 +1000,7 @@ Tasks DeviceKitAspectFactory::validate(const Kit *k) const
|
||||
void DeviceKitAspectFactory::fix(Kit *k)
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
if (!dev.isNull() && !dev->isCompatibleWith(k)) {
|
||||
if (dev && !dev->isCompatibleWith(k)) {
|
||||
qWarning("Device is no longer compatible with kit \"%s\", removing it.",
|
||||
qPrintable(k->displayName()));
|
||||
DeviceKitAspect::setDeviceId(k, Id());
|
||||
@@ -1011,7 +1011,7 @@ void DeviceKitAspectFactory::setup(Kit *k)
|
||||
{
|
||||
QTC_ASSERT(DeviceManager::instance()->isLoaded(), return);
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
if (!dev.isNull() && dev->isCompatibleWith(k))
|
||||
if (dev && dev->isCompatibleWith(k))
|
||||
return;
|
||||
|
||||
DeviceKitAspect::setDeviceId(k, Id::fromSetting(defaultValue(k)));
|
||||
@@ -1026,13 +1026,13 @@ KitAspect *DeviceKitAspectFactory::createKitAspect(Kit *k) const
|
||||
QString DeviceKitAspectFactory::displayNamePostfix(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
return dev.isNull() ? QString() : dev->displayName();
|
||||
return dev ? dev->displayName() : QString();
|
||||
}
|
||||
|
||||
KitAspectFactory::ItemList DeviceKitAspectFactory::toUserOutput(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
return {{Tr::tr("Device"), dev.isNull() ? Tr::tr("Unconfigured") : dev->displayName()}};
|
||||
return {{Tr::tr("Device"), dev ? dev->displayName() : Tr::tr("Unconfigured") }};
|
||||
}
|
||||
|
||||
void DeviceKitAspectFactory::addToMacroExpander(Kit *kit, MacroExpander *expander) const
|
||||
@@ -1258,7 +1258,7 @@ void BuildDeviceKitAspectFactory::setup(Kit *k)
|
||||
{
|
||||
QTC_ASSERT(DeviceManager::instance()->isLoaded(), return );
|
||||
IDevice::ConstPtr dev = BuildDeviceKitAspect::device(k);
|
||||
if (!dev.isNull())
|
||||
if (dev)
|
||||
return;
|
||||
|
||||
dev = defaultDevice();
|
||||
@@ -1269,7 +1269,7 @@ Tasks BuildDeviceKitAspectFactory::validate(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = BuildDeviceKitAspect::device(k);
|
||||
Tasks result;
|
||||
if (dev.isNull())
|
||||
if (!dev)
|
||||
result.append(BuildSystemTask(Task::Warning, Tr::tr("No build device set.")));
|
||||
|
||||
return result;
|
||||
@@ -1284,13 +1284,13 @@ KitAspect *BuildDeviceKitAspectFactory::createKitAspect(Kit *k) const
|
||||
QString BuildDeviceKitAspectFactory::displayNamePostfix(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = BuildDeviceKitAspect::device(k);
|
||||
return dev.isNull() ? QString() : dev->displayName();
|
||||
return dev ? dev->displayName() : QString();
|
||||
}
|
||||
|
||||
KitAspectFactory::ItemList BuildDeviceKitAspectFactory::toUserOutput(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = BuildDeviceKitAspect::device(k);
|
||||
return {{Tr::tr("Build device"), dev.isNull() ? Tr::tr("Unconfigured") : dev->displayName()}};
|
||||
return {{Tr::tr("Build device"), dev ? dev->displayName() : Tr::tr("Unconfigured")}};
|
||||
}
|
||||
|
||||
void BuildDeviceKitAspectFactory::addToMacroExpander(Kit *kit, MacroExpander *expander) const
|
||||
|
@@ -579,7 +579,7 @@ void Target::setOverlayIcon(const QIcon &icon)
|
||||
QString Target::overlayIconToolTip()
|
||||
{
|
||||
IDevice::ConstPtr current = DeviceKitAspect::device(kit());
|
||||
return current.isNull() ? QString() : formatDeviceInfo(current->deviceInformation());
|
||||
return current ? formatDeviceInfo(current->deviceInformation()) : QString();
|
||||
}
|
||||
|
||||
Store Target::toMap() const
|
||||
@@ -858,7 +858,7 @@ void Target::updateDeviceState()
|
||||
|
||||
QIcon overlay;
|
||||
static const QIcon disconnected = Icons::DEVICE_DISCONNECTED_INDICATOR_OVERLAY.icon();
|
||||
if (current.isNull()) {
|
||||
if (!current) {
|
||||
overlay = disconnected;
|
||||
} else {
|
||||
switch (current->deviceState()) {
|
||||
|
@@ -177,13 +177,13 @@ Tasks QmlProject::projectIssues(const Kit *k) const
|
||||
result.append(createProjectTask(Task::TaskType::Warning, Tr::tr("No Qt version set in kit.")));
|
||||
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
if (dev.isNull())
|
||||
if (!dev)
|
||||
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Kit has no device.")));
|
||||
|
||||
if (version && version->qtVersion() < QVersionNumber(5, 0, 0))
|
||||
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Qt version is too old.")));
|
||||
|
||||
if (dev.isNull() || !version)
|
||||
if (!dev || !version)
|
||||
return result; // No need to check deeper than this
|
||||
|
||||
if (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
|
@@ -83,7 +83,7 @@ public:
|
||||
|
||||
DeviceProcessSignalOperation::Ptr signalOperation() const final
|
||||
{
|
||||
return DeviceProcessSignalOperation::Ptr(new QnxDeviceProcessSignalOperation(sharedFromThis()));
|
||||
return DeviceProcessSignalOperation::Ptr(new QnxDeviceProcessSignalOperation(shared_from_this()));
|
||||
}
|
||||
|
||||
DeviceTester *createDeviceTester() const final { return new QnxDeviceTester; }
|
||||
|
@@ -116,7 +116,7 @@ class QnxPlugin final : public ExtensionSystem::IPlugin
|
||||
[attachToQnxApplication, debugSeparator] {
|
||||
auto isQnxKit = [](const Kit *kit) {
|
||||
return DeviceTypeKitAspect::deviceTypeId(kit) == Constants::QNX_QNX_OS_TYPE
|
||||
&& !DeviceKitAspect::device(kit).isNull() && kit->isValid();
|
||||
&& DeviceKitAspect::device(kit) && kit->isValid();
|
||||
};
|
||||
|
||||
const bool hasValidQnxKit = KitManager::kit(isQnxKit) != nullptr;
|
||||
|
@@ -48,7 +48,7 @@ FilePath getToolFilePath(const QString &toolname, const Kit *kit, const IDevice:
|
||||
return !device ? FilePath::fromString(filePath) : device->filePath(filePath);
|
||||
}
|
||||
|
||||
QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const IDevice> &device)
|
||||
QString getToolNameByDevice(const QString &baseName, const std::shared_ptr<const IDevice> &device)
|
||||
{
|
||||
return OsSpecificAspects::withExecutableSuffix(device ? device->osType() : HostOsInfo::hostOs(), baseName);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace AppManager::Internal {
|
||||
|
||||
QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const ProjectExplorer::IDevice> &device = nullptr);
|
||||
QString getToolNameByDevice(const QString &baseName, const std::shared_ptr<const ProjectExplorer::IDevice> &device = nullptr);
|
||||
Utils::FilePath getToolFilePath(const QString &toolname, const ProjectExplorer::Kit *kit, const ProjectExplorer::IDevice::ConstPtr &device = nullptr);
|
||||
|
||||
} // AppManager::Internal
|
||||
|
@@ -79,7 +79,7 @@ void FileSystemAccessTest::initTestCase()
|
||||
|
||||
if (DeviceManager::deviceForPath(filePath) == nullptr) {
|
||||
const IDevice::Ptr device = m_testLinuxDeviceFactory.create();
|
||||
QVERIFY(!device.isNull());
|
||||
QVERIFY(device);
|
||||
DeviceManager *deviceManager = DeviceManager::instance();
|
||||
deviceManager->addDevice(device);
|
||||
m_device = deviceManager->find(device->id());
|
||||
|
@@ -662,7 +662,7 @@ void SshProcessInterfacePrivate::start()
|
||||
this, &SshProcessInterfacePrivate::handleConnected);
|
||||
connect(m_connectionHandle.get(), &SshConnectionHandle::disconnected,
|
||||
this, &SshProcessInterfacePrivate::handleDisconnected);
|
||||
auto linuxDevice = m_device.dynamicCast<const LinuxDevice>();
|
||||
auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device);
|
||||
QTC_ASSERT(linuxDevice, handleDone(); return);
|
||||
linuxDevice->connectionAccess()
|
||||
->attachToSharedConnection(m_connectionHandle.get(), m_sshParameters);
|
||||
@@ -1018,7 +1018,7 @@ LinuxDevice::~LinuxDevice()
|
||||
|
||||
IDeviceWidget *LinuxDevice::createWidget()
|
||||
{
|
||||
return new Internal::GenericLinuxDeviceConfigurationWidget(sharedFromThis());
|
||||
return new Internal::GenericLinuxDeviceConfigurationWidget(shared_from_this());
|
||||
}
|
||||
|
||||
DeviceTester *LinuxDevice::createDeviceTester() const
|
||||
@@ -1028,7 +1028,7 @@ DeviceTester *LinuxDevice::createDeviceTester() const
|
||||
|
||||
DeviceProcessSignalOperation::Ptr LinuxDevice::signalOperation() const
|
||||
{
|
||||
return DeviceProcessSignalOperation::Ptr(new RemoteLinuxSignalOperation(sharedFromThis()));
|
||||
return DeviceProcessSignalOperation::Ptr(new RemoteLinuxSignalOperation(shared_from_this()));
|
||||
}
|
||||
|
||||
bool LinuxDevice::usableAsBuildDevice() const
|
||||
@@ -1062,7 +1062,7 @@ bool LinuxDevice::handlesFile(const FilePath &filePath) const
|
||||
|
||||
ProcessInterface *LinuxDevice::createProcessInterface() const
|
||||
{
|
||||
return new SshProcessInterface(sharedFromThis());
|
||||
return new SshProcessInterface(shared_from_this());
|
||||
}
|
||||
|
||||
LinuxDevicePrivate::LinuxDevicePrivate(LinuxDevice *parent)
|
||||
@@ -1243,7 +1243,7 @@ private:
|
||||
this, &SshTransferInterface::handleConnected);
|
||||
connect(m_connectionHandle.get(), &SshConnectionHandle::disconnected,
|
||||
this, &SshTransferInterface::handleDisconnected);
|
||||
auto linuxDevice = m_device.dynamicCast<const LinuxDevice>();
|
||||
auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device);
|
||||
QTC_ASSERT(linuxDevice, startFailed("No Linux device"); return);
|
||||
linuxDevice->connectionAccess()
|
||||
->attachToSharedConnection(m_connectionHandle.get(), m_sshParameters);
|
||||
@@ -1497,8 +1497,8 @@ FileTransferInterface *LinuxDevice::createFileTransferInterface(
|
||||
}
|
||||
|
||||
switch (setup.m_method) {
|
||||
case FileTransferMethod::Sftp: return new SftpTransferImpl(setup, sharedFromThis());
|
||||
case FileTransferMethod::Rsync: return new RsyncTransferImpl(setup, sharedFromThis());
|
||||
case FileTransferMethod::Sftp: return new SftpTransferImpl(setup, shared_from_this());
|
||||
case FileTransferMethod::Rsync: return new RsyncTransferImpl(setup, shared_from_this());
|
||||
case FileTransferMethod::GenericCopy: return new GenericTransferImpl(setup);
|
||||
}
|
||||
QTC_CHECK(false);
|
||||
|
@@ -13,8 +13,8 @@ namespace RemoteLinux {
|
||||
class REMOTELINUX_EXPORT LinuxDevice : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using Ptr = QSharedPointer<LinuxDevice>;
|
||||
using ConstPtr = QSharedPointer<const LinuxDevice>;
|
||||
using Ptr = std::shared_ptr<LinuxDevice>;
|
||||
using ConstPtr = std::shared_ptr<const LinuxDevice>;
|
||||
|
||||
~LinuxDevice();
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public:
|
||||
Tr::tr("Cannot open remote terminal: Current kit has no device."));
|
||||
return;
|
||||
}
|
||||
const auto linuxDevice = device.dynamicCast<const LinuxDevice>();
|
||||
const auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(device);
|
||||
QTC_ASSERT(linuxDevice, return);
|
||||
linuxDevice->openTerminal(env, FilePath());
|
||||
});
|
||||
|
@@ -166,7 +166,7 @@ QList<ShellModelItem> ShellModel::remote() const
|
||||
QList<ShellModelItem> result;
|
||||
|
||||
ProjectExplorer::DeviceManager::instance()->forEachDevice(
|
||||
[&result](const QSharedPointer<const ProjectExplorer::IDevice> &device) {
|
||||
[&result](const std::shared_ptr<const ProjectExplorer::IDevice> &device) {
|
||||
if (device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
result << ShellModelItem{device->displayName(), {{device->rootPath(), {}}}};
|
||||
});
|
||||
|
Reference in New Issue
Block a user