forked from qt-creator/qt-creator
ProjectExplorer: De-virtualize FolderNode::addFileFilter
... which interestingly enough is only used with Add Existing Directory, not with Add Existing Files. Change-Id: If76ba5f192dc49f3cb56e3d0c9ab249e47aa1c28 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -693,6 +693,9 @@ const QList<FolderNode::LocationInfo> FolderNode::locationInfo() const
|
||||
|
||||
QString FolderNode::addFileFilter() const
|
||||
{
|
||||
if (!m_addFileFilter.isNull())
|
||||
return m_addFileFilter;
|
||||
|
||||
FolderNode *fn = parentFolderNode();
|
||||
return fn ? fn->addFileFilter() : QString();
|
||||
}
|
||||
@@ -798,13 +801,6 @@ VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath) :
|
||||
{
|
||||
}
|
||||
|
||||
QString VirtualFolderNode::addFileFilter() const
|
||||
{
|
||||
if (!m_addFileFilter.isNull())
|
||||
return m_addFileFilter;
|
||||
return FolderNode::addFileFilter();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::ProjectNode
|
||||
|
||||
|
@@ -268,7 +268,8 @@ public:
|
||||
void setLocationInfo(const QList<LocationInfo> &info);
|
||||
const QList<LocationInfo> locationInfo() const;
|
||||
|
||||
virtual QString addFileFilter() const;
|
||||
QString addFileFilter() const;
|
||||
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
||||
|
||||
bool supportsAction(ProjectAction action, const Node *node) const override;
|
||||
|
||||
@@ -312,6 +313,7 @@ protected:
|
||||
|
||||
private:
|
||||
QString m_displayName;
|
||||
QString m_addFileFilter;
|
||||
mutable QIcon m_icon;
|
||||
};
|
||||
|
||||
@@ -322,12 +324,6 @@ public:
|
||||
|
||||
bool isFolderNodeType() const override { return false; }
|
||||
bool isVirtualFolderType() const override { return true; }
|
||||
|
||||
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
||||
QString addFileFilter() const override;
|
||||
|
||||
private:
|
||||
QString m_addFileFilter;
|
||||
};
|
||||
|
||||
// Documentation inside.
|
||||
|
@@ -116,7 +116,6 @@ public:
|
||||
PythonProjectNode(PythonProject *project);
|
||||
|
||||
bool showInSimpleTree() const override;
|
||||
QString addFileFilter() const override;
|
||||
bool supportsAction(ProjectAction action, const Node *node) const override;
|
||||
bool addFiles(const QStringList &filePaths, QStringList *) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *) override;
|
||||
@@ -585,6 +584,7 @@ PythonProjectNode::PythonProjectNode(PythonProject *project)
|
||||
, m_project(project)
|
||||
{
|
||||
setDisplayName(project->projectFilePath().toFileInfo().completeBaseName());
|
||||
setAddFileFilter("*.py");
|
||||
}
|
||||
|
||||
QHash<QString, QStringList> sortFilesIntoPaths(const QString &base, const QSet<QString> &files)
|
||||
@@ -616,11 +616,6 @@ bool PythonProjectNode::showInSimpleTree() const
|
||||
return true;
|
||||
}
|
||||
|
||||
QString PythonProjectNode::addFileFilter() const
|
||||
{
|
||||
return QLatin1String("*.py");
|
||||
}
|
||||
|
||||
bool PythonProjectNode::supportsAction(ProjectAction action, const Node *node) const
|
||||
{
|
||||
if (node->isFileNodeType()) {
|
||||
|
@@ -271,6 +271,8 @@ ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath,
|
||||
setIcon(FileIconProvider::icon(filePath.toString()));
|
||||
setPriority(Node::DefaultFilePriority);
|
||||
setListInProject(true);
|
||||
setAddFileFilter("*.png; *.jpg; *.gif; *.svg; *.ico; *.qml; *.qml.ui");
|
||||
|
||||
if (!filePath.isEmpty()) {
|
||||
QFileInfo fi = filePath.toFileInfo();
|
||||
if (fi.isFile() && fi.isReadable()) {
|
||||
@@ -384,11 +386,6 @@ void ResourceTopLevelNode::addInternalNodes()
|
||||
}
|
||||
}
|
||||
|
||||
QString ResourceTopLevelNode::addFileFilter() const
|
||||
{
|
||||
return QLatin1String("*.png; *.jpg; *.gif; *.svg; *.ico; *.qml; *.qml.ui");
|
||||
}
|
||||
|
||||
bool ResourceTopLevelNode::supportsAction(ProjectAction action, const Node *node) const
|
||||
{
|
||||
if (node != this)
|
||||
|
@@ -40,8 +40,6 @@ public:
|
||||
|
||||
void addInternalNodes();
|
||||
|
||||
QString addFileFilter() const override;
|
||||
|
||||
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved) override;
|
||||
|
Reference in New Issue
Block a user