forked from qt-creator/qt-creator
Android: Don't remove icons or splashes if files with similar names exist
Task-number: QTCREATORBUG-24879 Change-Id: Ie13a8a94534889c473414b5a5e771aae11d0f167 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -255,6 +255,17 @@ static QImage scaleWithoutStretching(const QImage& original, const QSize& target
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool similarFilesExist(const QString &path)
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(path);
|
||||||
|
QDir imageDir(fileInfo.absolutePath());
|
||||||
|
QString baseName(fileInfo.completeBaseName());
|
||||||
|
baseName.append(QLatin1String(".*"));
|
||||||
|
imageDir.setNameFilters({baseName});
|
||||||
|
auto entries = imageDir.entryList();
|
||||||
|
return !entries.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void AndroidManifestEditorIconWidget::copyIcon()
|
void AndroidManifestEditorIconWidget::copyIcon()
|
||||||
{
|
{
|
||||||
if (m_targetIconPath.isEmpty())
|
if (m_targetIconPath.isEmpty())
|
||||||
@@ -269,7 +280,8 @@ void AndroidManifestEditorIconWidget::copyIcon()
|
|||||||
if (m_iconPath != targetPath)
|
if (m_iconPath != targetPath)
|
||||||
removeIcon();
|
removeIcon();
|
||||||
if (original.isNull()) {
|
if (original.isNull()) {
|
||||||
m_iconPath.clear();
|
if (!similarFilesExist(m_iconPath))
|
||||||
|
m_iconPath.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_iconPath == targetPath)
|
if (m_iconPath == targetPath)
|
||||||
|
Reference in New Issue
Block a user