diff options
| -rw-r--r-- | src/mainwindow.cpp | 12 | ||||
| -rw-r--r-- | src/mainwindow.h | 1 | ||||
| -rw-r--r-- | src/modinfo.cpp | 2 | ||||
| -rw-r--r-- | src/modinfo.h | 5 | ||||
| -rw-r--r-- | src/modinforegular.cpp | 22 | ||||
| -rw-r--r-- | src/modinforegular.h | 7 | ||||
| -rw-r--r-- | src/modlist.cpp | 2 |
7 files changed, 44 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a95b7b70..d3ea2b08 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2599,6 +2599,14 @@ void MainWindow::ignoreMissingData_clicked() emit modListDataChanged(m_OrganizerCore.modList()->index(m_ContextRow, 0), m_OrganizerCore.modList()->index(m_ContextRow, m_OrganizerCore.modList()->columnCount() - 1));
}
+void MainWindow::markConverted_clicked()
+{
+ ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow);
+ info->markConverted(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));
+}
+
void MainWindow::visitOnNexus_clicked()
{
@@ -3463,6 +3471,10 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addAction(tr("Ignore missing data"), this, SLOT(ignoreMissingData_clicked()));
}
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_ALTERNATE_GAME) != flags.end()) {
+ menu->addAction(tr("Mark as converted/working"), this, SLOT(markConverted_clicked()));
+ }
+
if (info->getNexusID() > 0) {
menu->addAction(tr("Visit on Nexus"), this, SLOT(visitOnNexus_clicked()));
} else if ((info->getURL() != "")) {
diff --git a/src/mainwindow.h b/src/mainwindow.h index 7f38d766..7af6d712 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -409,6 +409,7 @@ private slots: void dontendorse_clicked();
void unendorse_clicked();
void ignoreMissingData_clicked();
+ void markConverted_clicked();
void visitOnNexus_clicked();
void visitWebPage_clicked();
void openExplorer_clicked();
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index e505bacc..bd4c1254 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -414,4 +414,4 @@ void ModInfo::testValid() while (dirIter.hasNext()) { dirIter.next(); } -} +}
\ No newline at end of file diff --git a/src/modinfo.h b/src/modinfo.h index 7bb2bdad..001a78dc 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -569,6 +569,11 @@ public: void testValid();
/**
+ * @brief updates the mod to flag it as converted in order to ignore the alternate game warning
+ */
+ virtual void markConverted(bool converted) {}
+
+ /**
* @brief reads meta information from disk
*/
virtual void readMeta() {}
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 49fc3aa2..c19294f1 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -30,6 +30,7 @@ ModInfoRegular::ModInfoRegular(PluginContainer *pluginContainer, const IPluginGa , m_Repository() , m_GameName(game->gameShortName()) , m_IsAlternate(false) + , m_Converted(false) , m_MetaInfoChanged(false) , m_EndorsedState(ENDORSED_UNKNOWN) , m_NexusBridge(pluginContainer) @@ -39,7 +40,8 @@ ModInfoRegular::ModInfoRegular(PluginContainer *pluginContainer, const IPluginGa // read out the meta-file for information readMeta(); if (m_GameName.compare(game->gameShortName(), Qt::CaseInsensitive) != 0) - m_IsAlternate = true; + if (!game->primarySources().contains(m_GameName, Qt::CaseInsensitive)) + m_IsAlternate = true; connect(&m_NexusBridge, SIGNAL(descriptionAvailable(QString,int,QVariant,QVariant)) , this, SLOT(nxmDescriptionAvailable(QString,int,QVariant,QVariant))); @@ -82,9 +84,10 @@ void ModInfoRegular::readMeta() m_IgnoredVersion = metaFile.value("ignoredVersion", "").toString(); m_InstallationFile = metaFile.value("installationFile", "").toString(); m_NexusDescription = metaFile.value("nexusDescription", "").toString(); - m_Repository = metaFile.value("repository", "Nexus").toString(); - m_URL = metaFile.value("url", "").toString(); - m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); + m_Repository = metaFile.value("repository", "Nexus").toString(); + m_Converted = metaFile.value("converted", false).toBool(); + m_URL = metaFile.value("url", "").toString(); + m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); if (metaFile.contains("endorsed")) { if (metaFile.value("endorsed").canConvert<int>()) { switch (metaFile.value("endorsed").toInt()) { @@ -146,6 +149,7 @@ void ModInfoRegular::saveMeta() metaFile.setValue("nexusDescription", m_NexusDescription); metaFile.setValue("url", m_URL); metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate)); + metaFile.setValue("converted", m_Converted); if (m_EndorsedState != ENDORSED_UNKNOWN) { metaFile.setValue("endorsed", m_EndorsedState); } @@ -403,6 +407,14 @@ void ModInfoRegular::endorse(bool doEndorse) } } +void ModInfoRegular::markConverted(bool converted) +{ + m_Converted = converted; + m_MetaInfoChanged = true; + saveMeta(); + emit modDetailsUpdated(true); +} + QString ModInfoRegular::absolutePath() const { @@ -435,7 +447,7 @@ std::vector<ModInfo::EFlag> ModInfoRegular::getFlags() const if (m_PluginSelected) { result.push_back(ModInfo::FLAG_PLUGIN_SELECTED); } - if (m_IsAlternate) { + if (m_IsAlternate && !m_Converted) { result.push_back(ModInfo::FLAG_ALTERNATE_GAME); } return result; diff --git a/src/modinforegular.h b/src/modinforegular.h index c47f10c8..3abaded4 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -27,6 +27,7 @@ public: virtual bool isEmpty() const; bool isAlternate() { return m_IsAlternate; } + bool isConverted() { return m_Converted; } /** * @brief test if there is a newer version of the mod @@ -183,6 +184,11 @@ public: virtual void endorse(bool doEndorse); /** + * @brief updates the mod to flag it as converted in order to ignore the alternate game warning + */ + virtual void markConverted(bool converted) override; + + /** * @brief getter for the mod name * * @return the mod name @@ -351,6 +357,7 @@ private: bool m_MetaInfoChanged; bool m_IsAlternate; + bool m_Converted; MOBase::VersionInfo m_NewestVersion; MOBase::VersionInfo m_IgnoredVersion; diff --git a/src/modlist.cpp b/src/modlist.cpp index aad88d1f..2d58081d 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -763,7 +763,7 @@ IModList::ModStates ModList::state(unsigned int modIndex) const }
if (modInfo->isRegular()) {
QSharedPointer<ModInfoRegular> modInfoRegular = modInfo.staticCast<ModInfoRegular>();
- if (modInfoRegular->isAlternate())
+ if (modInfoRegular->isAlternate() && !modInfoRegular->isConverted())
result |= IModList::STATE_ALTERNATE;
}
if (modInfo->canBeEnabled()) {
|
