1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-08 17:16:42 +00:00

Don't use item(QString) while marking new content files

This commit is contained in:
Alexei Kotov 2025-06-01 03:21:19 +03:00
parent 0c6c71f6cb
commit 3dfc3d7022
2 changed files with 5 additions and 10 deletions

View file

@ -469,7 +469,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
file->setFilePath(info.absoluteFilePath()); file->setFilePath(info.absoluteFilePath());
if (add) if (add)
addFile(newFile.release()); addFile(newFile.release());
setNew(file->fileName(), newfiles); setNew(file, newfiles);
continue; continue;
} }
@ -525,7 +525,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
// Put the file in the table // Put the file in the table
if (add) if (add)
addFile(newFile.release()); addFile(newFile.release());
setNew(file->fileName(), newfiles); setNew(file, newfiles);
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
@ -664,17 +664,12 @@ bool ContentSelectorModel::ContentModel::isNew(const QString& filepath) const
return it.value(); return it.value();
} }
void ContentSelectorModel::ContentModel::setNew(const QString& filepath, bool isNew) void ContentSelectorModel::ContentModel::setNew(const EsmFile* file, bool isNew)
{ {
if (filepath.isEmpty())
return;
const EsmFile* file = item(filepath);
if (!file) if (!file)
return; return;
mNewFiles[filepath] = isNew; mNewFiles[file->fileName()] = isNew;
} }
void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fileList) void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fileList)

View file

@ -61,7 +61,7 @@ namespace ContentSelectorModel
bool isEnabled(const QModelIndex& index) const; bool isEnabled(const QModelIndex& index) const;
bool setCheckState(const EsmFile* file, bool isChecked); bool setCheckState(const EsmFile* file, bool isChecked);
bool isNew(const QString& filepath) const; bool isNew(const QString& filepath) const;
void setNew(const QString& filepath, bool isChecked); void setNew(const EsmFile* file, bool isChecked);
void setNonUserContent(const QStringList& fileList); void setNonUserContent(const QStringList& fileList);
void setContentList(const QStringList& fileList); void setContentList(const QStringList& fileList);
ContentFileList checkedItems() const; ContentFileList checkedItems() const;