mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Replace QString::split() by faster alternatives
This commit is contained in:
parent
1eeac90a29
commit
b5b678c58f
12 changed files with 73 additions and 53 deletions
|
@ -469,14 +469,18 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
|
|||
// Iterate over files
|
||||
for (int i = 0; i < filesCount; ++i) {
|
||||
currentParent = m_rootItem;
|
||||
QString path = Utils::Fs::toUniformPath(info.filePath(i));
|
||||
const QString path = Utils::Fs::toUniformPath(info.filePath(i));
|
||||
|
||||
// Iterate of parts of the path to create necessary folders
|
||||
QStringList pathFolders = path.split('/', QString::SkipEmptyParts);
|
||||
QVector<QStringRef> pathFolders = path.splitRef('/', QString::SkipEmptyParts);
|
||||
pathFolders.removeLast();
|
||||
for (const QString &pathPart : asConst(pathFolders)) {
|
||||
if (pathPart == ".unwanted")
|
||||
|
||||
for (const QStringRef &pathPartRef : asConst(pathFolders)) {
|
||||
if (pathPartRef == QLatin1String(".unwanted"))
|
||||
continue;
|
||||
TorrentContentModelFolder* newParent = currentParent->childFolderWithName(pathPart);
|
||||
|
||||
const QString pathPart = pathPartRef.toString();
|
||||
TorrentContentModelFolder *newParent = currentParent->childFolderWithName(pathPart);
|
||||
if (!newParent) {
|
||||
newParent = new TorrentContentModelFolder(pathPart, currentParent);
|
||||
currentParent->appendChild(newParent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue