IDevice::IDevice(const QString &type, Origin origin, Core::Id id) : d(new Internal::IDevicePrivate) { d->type = type; d->origin = origin; QTC_CHECK(origin == ManuallyAdded || id.isValid()); d->id = id.isValid() ? id : newId(); }
void CMakeKitInformation::setCMakeTool(Kit *k, const Core::Id id) { const Core::Id toSet = id.isValid() ? id : defaultCMakeToolId(); QTC_ASSERT(!id.isValid() || CMakeToolManager::findById(toSet), return); if (k) k->setValue(TOOL_ID, toSet.toSetting()); }
static Core::Id configIdForProject(ClangProjectSettings &projectSettings) { if (projectSettings.useGlobalConfig()) return CppTools::codeModelSettings()->clangDiagnosticConfigId(); Core::Id configId = projectSettings.warningConfigId(); if (!configId.isValid()) { configId = CppTools::codeModelSettings()->clangDiagnosticConfigId(); projectSettings.setWarningConfigId(configId); } return configId; }
QList<Task> TaskModel::tasks(Core::Id categoryId) const { if (!categoryId.isValid()) return m_tasks; QList<Task> taskList; foreach (const Task &t, m_tasks) { if (t.category == categoryId) taskList.append(t); } return taskList; }
KitInformation::ItemList DeviceTypeKitInformation::toUserOutput(Kit *k) const { Core::Id type = deviceTypeId(k); QString typeDisplayName = tr("Unknown device type"); if (type.isValid()) { QList<IDeviceFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>(); foreach (IDeviceFactory *factory, factories) { if (factory->availableCreationIds().contains(type)) { typeDisplayName = factory->displayNameForId(type); break; } } }
void TaskModel::clearTasks(Core::Id categoryId) { typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt; if (!categoryId.isValid()) { if (m_tasks.count() == 0) return; beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1); m_tasks.clear(); const IdCategoryConstIt cend = m_categories.constEnd(); for (IdCategoryConstIt it = m_categories.constBegin(); it != cend; ++it) m_categories[it.key()].clear(); endRemoveRows(); } else { int index = 0; int start = 0; CategoryData &global = m_categories[Core::Id()]; CategoryData &cat = m_categories[categoryId]; while (index < m_tasks.count()) { while (index < m_tasks.count() && m_tasks.at(index).category != categoryId) { ++start; ++index; } if (index == m_tasks.count()) break; while (index < m_tasks.count() && m_tasks.at(index).category == categoryId) ++index; // Index is now on the first non category beginRemoveRows(QModelIndex(), start, index - 1); for (int i = start; i < index; ++i) { global.removeTask(m_tasks.at(i)); cat.removeTask(m_tasks.at(i)); } m_tasks.erase(m_tasks.begin() + start, m_tasks.begin() + index); endRemoveRows(); index = start; } } m_maxSizeOfFileName = 0; m_lastMaxSizeIndex = 0; }
int BaseQmakeProjectWizardDialog::addTargetSetupPage(int id) { m_targetSetupPage = new ProjectExplorer::TargetSetupPage; const Core::Id platform = selectedPlatform(); QSet<Core::Id> features = { QtSupport::Constants::FEATURE_DESKTOP }; if (!platform.isValid()) m_targetSetupPage->setPreferredKitMatcher(QtKitInformation::qtVersionMatcher(features)); else m_targetSetupPage->setPreferredKitMatcher(QtKitInformation::platformMatcher(platform)); m_targetSetupPage->setRequiredKitMatcher(QtKitInformation::qtVersionMatcher(requiredFeatures())); resize(900, 450); if (id >= 0) setPage(id, m_targetSetupPage); else id = addPage(m_targetSetupPage); return id; }
RunControl *IosRunControlFactory::create(RunConfiguration *runConfig, ProjectExplorer::RunMode mode, QString *errorMessage) { Q_ASSERT(canRun(runConfig, mode)); IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig); Q_ASSERT(rc); RunControl *res = 0; Core::Id devId = ProjectExplorer::DeviceKitInformation::deviceId(rc->target()->kit()); // The device can only run an application at a time, if an app is running stop it. if (m_activeRunControls.contains(devId)) { if (QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[devId]) activeRunControl->stop(); m_activeRunControls.remove(devId); } if (mode == NormalRunMode) res = new Ios::Internal::IosRunControl(rc); else res = IosDebugSupport::createDebugRunControl(rc, errorMessage); if (devId.isValid()) m_activeRunControls[devId] = res; return res; }