Commit ccab280b authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlProject: Support arbitrary file suffixes

Add new "Files {}" element that supports showing files with arbitrary
endings in the project tree.

This new element is only available in new "QmlProject 1.1" namespace.

Task-number: QTCREATORBUG-3197
Reviewed-by: Thomas Hartmann
parent 54fbb521
......@@ -3,6 +3,7 @@
<type name="QmlProject.Project">
<exports>
<export module="QmlProject" version="1.0" type="Project"/>
<export module="QmlProject" version="1.1" type="Project"/>
</exports>
<property name="sourceDirectory" type="string"/>
<property name="importPaths" type="string" isList="true"/>
......@@ -19,24 +20,34 @@
<type name="QmlProject.QmlFiles" extends="FileFilterBaseItem">
<exports>
<export module="QmlProject" version="1.0" type="QmlFiles"/>
<export module="QmlProject" version="1.1" type="QmlFiles"/>
</exports>
</type>
<type name="QmlProject.JavaScriptFiles" extends="FileFilterBaseItem">
<exports>
<export module="QmlProject" version="1.0" type="JavaScriptFiles"/>
<export module="QmlProject" version="1.1" type="JavaScriptFiles"/>
</exports>
<property name="filter" type="string"/>
</type>
<type name="QmlProject.ImageFiles" extends="FileFilterBaseItem">
<exports>
<export module="QmlProject" version="1.0" type="ImageFiles"/>
<export module="QmlProject" version="1.1" type="ImageFiles"/>
</exports>
<property name="filter" type="string"/>
</type>
<type name="QmlProject.CssFiles" extends="FileFilterBaseItem">
<exports>
<export module="QmlProject" version="1.0" type="CssFiles"/>
<export module="QmlProject" version="1.1" type="CssFiles"/>
</exports>
<property name="filter" type="string"/>
</type>
<type name="QmlProject.Files" extends="FileFilterBaseItem">
<exports>
<export module="QmlProject" version="1.1" type="Files"/>
</exports>
<property name="filter" type="string"/>
</type>
</module>
......@@ -296,5 +296,16 @@ void CssFileFilterItem::setFilter(const QString &filter)
emit filterChanged();
}
OtherFileFilterItem::OtherFileFilterItem(QObject *parent)
: FileFilterBaseItem(parent)
{
}
void OtherFileFilterItem::setFilter(const QString &filter)
{
FileFilterBaseItem::setFilter(filter);
emit filterChanged();
}
} // namespace QmlProjectManager
......@@ -131,11 +131,25 @@ public:
CssFileFilterItem(QObject *parent = 0);
};
class OtherFileFilterItem : public FileFilterBaseItem {
Q_OBJECT
Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
void setFilter(const QString &filter);
signals:
void filterChanged();
public:
OtherFileFilterItem(QObject *parent = 0);
};
} // namespace QmlProjectManager
QML_DECLARE_TYPE(QmlProjectManager::QmlFileFilterItem)
QML_DECLARE_TYPE(QmlProjectManager::JsFileFilterItem)
QML_DECLARE_TYPE(QmlProjectManager::ImageFileFilterItem)
QML_DECLARE_TYPE(QmlProjectManager::CssFileFilterItem)
QML_DECLARE_TYPE(QmlProjectManager::OtherFileFilterItem)
#endif // FILEFILTERITEMS_HPROJECTITEM_H
......@@ -10,11 +10,17 @@ void QmlProjectFileFormat::registerDeclarativeTypes()
{
qmlRegisterType<QmlProjectManager::QmlProjectContentItem>();
qmlRegisterType<QmlProjectManager::QmlProjectItem>("QmlProject",1,0,"Project");
qmlRegisterType<QmlProjectManager::QmlProjectItem>("QmlProject",1,1,"Project");
qmlRegisterType<QmlProjectManager::QmlFileFilterItem>("QmlProject",1,0,"QmlFiles");
qmlRegisterType<QmlProjectManager::QmlFileFilterItem>("QmlProject",1,1,"QmlFiles");
qmlRegisterType<QmlProjectManager::JsFileFilterItem>("QmlProject",1,0,"JavaScriptFiles");
qmlRegisterType<QmlProjectManager::JsFileFilterItem>("QmlProject",1,1,"JavaScriptFiles");
qmlRegisterType<QmlProjectManager::ImageFileFilterItem>("QmlProject",1,0,"ImageFiles");
qmlRegisterType<QmlProjectManager::ImageFileFilterItem>("QmlProject",1,1,"ImageFiles");
qmlRegisterType<QmlProjectManager::CssFileFilterItem>("QmlProject",1,0,"CssFiles");
qmlRegisterType<QmlProjectManager::CssFileFilterItem>("QmlProject",1,1,"CssFiles");
qmlRegisterType<QmlProjectManager::OtherFileFilterItem>("QmlProject",1,1,"Files");
}
} // namespace QmlProjectManager
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment