本文整理汇总了C++中idevice::ConstPtr::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstPtr::isNull方法的具体用法?C++ ConstPtr::isNull怎么用?C++ ConstPtr::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idevice::ConstPtr
的用法示例。
在下文中一共展示了ConstPtr::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disabledReason
QString IosRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
.arg(QFileInfo(m_profilePath).fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath);
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
return tr("Kit has incorrect device type for running on iOS devices.");
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
QString validDevName;
bool hasConncetedDev = false;
if (devType == Constants::IOS_DEVICE_TYPE) {
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->deviceState() == IDevice::DeviceReadyToUse) {
validDevName += QLatin1Char(' ');
validDevName += availDev->displayName();
} else if (availDev->deviceState() == IDevice::DeviceConnected) {
hasConncetedDev = true;
}
}
}
}
if (dev.isNull()) {
if (!validDevName.isEmpty())
return tr("No device chosen. Select %1.").arg(validDevName); // should not happen
else if (hasConncetedDev)
return tr("No device chosen. Enable developer mode on a device."); // should not happen
else
return tr("No device available.");
} else {
switch (dev->deviceState()) {
case IDevice::DeviceReadyToUse:
break;
case IDevice::DeviceConnected:
return tr("To use this device you need to enable developer mode on it.");
case IDevice::DeviceDisconnected:
case IDevice::DeviceStateUnknown:
if (!validDevName.isEmpty())
return tr("%1 is not connected. Select %2?")
.arg(dev->displayName(), validDevName);
else if (hasConncetedDev)
return tr("%1 is not connected. Enable developer mode on a device?")
.arg(dev->displayName());
else
return tr("%1 is not connected.").arg(dev->displayName());
}
}
return RunConfiguration::disabledReason();
}
示例2: init
bool MerLocalRsyncDeployStep::init()
{
Qt4ProjectManager::Qt4BuildConfiguration *bc = qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration*>(buildConfiguration());
if (!bc)
bc = qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration*>(target()->activeBuildConfiguration());
if (!bc) {
addOutput(tr("Cannot deploy: No active build configuration."),
ErrorMessageOutput);
return false;
}
const MerSdk *const merSdk = MerSdkKitInformation::sdk(target()->kit());
if (!merSdk) {
addOutput(tr("Cannot deploy: Missing MerSdk information in the kit"),ErrorMessageOutput);
return false;
}
const QString target = MerTargetKitInformation::targetName(this->target()->kit());
if (target.isEmpty()) {
addOutput(tr("Cannot deploy: Missing MerTarget information in the kit"),ErrorMessageOutput);
return false;
}
IDevice::ConstPtr device = DeviceKitInformation::device(this->target()->kit());
//TODO: HACK
if (device.isNull() && DeviceTypeKitInformation::deviceTypeId(this->target()->kit()) != Constants::MER_DEVICE_TYPE_ARM) {
addOutput(tr("Cannot deploy: Missing MerDevice information in the kit"),ErrorMessageOutput);
return false;
}
const QString projectDirectory = bc->shadowBuild() ? bc->shadowBuildDirectory() : project()->projectDirectory();
const QString deployCommand = QLatin1String("rsync");
ProcessParameters *pp = processParameters();
Utils::Environment env = bc ? bc->environment() : Utils::Environment::systemEnvironment();
//TODO HACK
if(!device.isNull())
env.appendOrSet(QLatin1String(Constants::MER_SSH_DEVICE_NAME),device->displayName());
pp->setMacroExpander(bc ? bc->macroExpander() : Core::VariableManager::instance()->macroExpander());
pp->setEnvironment(env);
pp->setWorkingDirectory(projectDirectory);
pp->setCommand(deployCommand);
pp->setArguments(arguments());
return AbstractProcessStep::init();
}
示例3: createDebuggerStartParameters
static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration *runConfig)
{
DebuggerStartParameters params;
Target *target = runConfig->target();
Kit *k = target->kit();
const IDevice::ConstPtr device = DeviceKitInformation::device(k);
if (device.isNull())
return params;
params.startMode = AttachToRemoteServer;
params.useCtrlCStub = true;
params.inferior.executable = runConfig->localExecutableFilePath();
params.remoteExecutable = runConfig->remoteExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.remoteSetupNeeded = true;
params.closeMode = KillAtClose;
params.inferior.commandLineArguments = runConfig->arguments();
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) {
params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = 0; // QML port is handed out later
}
auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
if (qtVersion)
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
return params;
}
示例4: deviceMatches
bool TypeSpecificDeviceConfigurationListModel::deviceMatches(IDevice::ConstPtr dev) const
{
if (dev.isNull())
return false;
Core::Id typeId = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
return dev->type() == typeId;
}
示例5: IosAnalyzeSupport
RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runConfig,
QString *errorMessage)
{
Q_UNUSED(errorMessage);
Target *target = runConfig->target();
if (!target)
return 0;
IDevice::ConstPtr device = DeviceKitInformation::device(target->kit());
if (device.isNull())
return 0;
AnalyzerStartParameters params;
params.runMode = QmlProfilerRunMode;
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
params.debuggee = runConfig->localExecutable().toUserOutput();
params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
params.analyzerHost = QLatin1String("localhost");
if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) {
IosDevice::ConstPtr iosDevice = device.dynamicCast<const IosDevice>();
if (iosDevice.isNull())
return 0;
}
params.displayName = runConfig->applicationName();
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig);
(void) new IosAnalyzeSupport(runConfig, analyzerRunControl, false, true);
return analyzerRunControl;
}
示例6: deviceConnected
void IosDeviceManager::deviceConnected(const QString &uid, const QString &name)
{
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()) {
IosDevice *newDev = new IosDevice(uid);
if (!name.isNull())
newDev->setDisplayName(name);
qCDebug(detectLog) << "adding ios device " << uid;
devManager->addDevice(IDevice::ConstPtr(newDev));
} else if (dev->deviceState() != IDevice::DeviceConnected &&
dev->deviceState() != IDevice::DeviceReadyToUse) {
qCDebug(detectLog) << "updating ios device " << uid;
IosDevice *newDev = 0;
if (dev->type() == devType) {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
newDev = new IosDevice(*iosDev);
} else {
newDev = new IosDevice(uid);
}
devManager->addDevice(IDevice::ConstPtr(newDev));
}
updateInfo(uid);
}
示例7: currentDeviceChanged
void DeviceSettingsWidget::currentDeviceChanged(int index)
{
qDeleteAll(m_additionalActionButtons);
delete m_configWidget;
m_configWidget = 0;
m_additionalActionButtons.clear();
const IDevice::ConstPtr device = m_deviceManagerModel->device(index);
if (device.isNull()) {
m_ui->removeConfigButton->setEnabled(false);
clearDetails();
m_ui->defaultDeviceButton->setEnabled(false);
} else {
m_ui->removeConfigButton->setEnabled(true);
foreach (const Core::Id actionId, device->actionIds()) {
QPushButton * const button = new QPushButton(device->displayNameForActionId(actionId));
m_additionalActionButtons << button;
connect(button, SIGNAL(clicked()), m_additionalActionsMapper, SLOT(map()));
m_additionalActionsMapper->setMapping(button, actionId.uniqueIdentifier());
m_ui->buttonsLayout->insertWidget(m_ui->buttonsLayout->count() - 1, button);
}
if (!m_ui->osSpecificGroupBox->layout())
new QVBoxLayout(m_ui->osSpecificGroupBox);
int managerIndex = m_deviceManager->indexOf(device);
m_configWidget = m_deviceManager->mutableDeviceAt(managerIndex)->createWidget();
if (m_configWidget)
m_ui->osSpecificGroupBox->layout()->addWidget(m_configWidget);
displayCurrent();
}
}
示例8: createAnalyzerStartParameters
static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, RunMode mode)
{
AnalyzerStartParameters params;
Target *target = runConfig->target();
Kit *k = target->kit();
const IDevice::ConstPtr device = DeviceKitInformation::device(k);
if (device.isNull())
return params;
if (mode == QmlProfilerRunMode)
params.startMode = StartLocal;
params.runMode = mode;
params.debuggee = runConfig->remoteExecutableFilePath();
params.debuggeeArgs = runConfig->arguments().join(QLatin1Char(' '));
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
params.displayName = runConfig->displayName();
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
params.analyzerHost = params.connParams.host;
params.analyzerPort = params.connParams.port;
if (EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>())
params.environment = environment->environment();
return params;
}
示例9: tr
QList<Task> DeviceTypeKitInformation::validate(Kit *k) const
{
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
QList<Task> result;
if (!dev.isNull() && dev->type() != DeviceTypeKitInformation::deviceTypeId(k))
result.append(Task(Task::Error, tr("Device does not match device type."),
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
return result;
}
示例10: updateDisplayNames
void IosRunConfiguration::updateDisplayNames()
{
if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) == Constants::IOS_DEVICE_TYPE)
m_deviceType = IosDeviceType(IosDeviceType::IosDevice);
else if (m_deviceType.type == IosDeviceType::IosDevice)
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
setDefaultDisplayName(tr("Run on %1").arg(devName));
setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName));
}
示例11: isEnabled
bool IosRunConfiguration::isEnabled() const
{
if (m_parseInProgress || !m_parseSuccess)
return false;
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
return false;
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
return false;
return RunConfiguration::isEnabled();
}
示例12: createDebuggerStartParameters
static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration *runConfig)
{
DebuggerStartParameters params;
Target *target = runConfig->target();
Kit *k = target->kit();
const IDevice::ConstPtr device = DeviceKitInformation::device(k);
if (device.isNull())
return params;
params.startMode = AttachToRemoteServer;
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString();
params.sysRoot = SysRootKitInformation::sysRoot(k).toString();
params.useCtrlCStub = true;
params.runConfiguration = runConfig;
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
params.toolChainAbi = tc->targetAbi();
params.executable = runConfig->localExecutableFilePath();
params.remoteExecutable = runConfig->remoteExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.displayName = runConfig->displayName();
params.remoteSetupNeeded = true;
params.closeMode = KillAtClose;
params.processArgs = runConfig->arguments().join(QLatin1Char(' '));
DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) {
params.languages |= QmlLanguage;
params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = 0; // QML port is handed out later
}
if (aspect->useCppDebugger())
params.languages |= CppLanguage;
if (const Project *project = runConfig->target()->project()) {
params.projectSourceDirectory = project->projectDirectory().toString();
if (const BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
params.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
}
QnxQtVersion *qtVersion =
dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
if (qtVersion)
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
return params;
}
示例13: tr
QList<Task> QmlProject::projectIssues(const Kit *k) const
{
QList<Task> result = Project::projectIssues(k);
const QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
if (!version)
result.append(createProjectTask(Task::TaskType::Error, tr("No Qt version set in kit.")));
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
if (dev.isNull())
result.append(createProjectTask(Task::TaskType::Error, tr("Kit has no device.")));
if (version && version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0))
result.append(createProjectTask(Task::TaskType::Error, tr("Qt version is too old.")));
if (dev.isNull() || !version)
return result; // No need to check deeper than this
if (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (version->type() == QtSupport::Constants::DESKTOPQT) {
if (static_cast<const QtSupport::DesktopQtVersion *>(version)->qmlsceneCommand().isEmpty()) {
result.append(createProjectTask(Task::TaskType::Error,
tr("Qt version has no qmlscene command.")));
}
} else {
// Non-desktop Qt on a desktop device? We don't support that.
result.append(createProjectTask(Task::TaskType::Error,
tr("Non-desktop Qt is used with a desktop device.")));
}
} else {
// If not a desktop device, don't check the Qt version for qmlscene.
// The device is responsible for providing it and we assume qmlscene can be found
// in $PATH if it's not explicitly given.
}
return result;
}
示例14: 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);
}
}
}
示例15: 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);
}
}
}