mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Optimise ContentSelectorModel::ContentModel::item
This saves about 5% of remaining launcher startup time Not using fileProperty avoids loads of QVariant conversions.
This commit is contained in:
parent
7bad2864d9
commit
973282e471
1 changed files with 2 additions and 6 deletions
|
@ -78,14 +78,10 @@ ContentSelectorModel::EsmFile* ContentSelectorModel::ContentModel::item(int row)
|
|||
}
|
||||
const ContentSelectorModel::EsmFile* ContentSelectorModel::ContentModel::item(const QString& name) const
|
||||
{
|
||||
EsmFile::FileProperty fp = EsmFile::FileProperty_FileName;
|
||||
|
||||
if (name.contains('/'))
|
||||
fp = EsmFile::FileProperty_FilePath;
|
||||
|
||||
bool path = name.contains('/');
|
||||
for (const EsmFile* file : mFiles)
|
||||
{
|
||||
if (name.compare(file->fileProperty(fp).toString(), Qt::CaseInsensitive) == 0)
|
||||
if (name.compare(path ? file->filePath() : file->fileName(), Qt::CaseInsensitive) == 0)
|
||||
return file;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue