forked from qt-creator/qt-creator
ProjectExplorer: Use setter for VirtualFolder's priority
More uniform code. Change-Id: I9a10a1bb15b0df9cf30c68d2c0537bfae2bed98a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -269,7 +269,8 @@ static void addCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, i
|
|||||||
return;
|
return;
|
||||||
FolderNode *folder = base;
|
FolderNode *folder = base;
|
||||||
if (!displayName.isEmpty()) {
|
if (!displayName.isEmpty()) {
|
||||||
auto newFolder = std::make_unique<VirtualFolderNode>(basePath, priority);
|
auto newFolder = std::make_unique<VirtualFolderNode>(basePath);
|
||||||
|
newFolder->setPriority(priority);
|
||||||
newFolder->setDisplayName(displayName);
|
newFolder->setDisplayName(displayName);
|
||||||
folder = newFolder.get();
|
folder = newFolder.get();
|
||||||
base->addNode(std::move(newFolder));
|
base->addNode(std::move(newFolder));
|
||||||
@@ -954,8 +955,8 @@ void ServerModeReader::addHeaderNodes(ProjectNode *root, const QList<FileNode *>
|
|||||||
|
|
||||||
static QIcon headerNodeIcon
|
static QIcon headerNodeIcon
|
||||||
= Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_H);
|
= Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_H);
|
||||||
auto headerNode
|
auto headerNode = std::make_unique<VirtualFolderNode>(root->filePath());
|
||||||
= std::make_unique<VirtualFolderNode>(root->filePath(), Node::DefaultPriority - 5);
|
headerNode->setPriority(Node::DefaultPriority - 5);
|
||||||
headerNode->setDisplayName(tr("<Headers>"));
|
headerNode->setDisplayName(tr("<Headers>"));
|
||||||
headerNode->setIcon(headerNodeIcon);
|
headerNode->setIcon(headerNodeIcon);
|
||||||
|
|
||||||
|
@@ -782,11 +782,10 @@ bool FolderNode::showWhenEmpty() const
|
|||||||
|
|
||||||
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
|
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
|
||||||
*/
|
*/
|
||||||
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) :
|
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath) :
|
||||||
FolderNode(folderPath)
|
FolderNode(folderPath)
|
||||||
{
|
{
|
||||||
setNodeType(NodeType::VirtualFolder);
|
setNodeType(NodeType::VirtualFolder);
|
||||||
setPriority(priority);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VirtualFolderNode::addFileFilter() const
|
QString VirtualFolderNode::addFileFilter() const
|
||||||
|
@@ -154,6 +154,7 @@ public:
|
|||||||
|
|
||||||
void setListInProject(bool l);
|
void setListInProject(bool l);
|
||||||
void setIsGenerated(bool g);
|
void setIsGenerated(bool g);
|
||||||
|
void setPriority(int priority);
|
||||||
|
|
||||||
static FileType fileTypeForMimeType(const Utils::MimeType &mt);
|
static FileType fileTypeForMimeType(const Utils::MimeType &mt);
|
||||||
static FileType fileTypeForFileName(const Utils::FileName &file);
|
static FileType fileTypeForFileName(const Utils::FileName &file);
|
||||||
@@ -163,7 +164,6 @@ protected:
|
|||||||
Node(const Node &other) = delete;
|
Node(const Node &other) = delete;
|
||||||
|
|
||||||
void setNodeType(NodeType nodeType);
|
void setNodeType(NodeType nodeType);
|
||||||
void setPriority(int priority);
|
|
||||||
void setLine(int line);
|
void setLine(int line);
|
||||||
void setFilePath(const Utils::FileName &filePath);
|
void setFilePath(const Utils::FileName &filePath);
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ private:
|
|||||||
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
|
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority);
|
explicit VirtualFolderNode(const Utils::FileName &folderPath);
|
||||||
|
|
||||||
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
||||||
QString addFileFilter() const override;
|
QString addFileFilter() const override;
|
||||||
|
@@ -129,9 +129,8 @@ void setupQbsProductData(QbsProjectManager::Internal::QbsProductNode *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add "Generated Files" Node:
|
// Add "Generated Files" Node:
|
||||||
auto genFiles
|
auto genFiles = std::make_unique<ProjectExplorer::VirtualFolderNode>(node->filePath());
|
||||||
= std::make_unique<ProjectExplorer::VirtualFolderNode>(node->filePath(),
|
genFiles->setPriority(ProjectExplorer::Node::DefaultProjectFilePriority - 10);
|
||||||
ProjectExplorer::Node::DefaultProjectFilePriority - 10);
|
|
||||||
genFiles->setDisplayName(QCoreApplication::translate("QbsProductNode", "Generated files"));
|
genFiles->setDisplayName(QCoreApplication::translate("QbsProductNode", "Generated files"));
|
||||||
setupArtifacts(genFiles.get(), prd.generatedArtifacts());
|
setupArtifacts(genFiles.get(), prd.generatedArtifacts());
|
||||||
node->addNode(std::move(genFiles));
|
node->addNode(std::move(genFiles));
|
||||||
|
@@ -148,7 +148,8 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!newFilePaths.isEmpty()) {
|
if (!newFilePaths.isEmpty()) {
|
||||||
auto vfolder = std::make_unique<VirtualFolderNode>(pri->filePath().parentDir(), Node::DefaultVirtualFolderPriority - i);
|
auto vfolder = std::make_unique<VirtualFolderNode>(pri->filePath().parentDir());
|
||||||
|
vfolder->setPriority(Node::DefaultVirtualFolderPriority - i);
|
||||||
vfolder->setIcon(fileTypes.at(i).icon);
|
vfolder->setIcon(fileTypes.at(i).icon);
|
||||||
vfolder->setDisplayName(fileTypes.at(i).typeName);
|
vfolder->setDisplayName(fileTypes.at(i).typeName);
|
||||||
vfolder->setAddFileFilter(fileTypes.at(i).addFileFilter);
|
vfolder->setAddFileFilter(fileTypes.at(i).addFileFilter);
|
||||||
|
Reference in New Issue
Block a user