forked from qt-creator/qt-creator
ProjectExplorer: Introduce DeviceManager::defaultDesktopDevice()
Just syntactic sugar to make doing the right thing less painful. Change-Id: Ia51cda20e5395925215f226b9a379af66fddfd8b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -63,10 +63,8 @@ PerfTracePointDialog::PerfTracePointDialog() :
|
||||
}
|
||||
|
||||
if (!m_device) {
|
||||
const DeviceManager *deviceManager = DeviceManager::instance();
|
||||
|
||||
// There should at least be a desktop device.
|
||||
m_device = deviceManager->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||
m_device = DeviceManager::defaultDesktopDevice();
|
||||
QTC_ASSERT(m_device, return);
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ Runnable CustomExecutableRunConfiguration::runnable() const
|
||||
r.setCommandLine(commandLine());
|
||||
r.environment = aspect<EnvironmentAspect>()->environment();
|
||||
r.workingDirectory = workingDirectory.toString();
|
||||
r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||
r.device = DeviceManager::defaultDesktopDevice();
|
||||
|
||||
if (!r.executable.isEmpty()) {
|
||||
const QString expanded = macroExpander()->expand(r.executable.toString());
|
||||
|
@@ -331,6 +331,11 @@ IDevice::ConstPtr DeviceManager::deviceForPath(const FilePath &path)
|
||||
return {};
|
||||
}
|
||||
|
||||
IDevice::ConstPtr DeviceManager::defaultDesktopDevice()
|
||||
{
|
||||
return m_instance->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
void DeviceManager::setDefaultDevice(Utils::Id id)
|
||||
{
|
||||
QTC_ASSERT(this != instance(), return);
|
||||
|
@@ -69,7 +69,9 @@ public:
|
||||
void setDeviceState(Utils::Id deviceId, IDevice::DeviceState deviceState);
|
||||
|
||||
bool isLoaded() const;
|
||||
|
||||
static IDevice::ConstPtr deviceForPath(const Utils::FilePath &path);
|
||||
static IDevice::ConstPtr defaultDesktopDevice();
|
||||
|
||||
signals:
|
||||
void deviceAdded(Utils::Id id);
|
||||
|
@@ -1231,8 +1231,7 @@ BuildDeviceKitAspect::BuildDeviceKitAspect()
|
||||
QVariant BuildDeviceKitAspect::defaultValue(const Kit *k) const
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
IDevice::ConstPtr defaultDevice =
|
||||
DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||
IDevice::ConstPtr defaultDevice = DeviceManager::defaultDesktopDevice();
|
||||
return defaultDevice->id().toString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user