forked from qt-creator/qt-creator
QmlDesigner: Allow uppercase file suffixes in asset import
Fixes: QDS-3720 Change-Id: I2b4af981bed943e53847bb3480ced185e157b5e7 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -120,7 +120,7 @@ public:
|
||||
QIcon icon( const QFileInfo & info ) const override
|
||||
{
|
||||
QIcon icon;
|
||||
const QString suffix = info.suffix();
|
||||
const QString suffix = info.suffix().toLower();
|
||||
const QString filePath = info.absoluteFilePath();
|
||||
|
||||
// Provide icon depending on suffix
|
||||
@@ -288,7 +288,7 @@ void CustomFileSystemModel::setSearchFilter(const QString &nameFilterList)
|
||||
QPair<QString, QByteArray> CustomFileSystemModel::resourceTypeAndData(const QModelIndex &index) const
|
||||
{
|
||||
QFileInfo fi = fileInfo(index);
|
||||
QString suffix = fi.suffix();
|
||||
QString suffix = fi.suffix().toLower();
|
||||
if (!suffix.isEmpty()) {
|
||||
if (supportedImageSuffixes().contains(suffix)) {
|
||||
// Data: Image format (suffix)
|
||||
@@ -365,16 +365,17 @@ QModelIndex CustomFileSystemModel::updatePath(const QString &newPath)
|
||||
nameFilterList.append(QString(QStringLiteral("*%1*")).arg(searchFilter));
|
||||
} else {
|
||||
const QString filterTemplate("*%1*.%2");
|
||||
for (const QString &ext : supportedImageSuffixes())
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext));
|
||||
for (const QString &ext : supportedShaderSuffixes())
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext));
|
||||
for (const QString &ext : supportedFontSuffixes())
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext));
|
||||
for (const QString &ext : supportedAudioSuffixes())
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext));
|
||||
for (const QString &ext : supportedTexture3DSuffixes())
|
||||
auto appendFilters = [&](const QStringList &suffixes) {
|
||||
for (const QString &ext : suffixes) {
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext));
|
||||
nameFilterList.append(filterTemplate.arg(searchFilter, ext.toUpper()));
|
||||
}
|
||||
};
|
||||
appendFilters(supportedImageSuffixes());
|
||||
appendFilters(supportedShaderSuffixes());
|
||||
appendFilters(supportedFontSuffixes());
|
||||
appendFilters(supportedAudioSuffixes());
|
||||
appendFilters(supportedTexture3DSuffixes());
|
||||
}
|
||||
|
||||
m_files.clear();
|
||||
|
@@ -88,7 +88,7 @@ ItemLibraryAssetImportDialog::ItemLibraryAssetImportDialog(const QStringList &im
|
||||
// Skip unsupported assets
|
||||
QHash<QString, bool> supportMap;
|
||||
for (const auto &file : importFiles) {
|
||||
QString suffix = QFileInfo(file).suffix();
|
||||
QString suffix = QFileInfo(file).suffix().toLower();
|
||||
if (!supportMap.contains(suffix)) {
|
||||
bool supported = false;
|
||||
for (const auto &exts : supportedExts) {
|
||||
|
@@ -210,7 +210,7 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache,
|
||||
const QList<QUrl> urls = event->mimeData()->urls();
|
||||
for (const QUrl &url : urls) {
|
||||
QFileInfo fi(url.toLocalFile());
|
||||
if (suffixes.contains(fi.suffix())) {
|
||||
if (suffixes.contains(fi.suffix().toLower())) {
|
||||
accept = true;
|
||||
break;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void ItemLibraryWidget::importDroppedFiles(const QList<Utils::DropSupport::FileS
|
||||
QStringList fileNames;
|
||||
for (const auto &file : files) {
|
||||
QFileInfo fi(file.filePath);
|
||||
if (m_resourcesFileSystemModel->supportedSuffixes().contains(fi.suffix()))
|
||||
if (m_resourcesFileSystemModel->supportedSuffixes().contains(fi.suffix().toLower()))
|
||||
fileNames.append(fi.absoluteFilePath());
|
||||
}
|
||||
if (!fileNames.isEmpty())
|
||||
|
Reference in New Issue
Block a user