本文整理汇总了C++中idevice::ConstPtr::type方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstPtr::type方法的具体用法?C++ ConstPtr::type怎么用?C++ ConstPtr::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idevice::ConstPtr
的用法示例。
在下文中一共展示了ConstPtr::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: 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;
}
示例4: initialize
bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
m_runData = new WinRtPluginRunData;
auto runConstraint = [](RunConfiguration *runConfig) {
IDevice::ConstPtr device = DeviceKitInformation::device(runConfig->target()->kit());
if (!device)
return false;
return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
};
auto debugConstraint = [](RunConfiguration *runConfig) {
IDevice::ConstPtr device = DeviceKitInformation::device(runConfig->target()->kit());
if (!device)
return false;
if (device->type() != Internal::Constants::WINRT_DEVICE_TYPE_LOCAL)
return false;
return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
};
RunControl::registerWorker<WinRtRunner>
(ProjectExplorer::Constants::NORMAL_RUN_MODE, runConstraint);
RunControl::registerWorker<WinRtDebugSupport>
(ProjectExplorer::Constants::DEBUG_RUN_MODE, debugConstraint);
return true;
}
示例5: 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;
}
示例6: 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();
}
示例7:
QList<Core::Id> WinRtDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
if (!parent->project()->supportsKit(parent->kit()))
return QList<Core::Id>();
IDevice::ConstPtr device = DeviceKitInformation::device(parent->kit());
if (!device)
return QList<Core::Id>();
if (device->type() == Constants::WINRT_DEVICE_TYPE_LOCAL)
return QList<Core::Id>() << Core::Id(appxDeployConfigurationC);
if (device->type() == Constants::WINRT_DEVICE_TYPE_PHONE)
return QList<Core::Id>() << Core::Id(phoneDeployConfigurationC);
if (device->type() == Constants::WINRT_DEVICE_TYPE_EMULATOR)
return QList<Core::Id>() << Core::Id(emulatorDeployConfigurationC);
return QList<Core::Id>();
}
示例8: init
bool MerEmulatorStartStep::init()
{
IDevice::ConstPtr d = DeviceKitInformation::device(this->target()->kit());
if(d.isNull() || d->type() != Constants::MER_DEVICE_TYPE_I486) {
setEnabled(false);
return false;
}
const MerEmulatorDevice* device = static_cast<const MerEmulatorDevice*>(d.data());
m_vm = device->virtualMachine();
m_ssh = device->sshParameters();
return !m_vm.isEmpty();
}
示例9: defaultDeviceConfig
IDevice::ConstPtr TypeSpecificDeviceConfigurationListModel::defaultDeviceConfig() const
{
const DeviceManager * const deviceManager = DeviceManager::instance();
const int deviceCount = deviceManager->deviceCount();
for (int i = 0; i < deviceCount; ++i) {
const IDevice::ConstPtr device = deviceManager->deviceAt(i);
if (deviceMatches(device)
&& deviceManager->defaultDevice(device->type()) == device) {
return device;
}
}
return IDevice::ConstPtr();
}
示例10: LocalQmlProfilerRunner
Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
RunConfiguration *runConfiguration,
const Analyzer::AnalyzerStartParameters &sp,
QString *errorMessage)
{
// only desktop device is supported
const IDevice::ConstPtr device = DeviceKitInformation::device(
runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
Analyzer::AnalyzerRunControl *rc = Analyzer::AnalyzerManager::createRunControl(
sp, runConfiguration);
QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
if (!engine) {
delete rc;
return 0;
}
Configuration conf;
conf.executable = sp.debuggee;
conf.executableArguments = sp.debuggeeArgs;
conf.workingDirectory = sp.workingDirectory;
conf.environment = sp.environment;
conf.port = sp.analyzerPort;
if (conf.executable.isEmpty()) {
if (errorMessage)
*errorMessage = tr("No executable file to launch.");
return 0;
}
LocalQmlProfilerRunner *runner = new LocalQmlProfilerRunner(conf, engine);
QObject::connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished()));
QObject::connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
QObject::connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), runner,
SLOT(start()));
QObject::connect(rc, SIGNAL(finished()), runner, SLOT(stop()));
return rc;
}
示例11: 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);
}
}
}
示例12: canRun
bool WinRtRunControlFactory::canRun(RunConfiguration *runConfiguration,
Core::Id mode) const
{
if (!runConfiguration)
return false;
IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
if (!device)
return false;
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
|| mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
if (device->type() != Constants::WINRT_DEVICE_TYPE_LOCAL)
return false;
return qobject_cast<WinRtRunConfiguration *>(runConfiguration);
}
if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
return qobject_cast<WinRtRunConfiguration *>(runConfiguration);
return false;
}
示例13: canRun
bool WinRtRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const
{
if (!runConfiguration)
return false;
IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
if (!device)
return false;
switch (mode) {
case DebugRunMode:
case DebugRunModeWithBreakOnMain:
if (device->type() != Constants::WINRT_DEVICE_TYPE_LOCAL)
return false;
// fall through
case NormalRunMode:
return qobject_cast<WinRtRunConfiguration *>(runConfiguration);
default:
return false;
}
}
示例14: 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);
}
}
}
示例15: 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;
}