From 54e3ebde63e22f1920c5a70acf7fc18299ffb229 Mon Sep 17 00:00:00 2001 From: dteviot Date: Sat, 28 Feb 2015 17:13:21 +1300 Subject: [PATCH] addon list in launcher shows addon files with no dependencies (Fixes #2348) Also, game files must end with ".esm" or ".omwgame". --- components/contentselector/model/contentmodel.cpp | 3 ++- components/contentselector/model/esmfile.cpp | 6 ++++++ components/contentselector/model/esmfile.hpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index cd0c67ee7..7850b2cd6 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -115,9 +115,10 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index return Qt::NoItemFlags; Qt::ItemFlags returnFlags; - bool gamefileChecked = false; // addon can be checked if its gamefile is + // ... special case, addon with no dependency can be used with any gamefile. + bool gamefileChecked = (file->gameFiles().count() == 0); foreach (const QString &fileName, file->gameFiles()) { bool depFound = false; diff --git a/components/contentselector/model/esmfile.cpp b/components/contentselector/model/esmfile.cpp index a0a09105a..9f85e5f43 100644 --- a/components/contentselector/model/esmfile.cpp +++ b/components/contentselector/model/esmfile.cpp @@ -62,6 +62,12 @@ QByteArray ContentSelectorModel::EsmFile::encodedData() const return encodedData; } +bool ContentSelectorModel::EsmFile::isGameFile() const +{ + return (mGameFiles.size() == 0) && + (mFileName.endsWith(QLatin1String(".esm")) || mFileName.endsWith(QLatin1String(".omwgame"))); +} + QVariant ContentSelectorModel::EsmFile::fileProperty(const FileProperty prop) const { switch (prop) diff --git a/components/contentselector/model/esmfile.hpp b/components/contentselector/model/esmfile.hpp index 7e1edcaba..d0cebab3c 100644 --- a/components/contentselector/model/esmfile.hpp +++ b/components/contentselector/model/esmfile.hpp @@ -64,7 +64,7 @@ namespace ContentSelectorModel .arg(mGameFiles.join(", ")); } - inline bool isGameFile() const { return (mGameFiles.size() == 0); } + bool isGameFile() const; QByteArray encodedData() const; public: