void VcsPlugin::updateVariable(const QByteArray &variable) { static ProjectExplorer::Project *cachedProject = 0; static Core::IVersionControl *cachedVc = 0; static QString cachedTopLevel; ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::currentProject(); if (cachedProject != project) { cachedVc = Core::VcsManager::findVersionControlForDirectory(project->projectDirectory().toString(), &cachedTopLevel); cachedProject = project; } if (variable == Constants::VAR_VCS_NAME) { if (cachedVc) Core::VariableManager::insert(variable, cachedVc->displayName()); else Core::VariableManager::remove(variable); } else if (variable == Constants::VAR_VCS_TOPIC) { if (cachedVc) Core::VariableManager::insert(variable, cachedVc->vcsTopic(cachedTopLevel)); else Core::VariableManager::remove(variable); } }
void CallgrindToolPrivate::handleFilterProjectCosts() { ProjectExplorer::Project *pro = ProjectExplorer::ProjectExplorerPlugin::currentProject(); QTC_ASSERT(pro, return); if (m_filterProjectCosts->isChecked()) { const QString projectDir = pro->projectDirectory(); m_proxyModel->setFilterBaseDir(projectDir); } else { m_proxyModel->setFilterBaseDir(QString()); } }
void DocumentManager::findPathToIsoProFile(bool *iconResourceFileAlreadyExists, QString *resourceFilePath, QString *resourceFileProPath, const QString &isoIconsQrcFile) { Utils::FileName qmlFileName = QmlDesignerPlugin::instance()->currentDesignDocument()->fileName(); ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(qmlFileName); ProjectExplorer::Node *node = ProjectExplorer::SessionManager::nodeForFile(qmlFileName)->parentFolderNode(); ProjectExplorer::Node *iconQrcFileNode = nullptr; while (node && !iconQrcFileNode) { qCDebug(documentManagerLog) << "Checking" << node->displayName() << "(" << node << node->nodeType() << ")"; if (node->nodeType() == ProjectExplorer::VirtualFolderNodeType && node->displayName() == "Resources") { ProjectExplorer::VirtualFolderNode *virtualFolderNode = dynamic_cast<ProjectExplorer::VirtualFolderNode*>(node); for (int subFolderIndex = 0; subFolderIndex < virtualFolderNode->subFolderNodes().size() && !iconQrcFileNode; ++subFolderIndex) { ProjectExplorer::FolderNode *subFolderNode = virtualFolderNode->subFolderNodes().at(subFolderIndex); qCDebug(documentManagerLog) << "Checking if" << subFolderNode->displayName() << "(" << subFolderNode << subFolderNode->nodeType() << ") is" << isoIconsQrcFile; if (subFolderNode->nodeType() == ProjectExplorer::FolderNodeType && subFolderNode->displayName() == isoIconsQrcFile) { qCDebug(documentManagerLog) << "Found" << isoIconsQrcFile << "in" << virtualFolderNode->filePath(); iconQrcFileNode = subFolderNode; *resourceFileProPath = iconQrcFileNode->projectNode()->filePath().toString(); } } } if (!iconQrcFileNode) { qCDebug(documentManagerLog) << "Didn't find" << isoIconsQrcFile << "in" << node->displayName() << "; checking parent"; node = node->parentFolderNode(); } } if (!iconQrcFileNode) { // The QRC file that we want doesn't exist or is not listed under RESOURCES in the .pro. *resourceFilePath = project->projectDirectory().toString() + "/" + isoIconsQrcFile; // We assume that the .pro containing the QML file is an acceptable place to add the .qrc file. ProjectExplorer::ProjectNode *projectNode = ProjectExplorer::SessionManager::nodeForFile(qmlFileName)->projectNode(); *resourceFileProPath = projectNode->filePath().toString(); } else { // We found the QRC file that we want. QString projectDirectory = ProjectExplorer::SessionManager::projectForNode(iconQrcFileNode)->projectDirectory().toString(); *resourceFilePath = projectDirectory + "/" + isoIconsQrcFile; } *iconResourceFileAlreadyExists = iconQrcFileNode != 0; }