本文整理汇总了C++中DeviceManager::setDeviceState方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::setDeviceState方法的具体用法?C++ DeviceManager::setDeviceState怎么用?C++ DeviceManager::setDeviceState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::setDeviceState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAvailableDevices
void IosDeviceManager::updateAvailableDevices(const QStringList &devices)
{
foreach (const QString &uid, devices)
deviceConnected(uid);
DeviceManager *devManager = DeviceManager::instance();
for (int iDevice = 0; iDevice < devManager->deviceCount(); ++iDevice) {
IDevice::ConstPtr dev = devManager->deviceAt(iDevice);
Core::Id devType(Constants::IOS_DEVICE_TYPE);
if (dev.isNull() || dev->type() != devType)
continue;
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
if (devices.contains(iosDev->uniqueDeviceID()))
continue;
if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
qCDebug(detectLog) << "disconnecting device " << iosDev->uniqueDeviceID();
devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected);
}
}
}
示例2: deviceDisconnected
void IosDeviceManager::deviceDisconnected(const QString &uid)
{
qCDebug(detectLog) << "detected disconnection of ios device " << uid;
DeviceManager *devManager = DeviceManager::instance();
Core::Id baseDevId(Constants::IOS_DEVICE_ID);
Core::Id devType(Constants::IOS_DEVICE_TYPE);
Core::Id devId = baseDevId.withSuffix(uid);
IDevice::ConstPtr dev = devManager->find(devId);
if (dev.isNull() || dev->type() != devType) {
qCWarning(detectLog) << "ignoring disconnection of ios device " << uid; // should neve happen
} else {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
if (iosDev->m_extraInfo.isEmpty()
|| iosDev->m_extraInfo.value(QLatin1String("deviceName")) == QLatin1String("*unknown*")) {
devManager->removeDevice(iosDev->id());
} else if (iosDev->deviceState() != IDevice::DeviceDisconnected) {
qCDebug(detectLog) << "disconnecting device " << iosDev->uniqueDeviceID();
devManager->setDeviceState(iosDev->id(), IDevice::DeviceDisconnected);
}
}
}
示例3: deviceInfo
void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
const Ios::IosToolHandler::Dict &info)
{
DeviceManager *devManager = DeviceManager::instance();
Core::Id baseDevId(Constants::IOS_DEVICE_ID);
Core::Id devType(Constants::IOS_DEVICE_TYPE);
Core::Id devId = baseDevId.withSuffix(uid);
IDevice::ConstPtr dev = devManager->find(devId);
bool skipUpdate = false;
IosDevice *newDev = 0;
if (!dev.isNull() && dev->type() == devType) {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
if (iosDev->m_extraInfo == info) {
skipUpdate = true;
newDev = const_cast<IosDevice *>(iosDev);
} else {
newDev = new IosDevice(*iosDev);
}
} else {
newDev = new IosDevice(uid);
}
if (!skipUpdate) {
QString devNameKey = QLatin1String("deviceName");
if (info.contains(devNameKey))
newDev->setDisplayName(info.value(devNameKey));
newDev->m_extraInfo = info;
qCDebug(detectLog) << "updated info of ios device " << uid;
dev = IDevice::ConstPtr(newDev);
devManager->addDevice(dev);
}
QLatin1String devStatusKey = QLatin1String("developerStatus");
if (info.contains(devStatusKey)) {
QString devStatus = info.value(devStatusKey);
if (devStatus == QLatin1String("Development")) {
devManager->setDeviceState(newDev->id(), IDevice::DeviceReadyToUse);
m_userModeDeviceIds.removeOne(uid);
} else {
devManager->setDeviceState(newDev->id(), IDevice::DeviceConnected);
bool shouldIgnore = newDev->m_ignoreDevice;
newDev->m_ignoreDevice = true;
if (devStatus == QLatin1String("*off*")) {
if (!shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
QMessageBox mBox;
mBox.setText(tr("An iOS device in user mode has been detected."));
mBox.setInformativeText(tr("Do you want to see how to set it up for development?"));
mBox.setStandardButtons(QMessageBox::NoAll | QMessageBox::No | QMessageBox::Yes);
mBox.setDefaultButton(QMessageBox::Yes);
int ret = mBox.exec();
switch (ret) {
case QMessageBox::Yes:
Core::HelpManager::handleHelpRequest(
QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-developing-ios.html"));
break;
case QMessageBox::No:
break;
case QMessageBox::NoAll:
IosConfigurations::setIgnoreAllDevices(true);
break;
default:
break;
}
}
}
if (!m_userModeDeviceIds.contains(uid))
m_userModeDeviceIds.append(uid);
m_userModeDevicesTimer.start();
}
}
}