summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-09-29 15:07:24 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-09-29 15:07:24 +0200
commit15ab8d5c5e9b5a06ad61247aa81f4673a42595e6 (patch)
tree756b59e6d6075ad7c3153455d87c024068d0fbe8
parent192f14b001201d2d76fbbd12465dbe01623cf3fb (diff)
Changed "ignore missing game data" to not create an empty Texture folder and instead save the choice in meta.ini
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/modinfo.h5
-rw-r--r--src/modinforegular.cpp16
-rw-r--r--src/modinforegular.h7
-rw-r--r--src/modlist.cpp4
5 files changed, 32 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 04491c3e..9d0c37c0 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2684,16 +2684,18 @@ void MainWindow::ignoreMissingData_clicked()
for (QModelIndex idx : selection->selectedRows()) {
int row_idx = idx.data(Qt::UserRole + 1).toInt();
ModInfo::Ptr info = ModInfo::getByIndex(row_idx);
- QDir(info->absolutePath()).mkdir("textures");
+ //QDir(info->absolutePath()).mkdir("textures");
info->testValid();
+ info->markValidated(true);
connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
emit modListDataChanged(m_OrganizerCore.modList()->index(row_idx, 0), m_OrganizerCore.modList()->index(row_idx, m_OrganizerCore.modList()->columnCount() - 1));
}
} else {
ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow);
- QDir(info->absolutePath()).mkdir("textures");
+ //QDir(info->absolutePath()).mkdir("textures");
info->testValid();
+ info->markValidated(true);
connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
emit modListDataChanged(m_OrganizerCore.modList()->index(m_ContextRow, 0), m_OrganizerCore.modList()->index(m_ContextRow, m_OrganizerCore.modList()->columnCount() - 1));
diff --git a/src/modinfo.h b/src/modinfo.h
index 919d1a5b..895105df 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -578,6 +578,11 @@ public:
virtual void markConverted(bool converted) {}
/**
+ * @brief updates the mod to flag it as valid in order to ignore the invalid game data flag
+ */
+ virtual void markValidated(bool validated) {}
+
+ /**
* @brief reads meta information from disk
*/
virtual void readMeta() {}
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp
index 1e77e050..1d84e2c8 100644
--- a/src/modinforegular.cpp
+++ b/src/modinforegular.cpp
@@ -31,6 +31,7 @@ ModInfoRegular::ModInfoRegular(PluginContainer *pluginContainer, const IPluginGa
, m_GameName(game->gameShortName())
, m_IsAlternate(false)
, m_Converted(false)
+ , m_Validated(false)
, m_MetaInfoChanged(false)
, m_EndorsedState(ENDORSED_UNKNOWN)
, m_NexusBridge(pluginContainer)
@@ -86,6 +87,7 @@ void ModInfoRegular::readMeta()
m_NexusDescription = metaFile.value("nexusDescription", "").toString();
m_Repository = metaFile.value("repository", "Nexus").toString();
m_Converted = metaFile.value("converted", false).toBool();
+ m_Validated = metaFile.value("validated", false).toBool();
m_URL = metaFile.value("url", "").toString();
m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate);
if (metaFile.contains("endorsed")) {
@@ -150,6 +152,7 @@ void ModInfoRegular::saveMeta()
metaFile.setValue("url", m_URL);
metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate));
metaFile.setValue("converted", m_Converted);
+ metaFile.setValue("validated", m_Validated);
if (m_EndorsedState != ENDORSED_UNKNOWN) {
metaFile.setValue("endorsed", m_EndorsedState);
}
@@ -415,6 +418,13 @@ void ModInfoRegular::markConverted(bool converted)
emit modDetailsUpdated(true);
}
+void ModInfoRegular::markValidated(bool validated)
+{
+ m_Validated = validated;
+ m_MetaInfoChanged = true;
+ saveMeta();
+ emit modDetailsUpdated(true);
+}
QString ModInfoRegular::absolutePath() const
{
@@ -438,7 +448,7 @@ std::vector<ModInfo::EFlag> ModInfoRegular::getFlags() const
if ((m_NexusID > 0) && (endorsedState() == ENDORSED_FALSE)) {
result.push_back(ModInfo::FLAG_NOTENDORSED);
}
- if (!isValid()) {
+ if (!isValid() && !m_Validated) {
result.push_back(ModInfo::FLAG_INVALID);
}
if (m_Notes.length() != 0) {
@@ -514,7 +524,7 @@ std::vector<ModInfo::EContent> ModInfoRegular::getContents() const
int ModInfoRegular::getHighlight() const
{
- if (!isValid())
+ if (!isValid() && !m_Validated)
return HIGHLIGHT_INVALID;
auto flags = getFlags();
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_PLUGIN_SELECTED) != flags.end())
@@ -525,7 +535,7 @@ int ModInfoRegular::getHighlight() const
QString ModInfoRegular::getDescription() const
{
- if (!isValid()) {
+ if (!isValid() && !m_Validated) {
return tr("%1 contains no esp/esm/esl and no asset (textures, meshes, interface, ...) directory").arg(name());
} else {
const std::set<int> &categories = getCategories();
diff --git a/src/modinforegular.h b/src/modinforegular.h
index 3abaded4..2f3eb941 100644
--- a/src/modinforegular.h
+++ b/src/modinforegular.h
@@ -28,6 +28,7 @@ public:
bool isAlternate() { return m_IsAlternate; }
bool isConverted() { return m_Converted; }
+ bool isValidated() { return m_Validated; }
/**
* @brief test if there is a newer version of the mod
@@ -189,6 +190,11 @@ public:
virtual void markConverted(bool converted) override;
/**
+ * @brief updates the mod to flag it as valid in order to ignore the invalid game data flag
+ */
+ virtual void markValidated(bool validated) override;
+
+ /**
* @brief getter for the mod name
*
* @return the mod name
@@ -358,6 +364,7 @@ private:
bool m_MetaInfoChanged;
bool m_IsAlternate;
bool m_Converted;
+ bool m_Validated;
MOBase::VersionInfo m_NewestVersion;
MOBase::VersionInfo m_IgnoredVersion;
diff --git a/src/modlist.cpp b/src/modlist.cpp
index bcd087bc..c7f6a53b 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -768,6 +768,8 @@ IModList::ModStates ModList::state(unsigned int modIndex) const
QSharedPointer<ModInfoRegular> modInfoRegular = modInfo.staticCast<ModInfoRegular>();
if (modInfoRegular->isAlternate() && !modInfoRegular->isConverted())
result |= IModList::STATE_ALTERNATE;
+ if (!modInfo->isValid() && modInfoRegular->isValidated())
+ result |= IModList::STATE_VALID;
}
if (modInfo->canBeEnabled()) {
if (m_Profile->modEnabled(modIndex)) {
@@ -1263,4 +1265,4 @@ void ModList::disableSelected(const QItemSelectionModel *selectionModel)
}
}
}
-} \ No newline at end of file
+}