forked from qt-creator/qt-creator
QmlProject files: Make "paths" property an array
Instead of letting the list of files being a (comma separated) string it's now a full JavaScript array. E.g. paths: ["file1", "file2"] This unifies it with e.g. the libraryPaths property
This commit is contained in:
@@ -69,18 +69,14 @@ void FileFilterBaseItem::setRecursive(bool recursive)
|
|||||||
updateFileList();
|
updateFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileFilterBaseItem::pathsProperty() const
|
QStringList FileFilterBaseItem::pathsProperty() const
|
||||||
{
|
{
|
||||||
return QStringList(m_explicitFiles.toList()).join(",");
|
return m_explicitFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterBaseItem::setPathsProperty(const QString &path)
|
void FileFilterBaseItem::setPathsProperty(const QStringList &path)
|
||||||
{
|
{
|
||||||
// we support listening paths both in an array, and in one string
|
m_explicitFiles = path;
|
||||||
m_explicitFiles.clear();
|
|
||||||
foreach (const QString &subpath, path.split(QLatin1Char(','), QString::SkipEmptyParts)) {
|
|
||||||
m_explicitFiles += subpath.trimmed();
|
|
||||||
}
|
|
||||||
updateFileList();
|
updateFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class FileFilterBaseItem : public QmlProjectContentItem {
|
|||||||
|
|
||||||
Q_PROPERTY(QString directory READ directory WRITE setDirectory NOTIFY directoryChanged)
|
Q_PROPERTY(QString directory READ directory WRITE setDirectory NOTIFY directoryChanged)
|
||||||
Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
|
Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
|
||||||
Q_PROPERTY(QString paths READ pathsProperty WRITE setPathsProperty NOTIFY pathsPropertyChanged)
|
Q_PROPERTY(QStringList paths READ pathsProperty WRITE setPathsProperty NOTIFY pathsPropertyChanged)
|
||||||
|
|
||||||
Q_PROPERTY(QStringList files READ files NOTIFY filesChanged DESIGNABLE false)
|
Q_PROPERTY(QStringList files READ files NOTIFY filesChanged DESIGNABLE false)
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ public:
|
|||||||
bool recursive() const;
|
bool recursive() const;
|
||||||
void setRecursive(bool recursive);
|
void setRecursive(bool recursive);
|
||||||
|
|
||||||
QString pathsProperty() const;
|
QStringList pathsProperty() const;
|
||||||
void setPathsProperty(const QString &path);
|
void setPathsProperty(const QStringList &paths);
|
||||||
|
|
||||||
virtual QStringList files() const;
|
virtual QStringList files() const;
|
||||||
bool matchesFile(const QString &filePath) const;
|
bool matchesFile(const QString &filePath) const;
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void directoryChanged();
|
void directoryChanged();
|
||||||
void recursiveChanged();
|
void recursiveChanged();
|
||||||
void pathsPropertyChanged();
|
void pathsChanged();
|
||||||
void filesChanged();
|
void filesChanged();
|
||||||
void filterChanged();
|
void filterChanged();
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
QString m_filter;
|
QString m_filter;
|
||||||
QList<QRegExp> m_regExpList;
|
QList<QRegExp> m_regExpList;
|
||||||
bool m_recursive;
|
bool m_recursive;
|
||||||
QSet<QString> m_explicitFiles;
|
QStringList m_explicitFiles;
|
||||||
|
|
||||||
QFileSystemWatcher m_fsWatcher;
|
QFileSystemWatcher m_fsWatcher;
|
||||||
|
|
||||||
|
|||||||
@@ -153,8 +153,8 @@ void TestProject::testFileFilter()
|
|||||||
"import QmlProject 1.0\n"
|
"import QmlProject 1.0\n"
|
||||||
"Project {\n"
|
"Project {\n"
|
||||||
" QmlFiles {\n"
|
" QmlFiles {\n"
|
||||||
" paths: \"file1.qml,\n"
|
" paths: [ \"file1.qml\",\n"
|
||||||
"file2.qml\"\n"
|
"\"file2.qml\" ]\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user