Skip to content

Commit 1fff2f0

Browse files
committed
Merge branch 'setnew' into 'master'
Don't use item(QString) while marking new content files See merge request OpenMW/openmw!4701
2 parents ecc9e8f + 3dfc3d7 commit 1fff2f0

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

components/contentselector/model/contentmodel.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
424424
file->setFilePath(info.absoluteFilePath());
425425
if (add)
426426
addFile(newFile.release());
427-
setNew(file->fileName(), newfiles);
427+
setNew(file, newfiles);
428428
continue;
429429
}
430430

@@ -480,7 +480,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
480480
// Put the file in the table
481481
if (add)
482482
addFile(newFile.release());
483-
setNew(file->fileName(), newfiles);
483+
setNew(file, newfiles);
484484
}
485485
catch (std::runtime_error& e)
486486
{
@@ -619,17 +619,12 @@ bool ContentSelectorModel::ContentModel::isNew(const QString& filepath) const
619619
return it.value();
620620
}
621621

622-
void ContentSelectorModel::ContentModel::setNew(const QString& filepath, bool isNew)
622+
void ContentSelectorModel::ContentModel::setNew(const EsmFile* file, bool isNew)
623623
{
624-
if (filepath.isEmpty())
625-
return;
626-
627-
const EsmFile* file = item(filepath);
628-
629624
if (!file)
630625
return;
631626

632-
mNewFiles[filepath] = isNew;
627+
mNewFiles[file->fileName()] = isNew;
633628
}
634629

635630
void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fileList)

components/contentselector/model/contentmodel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace ContentSelectorModel
6161
bool isEnabled(const QModelIndex& index) const;
6262
bool setCheckState(const EsmFile* file, bool isChecked);
6363
bool isNew(const QString& filepath) const;
64-
void setNew(const QString& filepath, bool isChecked);
64+
void setNew(const EsmFile* file, bool isChecked);
6565
void setNonUserContent(const QStringList& fileList);
6666
void setContentList(const QStringList& fileList);
6767
ContentFileList checkedItems() const;

0 commit comments

Comments
 (0)