当前位置: 首页>>代码示例>>C++>>正文


C++ FolderNode类代码示例

本文整理汇总了C++中FolderNode的典型用法代码示例。如果您正苦于以下问题:C++ FolderNode类的具体用法?C++ FolderNode怎么用?C++ FolderNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FolderNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QTC_CHECK

void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
{
    QTC_CHECK(m_fileList.isEmpty()); // Happens after this page is done
    QString generatedProject = generatedProjectFilePath(files);
    IWizardFactory::WizardKind kind = wizardKind(m_wizard);

    FolderNode *folder = currentNode();
    if (!folder)
        return;
    if (kind == IWizardFactory::ProjectWizard) {
        if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) {
            QMessageBox::critical(m_wizard, tr("Failed to Add to Project"),
                                  tr("Failed to add subproject \"%1\"\nto project \"%2\".")
                                  .arg(QDir::toNativeSeparators(generatedProject))
                                  .arg(folder->filePath().toUserOutput()));
            return;
        }
        m_wizard->removeAttributeFromAllFiles(GeneratedFile::OpenProjectAttribute);
    } else {
        QStringList filePaths = Utils::transform(files, [](const JsonWizard::GeneratorFile &f) {
            return f.file.path();
        });
        if (!folder->addFiles(filePaths)) {
            QStringList nativeFilePaths = Utils::transform(filePaths, &QDir::toNativeSeparators);
            QMessageBox::critical(wizard(), tr("Failed to Add to Project"),
                                  tr("Failed to add one or more files to project\n\"%1\" (%2).")
                                  .arg(folder->filePath().toUserOutput(),
                                       nativeFilePaths.join(QLatin1String(", "))));
            return;
        }
    }
    return;
}
开发者ID:UIKit0,项目名称:qt-creator,代码行数:33,代码来源:jsonsummarypage.cpp

示例2: QLatin1Char

FolderNode *GenericProjectNode::createFolderByName(const QStringList &components, int end)
{
    if (end == 0)
        return this;

    QString folderName;
    for (int i = 0; i < end; ++i) {
        folderName.append(components.at(i));
        folderName += QLatin1Char('/');
    }

    const QString component = components.at(end - 1);

    if (component.isEmpty())
        return this;

    const QString baseDir = QFileInfo(path()).path();
    FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
    folder->setDisplayName(component);

    FolderNode *parent = findFolderByName(components, end - 1);
    if (!parent)
        parent = createFolderByName(components, end - 1);
    addFolderNodes(QList<FolderNode*>() << folder, parent);

    return folder;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例3: generatedProjectFilePath

// Add files to project && version control
bool ProjectFileWizardExtension::processProject(
        const QList<GeneratedFile> &files,
        bool *removeOpenProjectAttribute, QString *errorMessage)
{
    *removeOpenProjectAttribute = false;

    QString generatedProject = generatedProjectFilePath(files);

    FolderNode *folder = m_context->page->currentNode();
    if (!folder)
        return true;
    if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) {
        if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) {
            *errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".")
                            .arg(generatedProject).arg(folder->path());
            return false;
        }
        *removeOpenProjectAttribute = true;
    } else {
        QStringList filePaths = Utils::transform(files, &GeneratedFile::path);
        if (!folder->addFiles(filePaths)) {
            *errorMessage = tr("Failed to add one or more files to project\n\"%1\" (%2).").
                    arg(folder->path(), filePaths.join(QLatin1Char(',')));
            return false;
        }
    }
    return true;
}
开发者ID:maui-packages,项目名称:qt-creator,代码行数:29,代码来源:projectfilewizardextension.cpp

示例4: visibleFolderNode

QModelIndex FlatModel::parent(const QModelIndex &idx) const
{
    QModelIndex parentIndex;
    if (Node *node = nodeForIndex(idx)) {
        FolderNode *parentNode = visibleFolderNode(node->parentFolderNode());
        if (parentNode) {
            FolderNode *grandParentNode = visibleFolderNode(parentNode->parentFolderNode());
            if (grandParentNode) {
                QHash<FolderNode*, QList<Node*> >::const_iterator it = m_childNodes.constFind(grandParentNode);
                if (it == m_childNodes.constEnd()) {
                    fetchMore(grandParentNode);
                    it = m_childNodes.constFind(grandParentNode);
                }
                Q_ASSERT(it != m_childNodes.constEnd());
                const int row = it.value().indexOf(parentNode);
                Q_ASSERT(row >= 0);
                parentIndex = createIndex(row, 0, parentNode);
            } else {
                // top level node, parent is session
                parentIndex = index(0, 0, QModelIndex());
            }
        }
    }

//    qDebug() << "parent of " << idx.data(Project::FilePathRole) << " is " << parentIndex.data(Project::FilePathRole);

    return parentIndex;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例5: switch

QVariant FlatModel::data(const QModelIndex &index, int role) const
{
    QVariant result;

    if (Node *node = nodeForIndex(index)) {
        FolderNode *folderNode = node->asFolderNode();
        switch (role) {
        case Qt::DisplayRole: {
            QString name = node->displayName();

            if (node->nodeType() == NodeType::Project
                    && node->parentFolderNode()
                    && node->parentFolderNode()->nodeType() == NodeType::Session) {
                const QString vcsTopic = static_cast<ProjectNode *>(node)->vcsTopic();

                if (!vcsTopic.isEmpty())
                    name += QLatin1String(" [") + vcsTopic + QLatin1Char(']');
            }

            result = name;
            break;
        }
        case Qt::EditRole: {
            result = node->filePath().fileName();
            break;
        }
        case Qt::ToolTipRole: {
            result = node->tooltip();
            break;
        }
        case Qt::DecorationRole: {
            if (folderNode)
                result = folderNode->icon();
            else
                result = Core::FileIconProvider::icon(node->filePath().toString());
            break;
        }
        case Qt::FontRole: {
            QFont font;
            if (node == m_startupProject)
                font.setBold(true);
            result = font;
            break;
        }
        case Project::FilePathRole: {
            result = node->filePath().toString();
            break;
        }
        case Project::EnabledRole: {
            result = node->isEnabled();
            break;
        }
        }
    }

    return result;
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:57,代码来源:projectmodels.cpp

示例6: foreach

void NimProject::addNodes(const QSet<QString> &nodes)
{
    QStringList path;
    foreach (const QString &node, nodes) {
        path = m_projectDir.relativeFilePath(node).split(QDir::separator());
        path.pop_back();
        FolderNode *folder = findFolderFor(path);
        auto fileNode = new FileNode(FileName::fromString(node), SourceType, false);
        folder->addFileNodes({fileNode});
    }
开发者ID:C-sjia,项目名称:qt-creator,代码行数:10,代码来源:nimproject.cpp

示例7: removeFileContextMenu

void ResourceEditorPlugin::removeFileContextMenu()
{
    ResourceFolderNode *rfn = static_cast<ResourceFolderNode *>(ProjectTree::currentNode());
    QString path = rfn->path().toString();
    FolderNode *parent = rfn->parentFolderNode();
    if (!parent->removeFiles(QStringList() << path))
        QMessageBox::warning(Core::ICore::mainWindow(),
                             tr("File Removal Failed"),
                             tr("Removing file %1 from the project failed.").arg(path));
}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:10,代码来源:resourceeditorplugin.cpp

示例8: switch

QVariant FlatModel::data(const QModelIndex &index, int role) const
{
    QVariant result;

    if (Node *node = nodeForIndex(index)) {
        FolderNode *folderNode = qobject_cast<FolderNode*>(node);
        switch (role) {
        case Qt::DisplayRole: {
            QString name = node->displayName();

            if (node->parentFolderNode()
                    && node->parentFolderNode()->nodeType() == SessionNodeType) {
                const QString vcsTopic = node->vcsTopic();

                if (!vcsTopic.isEmpty())
                    name += " (" + vcsTopic + ")";
            }

            result = name;
            break;
        }
        case Qt::EditRole: {
            result = node->displayName();
            break;
        }
        case Qt::ToolTipRole: {
            result = node->tooltip();
            break;
        }
        case Qt::DecorationRole: {
            if (folderNode)
                result = folderNode->icon();
            else
                result = FileIconProvider::instance()->icon(QFileInfo(node->path()));
            break;
        }
        case Qt::FontRole: {
            QFont font;
            if (node == m_startupProject)
                font.setBold(true);
            result = font;
            break;
        }
        case ProjectExplorer::Project::FilePathRole: {
            result = node->path();
            break;
        }
        }
    }

    return result;
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例9: updateContextActions

void ResourceEditorPlugin::updateContextActions(Node *node, Project *)
{
    bool isResourceNode = dynamic_cast<ResourceTopLevelNode *>(node);
    m_addPrefix->setEnabled(isResourceNode);
    m_addPrefix->setVisible(isResourceNode);

    bool enableRename = false;
    bool enableRemove = false;

    if (isResourceNode) {
        FolderNode *parent = node ? node->parentFolderNode() : 0;
        enableRename = parent && parent->supportedActions(node).contains(Rename);
        enableRemove = parent && parent->supportedActions(node).contains(RemoveFile);
    }

    m_renameResourceFile->setEnabled(isResourceNode && enableRename);
    m_renameResourceFile->setVisible(isResourceNode && enableRename);
    m_removeResourceFile->setEnabled(isResourceNode && enableRemove);
    m_removeResourceFile->setVisible(isResourceNode && enableRemove);

    m_openInEditor->setEnabled(isResourceNode);
    m_openInEditor->setVisible(isResourceNode);

    bool isResourceFolder = dynamic_cast<ResourceFolderNode *>(node);
    m_removePrefix->setEnabled(isResourceFolder);
    m_removePrefix->setVisible(isResourceFolder);

    m_renamePrefix->setEnabled(isResourceFolder);
    m_renamePrefix->setVisible(isResourceFolder);

    m_removeNonExisting->setEnabled(isResourceNode);
    m_removeNonExisting->setVisible(isResourceNode);

    if (isResourceNode)
        Core::EditorManager::populateOpenWithMenu(m_openWithMenu, node->path().toString());
    else
        m_openWithMenu->clear();
    m_openWithMenu->menuAction()->setVisible(!m_openWithMenu->actions().isEmpty());

    bool isResourceFile = dynamic_cast<ResourceFileNode *>(node);
    m_copyPath->setEnabled(isResourceFile);
    m_copyPath->setVisible(isResourceFile);
    m_copyUrl->setEnabled(isResourceFile);
    m_copyUrl->setVisible(isResourceFile);
    if (isResourceFile) {
        ResourceFileNode *fileNode = static_cast<ResourceFileNode *>(node);
        QString qrcPath = fileNode->qrcPath();
        m_copyPath->setParameter(QLatin1String(resourcePrefix) + qrcPath);
        m_copyUrl->setParameter(QLatin1String(urlPrefix) + qrcPath);
    }
}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:51,代码来源:resourceeditorplugin.cpp

示例10: while

Project *ProjectTree::projectForNode(Node *node)
{
    if (!node)
        return 0;

    FolderNode *rootProjectNode = node->asFolderNode();
    if (!rootProjectNode)
        rootProjectNode = node->parentFolderNode();

    while (rootProjectNode && rootProjectNode->parentFolderNode() != SessionManager::sessionNode())
        rootProjectNode = rootProjectNode->parentFolderNode();

    Q_ASSERT(rootProjectNode);

    return Utils::findOrDefault(SessionManager::projects(), Utils::equal(&Project::rootProjectNode, rootProjectNode));
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:16,代码来源:projecttree.cpp

示例11: addCMakeVFolder

static void addCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, int priority,
                            const QString &displayName,
                            std::vector<std::unique_ptr<FileNode>> &&files)
{
    if (files.size() == 0)
        return;
    FolderNode *folder = base;
    if (!displayName.isEmpty()) {
        auto newFolder = std::make_unique<VirtualFolderNode>(basePath, priority);
        newFolder->setDisplayName(displayName);
        folder = newFolder.get();
        base->addNode(std::move(newFolder));
    }
    folder->addNestedNodes(std::move(files));
    for (FolderNode *fn : folder->folderNodes())
        fn->compress();
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:17,代码来源:servermodereader.cpp

示例12: VERIFY

FormContainer* COutlookFrame::GetFormContainer()
{
    COutlookFrame* pFrame = static_cast<COutlookFrame*>(AfxGetMainWnd());
    VERIFY(pFrame);
    FolderNode* pFolderNode = static_cast<FolderNode*>(pFrame->m_pInterface->GetOutlookPane()->GetNode(0));
    InterfaceNode* pInterfaceNode = pFolderNode->GetSelNode();
    FolderNode* pFolderNode2 = dynamic_cast<FolderNode*>(pInterfaceNode);
    while (pFolderNode2 != NULL) {
        pInterfaceNode = pFolderNode2->GetSelNode();
        pFolderNode2 = dynamic_cast<FolderNode*>(pInterfaceNode);
    }

    if (dynamic_cast<MViewNode*>(pInterfaceNode) == NULL) {
        return NULL;
    }
    MViewNode* pNode = static_cast<MViewNode*>(pInterfaceNode);
    return static_cast<FormContainer*>(pNode->GetFormContainer());
}
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:18,代码来源:OutlookFrame.cpp

示例13: findOrDefault

FolderNode *setupCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, int priority,
                              const QString &displayName, QList<FileNode *> &files)
{
    if (files.isEmpty())
        return nullptr;

    FolderNode *folder
    = findOrDefault(base->folderNodes(), [basePath](const FolderNode *fn) {
        return fn->filePath() == basePath;
    });

    if (!folder) {
        folder = new VirtualFolderNode(basePath, priority);
        folder->setDisplayName(displayName);
        base->addFolderNodes({ folder });
    }
    folder->buildTree(files);
    return folder;
}
开发者ID:h4tr3d,项目名称:cmakeprojectmanager2,代码行数:19,代码来源:servermodereader.cpp

示例14: data

QVariant FlatModel::data(const QModelIndex &index, int role) const
{
    QVariant result;

    if (Node *node = nodeForIndex(index)) {
        FolderNode *folderNode = qobject_cast<FolderNode*>(node);
        switch (role) {
        case Qt::DisplayRole:
        case Qt::EditRole: {
            if (folderNode)
                result = folderNode->displayName();
            else
                result = QFileInfo(node->path()).fileName(); //TODO cache that?
            break;
        }
        case Qt::ToolTipRole: {
            result = QDir::toNativeSeparators(node->path());
            break;
        }
        case Qt::DecorationRole: {
            if (folderNode)
                result = folderNode->icon();
            else
                result = FileIconProvider::instance()->icon(QFileInfo(node->path()));
            break;
        }
        case Qt::FontRole: {
            QFont font;
            if (node == m_startupProject)
                font.setBold(true);
            result = font;
            break;
        }
        case ProjectExplorer::Project::FilePathRole: {
            result = node->path();
            break;
        }
        }
    }

    return result;
}
开发者ID:gaoxiaojun,项目名称:qtcreator,代码行数:42,代码来源:projectmodels.cpp

示例15: CreateInterface

void COutlookFrame::CreateInterface()
{
    FolderNode* initFolder = static_cast<FolderNode*>(m_pInterface->SelectNode(0));
    initFolder->SelectNode(0);
}
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:5,代码来源:OutlookFrame.cpp


注:本文中的FolderNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。