Sort languages combobox by language code

* Avoid creating redundant file lists
* Sort languages combobox by language code

PR #20365.
This commit is contained in:
Chocobo1
2024-02-05 13:44:18 +08:00
committed by GitHub
parent 88a4990435
commit f87ea1b5d3
10 changed files with 41 additions and 49 deletions

View File

@@ -74,12 +74,11 @@ namespace
}
// python 2: remove "*.pyc" files
const QStringList files = QDir(dir.data()).entryList(QDir::Files);
for (const QString &file : files)
QDirIterator it {dir.data(), {u"*.pyc"_s}, QDir::Files};
while (it.hasNext())
{
const Path path {file};
if (path.hasExtension(u".pyc"_s))
Utils::Fs::removeFile(path);
const QString filePath = it.next();
Utils::Fs::removeFile(Path(filePath));
}
}
}
@@ -298,11 +297,13 @@ bool SearchPluginManager::uninstallPlugin(const QString &name)
clearPythonCache(engineLocation());
// remove it from hard drive
const Path pluginsPath = pluginsLocation();
const QStringList filters {name + u".*"};
const QStringList files = QDir(pluginsPath.data()).entryList(filters, QDir::Files, QDir::Unsorted);
for (const QString &file : files)
Utils::Fs::removeFile(pluginsPath / Path(file));
QDirIterator iter {pluginsLocation().data(), {name + u".*"}, QDir::Files};
while (iter.hasNext())
{
const QString filePath = iter.next();
Utils::Fs::removeFile(Path(filePath));
}
// Remove it from supported engines
delete m_plugins.take(name);