예제 #1
0
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();
}
예제 #2
0
void FindPlugin::setupFilterMenuItems()
{
    QList<IFindFilter*> findInterfaces =
        ExtensionSystem::PluginManager::getObjects<IFindFilter>();
    Core::Command *cmd;
    Core::Context globalcontext(Core::Constants::C_GLOBAL);

    Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
    d->m_filterActions.clear();
    bool haveEnabledFilters = false;
    const Core::Id base("FindFilter.");
    foreach (IFindFilter *filter, findInterfaces) {
        QAction *action = new QAction(QLatin1String("    ") + filter->displayName(), this);
        bool isEnabled = filter->isEnabled();
        if (isEnabled)
            haveEnabledFilters = true;
        action->setEnabled(isEnabled);
        action->setData(qVariantFromValue(filter));
        cmd = Core::ActionManager::registerAction(action,
            base.withSuffix(filter->id()), globalcontext);
        cmd->setDefaultKeySequence(filter->defaultShortcut());
        mfindadvanced->addAction(cmd);
        d->m_filterActions.insert(filter, action);
        connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
        connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged()));
    }
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());
}
bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
    if (!canHandle(parent))
        return false;
    const Core::Id id = idFromMap(map);
    return id == RemoteLinuxCustomRunConfiguration::runConfigId()
            || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
}
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;
}
예제 #6
0
QList<Task> TaskModel::tasks(const Core::Id &categoryId) const
{
    if (categoryId.uniqueIdentifier() == 0)
        return m_tasks;

    QList<Task> taskList;
    foreach (const Task &t, m_tasks) {
        if (t.category.uniqueIdentifier() == categoryId.uniqueIdentifier())
            taskList.append(t);
    }
    return taskList;
}
QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
{
    Q_UNUSED(mode)
    QList<Core::Id> result;
    if (!canHandle(parent))
        return result;

    const Core::Id base = Core::Id(RemoteLinuxRunConfiguration::IdPrefix);
    foreach (const BuildTargetInfo &bti, parent->applicationTargets().list)
        result << base.withSuffix(bti.projectFilePath.toString());
    result << RemoteLinuxCustomRunConfiguration::runConfigId();
    return result;
}
예제 #8
0
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;
            }
        }
    }
예제 #9
0
FileName IosRunConfiguration::bundleDirectory() const
{
    FileName res;
    Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
    bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
    if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
        qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
        return res;
    }
    QmakeBuildConfiguration *bc =
            qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
    if (bc) {
        QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project());
        const QmakeProFileNode *node = 0;
        if (pro)
            node = pro->rootProjectNode();
        if (node)
            node = node->findProFileFor(profilePath());
        if (node) {
            TargetInformation ti = node->targetInformation();
            if (ti.valid)
                res = FileName::fromString(ti.buildDir);
        }
        if (res.isEmpty())
            res = bc->buildDirectory();
        switch (bc->buildType()) {
        case BuildConfiguration::Debug :
        case BuildConfiguration::Unknown :
            if (isDevice)
                res.appendPath(QLatin1String("Debug-iphoneos"));
            else
                res.appendPath(QLatin1String("Debug-iphonesimulator"));
            break;
        case BuildConfiguration::Profile :
        case BuildConfiguration::Release :
            if (isDevice)
                res.appendPath(QLatin1String("Release-iphoneos"));
            else
                res.appendPath(QLatin1String("Release-iphonesimulator"));
            break;
        default:
            qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
                     << target()->activeBuildConfiguration()->buildType();
        }
    }
    res.appendPath(applicationName() + QLatin1String(".app"));
    return res;
}
예제 #10
0
void TaskWindow::setCategoryVisibility(const Core::Id &categoryId, bool visible)
{
    if (categoryId.uniqueIdentifier() == 0)
        return;

    QList<Core::Id> categories = d->m_filter->filteredCategories();

    if (visible) {
        categories.removeOne(categoryId);
    } else {
        categories.append(categoryId);
    }

    d->m_filter->setFilteredCategories(categories);

    int count = 0;
    if (d->m_filter->filterIncludesErrors())
        count += d->m_model->errorTaskCount(categoryId);
    if (d->m_filter->filterIncludesWarnings())
        count += d->m_model->warningTaskCount(categoryId);
    if (visible)
        d->m_badgeCount += count;
    else
        d->m_badgeCount -= count;
    setBadgeNumber(d->m_badgeCount);
}
QString QnxDeployConfigurationFactory::displayNameForId(const Core::Id id) const
{
    if (id.name().startsWith(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID))
        return tr("Deploy to QNX Device");

    return QString();
}
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
{
    QString idstr = QString::fromUtf8(id.name());
    if (!idstr.startsWith(QLatin1String(CMAKE_RC_PREFIX)))
        return QString();
    return idstr.mid(QString::fromLatin1(CMAKE_RC_PREFIX).length());
}
bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
    if (!canHandle(parent) || !id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))
        return false;

    Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
    if (!qt4Project)
        return false;

    return qt4Project->hasApplicationProFile(pathFromId(id));
}
QString QnxRunConfigurationFactory::displayNameForId(const Core::Id id) const
{
    const QString path = pathFromId(id);
    if (path.isEmpty())
        return QString();

    if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))
        return tr("%1 on QNX Device").arg(QFileInfo(path).completeBaseName());

    return QString();
}
예제 #15
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;
}
QString BlackBerryRunConfigurationFactory::displayNameForId(const Core::Id id) const
{
    const QString path = pathFromId(id);
    if (path.isEmpty())
        return QString();

    if (id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))
        return QFileInfo(path).completeBaseName();

    return QString();
}
예제 #17
0
void TaskModel::clearTasks(const Core::Id &categoryId)
{
    if (categoryId.uniqueIdentifier() == 0) {
        if (m_tasks.count() == 0)
            return;
        beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1);
        m_tasks.clear();
        foreach (const Core::Id &key, m_categories.keys())
            m_categories[key].clear();
        endRemoveRows();
    } else {
예제 #18
0
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;
}
예제 #19
0
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;
}
예제 #20
0
void TaskWindow::setCategoryVisibility(const Core::Id &categoryId, bool visible)
{
    if (categoryId.uniqueIdentifier() == 0)
        return;

    QList<Core::Id> categories = d->m_filter->filteredCategories();

    if (visible) {
        categories.removeOne(categoryId);
    } else {
        categories.append(categoryId);
    }

    d->m_filter->setFilteredCategories(categories);
}
/*!
    \brief Removes the knowledge about a shortcut under the specified \a id.

    Usually you do not need to unregister shortcuts. The only valid use case for unregistering
    shortcuts, is for shortcuts that represent user definable actions. If the user removes such an action,
    a corresponding shortcut also has to be unregistered from the action manager,
    to make it disappear from shortcut settings etc.
*/
void ActionManager::unregisterShortcut(const Core::Id &id)
{
    Shortcut *sc = 0;
    CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0);
    QTC_ASSERT(c, return);
    sc = qobject_cast<Shortcut *>(c);
    if (!sc) {
        qWarning() << "unregisterShortcut: id" << id.name()
                   << "is registered with a different command type.";
        return;
    }
    delete sc->shortcut();
    m_instance->d->m_idCmdMap.remove(id);
    delete sc;
    emit m_instance->commandListChanged();
}
예제 #22
0
void TaskModel::clearTasks(const Core::Id &categoryId)
{
    typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;

    if (categoryId.uniqueIdentifier() == 0) {
        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;
}
예제 #23
0
void TaskWindow::clearTasks(const Core::Id &categoryId)
{
    if (categoryId.uniqueIdentifier() != 0 && !d->m_filter->filteredCategories().contains(categoryId)) {
        if (d->m_filter->filterIncludesErrors())
            d->m_badgeCount -= d->m_model->errorTaskCount(categoryId);
        if (d->m_filter->filterIncludesWarnings())
            d->m_badgeCount -= d->m_model->warningTaskCount(categoryId);
        if (d->m_filter->filterIncludesUnknowns())
            d->m_badgeCount -= d->m_model->unknownTaskCount(categoryId);
    } else {
        d->m_badgeCount = 0;
    }

    d->m_model->clearTasks(categoryId);

    emit tasksChanged();
    emit tasksCleared();
    navigateStateChanged();

    setBadgeNumber(d->m_badgeCount);
}
예제 #24
0
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
{
    return id.suffixAfter(CMAKE_RC_PREFIX);
}
static QString pathFromId(const Core::Id id)
{
    return id.suffixAfter(Constants::QNX_BB_RUNCONFIGURATION_PREFIX);
}
QString IosDeployConfigurationFactory::displayNameForId(Core::Id id) const
{
    if (id.name().startsWith(IOS_DC_PREFIX))
        return tr("Deploy on iOS");
    return QString();
}
bool QnxDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
    return canHandle(parent) && id.name().startsWith(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
}
QVariant CMakeKitInformation::defaultValue(const Kit *k) const
{
    const Core::Id id = k ? defaultCMakeToolId() : Core::Id();
    return id.toSetting();
}
예제 #29
0
ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id) :
    QObject(parent),
    m_id(id)
{ setObjectName(id.toString()); }
QString NimRunConfigurationFactory::displayNameForId(Core::Id id) const
{
    QString result = id.toString() + QStringLiteral("-TempRunConf");
    return result;
}