|
|
@ -106,7 +106,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex& index
|
|
|
|
return Qt::NoItemFlags;
|
|
|
|
return Qt::NoItemFlags;
|
|
|
|
|
|
|
|
|
|
|
|
// game files can always be checked
|
|
|
|
// game files can always be checked
|
|
|
|
if (file->isGameFile())
|
|
|
|
if (file == mGameFile)
|
|
|
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
|
|
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
|
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags returnFlags;
|
|
|
|
Qt::ItemFlags returnFlags;
|
|
|
@ -216,7 +216,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex& index, int
|
|
|
|
|
|
|
|
|
|
|
|
case Qt::CheckStateRole:
|
|
|
|
case Qt::CheckStateRole:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (file->isGameFile())
|
|
|
|
if (file == mGameFile)
|
|
|
|
return QVariant();
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
|
|
return mCheckStates[file->filePath()];
|
|
|
|
return mCheckStates[file->filePath()];
|
|
|
@ -224,7 +224,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex& index, int
|
|
|
|
|
|
|
|
|
|
|
|
case Qt::UserRole:
|
|
|
|
case Qt::UserRole:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (file->isGameFile())
|
|
|
|
if (file == mGameFile)
|
|
|
|
return ContentType_GameFile;
|
|
|
|
return ContentType_GameFile;
|
|
|
|
else if (flags(index))
|
|
|
|
else if (flags(index))
|
|
|
|
return ContentType_Addon;
|
|
|
|
return ContentType_Addon;
|
|
|
@ -577,6 +577,15 @@ QStringList ContentSelectorModel::ContentModel::gameFiles() const
|
|
|
|
return gameFiles;
|
|
|
|
return gameFiles;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ContentSelectorModel::ContentModel::setCurrentGameFile(const EsmFile* file)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QModelIndex oldIndex = indexFromItem(mGameFile);
|
|
|
|
|
|
|
|
QModelIndex index = indexFromItem(file);
|
|
|
|
|
|
|
|
mGameFile = file;
|
|
|
|
|
|
|
|
emit dataChanged(oldIndex, oldIndex);
|
|
|
|
|
|
|
|
emit dataChanged(index, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ContentSelectorModel::ContentModel::sortFiles()
|
|
|
|
void ContentSelectorModel::ContentModel::sortFiles()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
emit layoutAboutToBeChanged();
|
|
|
|
emit layoutAboutToBeChanged();
|
|
|
@ -591,10 +600,9 @@ void ContentSelectorModel::ContentModel::sortFiles()
|
|
|
|
for (int j = 0; j < i; ++j)
|
|
|
|
for (int j = 0; j < i; ++j)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const QStringList& gameFiles = mFiles.at(j)->gameFiles();
|
|
|
|
const QStringList& gameFiles = mFiles.at(j)->gameFiles();
|
|
|
|
if (gameFiles.contains(file->fileName(), Qt::CaseInsensitive)
|
|
|
|
// All addon files are implicitly dependent on the game file
|
|
|
|
|| (!mFiles.at(j)->isGameFile() && gameFiles.isEmpty()
|
|
|
|
// so that they don't accidentally become the game file
|
|
|
|
&& file->fileName().compare("Morrowind.esm", Qt::CaseInsensitive)
|
|
|
|
if (gameFiles.contains(file->fileName(), Qt::CaseInsensitive) || file == mGameFile)
|
|
|
|
== 0)) // Hack: implicit dependency on Morrowind.esm for dependency-less files
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
index = j;
|
|
|
|
index = j;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|