1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Avoid double lookup

This commit is contained in:
elsid 2023-03-20 00:21:41 +01:00
parent 2a50212f87
commit 8dd6b16fee
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -580,10 +580,10 @@ void ContentSelectorModel::ContentModel::sortFiles()
bool ContentSelectorModel::ContentModel::isChecked(const QString& filepath) const
{
if (mCheckStates.contains(filepath))
return (mCheckStates[filepath] == Qt::Checked);
return false;
const auto it = mCheckStates.find(filepath);
if (it == mCheckStates.end())
return false;
return it.value() == Qt::Checked;
}
bool ContentSelectorModel::ContentModel::isEnabled(const QModelIndex& index) const
@ -593,10 +593,10 @@ bool ContentSelectorModel::ContentModel::isEnabled(const QModelIndex& index) con
bool ContentSelectorModel::ContentModel::isNew(const QString& filepath) const
{
if (mNewFiles.contains(filepath))
return mNewFiles[filepath];
return false;
const auto it = mNewFiles.find(filepath);
if (it == mNewFiles.end())
return false;
return it.value();
}
void ContentSelectorModel::ContentModel::setNew(const QString& filepath, bool isNew)