forked from mirror/openmw-tes3mp
Further implemented auto-checking / unchecking of dependencies
This commit is contained in:
parent
d7cff6361e
commit
9d358dd44c
1 changed files with 36 additions and 2 deletions
|
@ -458,17 +458,51 @@ bool ContentSelectorModel::ContentModel::isChecked(const QString& name) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void ContentSelectorModel::ContentModel::setCheckState(const QString &name, bool isChecked)
|
||||
void ContentSelectorModel::ContentModel::setCheckState(const QString &name, bool checkState)
|
||||
{
|
||||
if (name.isEmpty())
|
||||
return;
|
||||
|
||||
Qt::CheckState state = Qt::Unchecked;
|
||||
|
||||
if (isChecked)
|
||||
if (checkState)
|
||||
state = Qt::Checked;
|
||||
|
||||
mCheckStates[name] = state;
|
||||
|
||||
const EsmFile *file = item(name);
|
||||
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
foreach (const QString &upstreamName, file->gameFiles())
|
||||
{
|
||||
const EsmFile *upstreamFile = item(upstreamName);
|
||||
|
||||
if (!upstreamFile)
|
||||
continue;
|
||||
|
||||
if (!isChecked(upstreamName))
|
||||
{
|
||||
mCheckStates[upstreamName] = Qt::Checked;
|
||||
emit dataChanged(indexFromItem(upstreamFile), indexFromItem(upstreamFile));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (state == Qt::Unchecked)
|
||||
{
|
||||
foreach (const EsmFile *downstreamFile, mFiles)
|
||||
{
|
||||
if (downstreamFile->gameFiles().contains(name))
|
||||
{
|
||||
if (mCheckStates.contains(downstreamFile->fileName()))
|
||||
{
|
||||
mCheckStates[downstreamFile->fileName()] = Qt::Unchecked;
|
||||
emit dataChanged(indexFromItem(downstreamFile), indexFromItem(downstreamFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ContentSelectorModel::ContentFileList ContentSelectorModel::ContentModel::checkedItems() const
|
||||
|
|
Loading…
Reference in a new issue