mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 14:12:30 -06:00
Sort languages combobox by language code
* Avoid creating redundant file lists * Sort languages combobox by language code PR #20365.
This commit is contained in:
@@ -105,7 +105,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
|
||||
}
|
||||
|
||||
const QRegularExpression filenamePattern {u"^([A-Fa-f0-9]{40})\\.fastresume$"_s};
|
||||
const QStringList filenames = QDir(path.data()).entryList(QStringList(u"*.fastresume"_s), QDir::Files, QDir::Unsorted);
|
||||
const QStringList filenames = QDir(path.data()).entryList({u"*.fastresume"_s}, QDir::Files);
|
||||
|
||||
m_registeredTorrents.reserve(filenames.size());
|
||||
for (const QString &filename : filenames)
|
||||
|
||||
@@ -124,8 +124,8 @@ void TorrentCreator::run()
|
||||
QDirIterator dirIter {m_params.inputPath.data(), (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories};
|
||||
while (dirIter.hasNext())
|
||||
{
|
||||
dirIter.next();
|
||||
dirs.append(dirIter.filePath());
|
||||
const QString filePath = dirIter.next();
|
||||
dirs.append(filePath);
|
||||
}
|
||||
std::sort(dirs.begin(), dirs.end(), naturalLessThan);
|
||||
|
||||
@@ -139,11 +139,11 @@ void TorrentCreator::run()
|
||||
QDirIterator fileIter {dir, QDir::Files};
|
||||
while (fileIter.hasNext())
|
||||
{
|
||||
fileIter.next();
|
||||
const QFileInfo fileInfo = fileIter.nextFileInfo();
|
||||
|
||||
const auto relFilePath = parentPath.relativePathOf(Path(fileIter.filePath()));
|
||||
const Path relFilePath = parentPath.relativePathOf(Path(fileInfo.filePath()));
|
||||
tmpNames.append(relFilePath.toString());
|
||||
fileSizeMap[tmpNames.last()] = fileIter.fileInfo().size();
|
||||
fileSizeMap[tmpNames.last()] = fileInfo.size();
|
||||
}
|
||||
|
||||
std::sort(tmpNames.begin(), tmpNames.end(), naturalLessThan);
|
||||
|
||||
Reference in New Issue
Block a user