From 1bf3cc585e28516f4ff6c9edf720fa9d290f47c2 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 16 Oct 2013 19:32:59 +0200 Subject: - nmm importer now also transfers category, endorsement state and lastest version information - nmm importer should now always determine the correct nexus id - nmm importer will now correctly restore overwritten files for imported mods --- src/mainwindow.cpp | 2 +- src/mainwindow.h | 25 +++++++++++++++++++++++-- src/modinfo.cpp | 5 +++++ src/modinfo.h | 15 +++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7ef2dab6..1b6fd047 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2131,7 +2131,7 @@ HANDLE MainWindow::startApplication(const QString &executable, const QStringList return spawnBinaryDirect(binary, arguments, profileName, currentDirectory, steamAppID); } -bool MainWindow::onAboutToRun(const boost::function &func) +bool MainWindow::onAboutToRun(const std::function &func) { auto conn = m_AboutToRun.connect(func); return conn.connected(); diff --git a/src/mainwindow.h b/src/mainwindow.h index fab850cf..8a34d16a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -50,6 +50,7 @@ along with Mod Organizer. If not, see . #include "savegameinfowidgetgamebryo.h" #include #include +#include namespace Ui { class MainWindow; @@ -59,11 +60,32 @@ class QToolButton; class ModListSortProxy; class ModListGroupCategoriesProxy; + class MainWindow : public QMainWindow, public MOBase::IOrganizer, public MOBase::IPluginDiagnose { Q_OBJECT Q_INTERFACES(MOBase::IPluginDiagnose) +public: + + struct SignalCombinerAnd + { + typedef bool result_type; + template + bool operator()(InputIterator first, InputIterator last) const + { + while (first != last) { + if (!(*first)) { + return false; + } + ++first; + } + return true; + } + }; + + typedef boost::signals2::signal SignalAboutToRunApplication; + public: explicit MainWindow(const QString &exeName, QSettings &initSettings, QWidget *parent = 0); ~MainWindow(); @@ -115,7 +137,7 @@ public: virtual QStringList findFiles(const QString &path, const std::function &filter) const; virtual MOBase::IDownloadManager *downloadManager(); virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = ""); - virtual bool onAboutToRun(const boost::function &func); + virtual bool onAboutToRun(const std::function &func); virtual std::vector activeProblems() const; virtual QString shortDescription(unsigned int key) const; @@ -157,7 +179,6 @@ signals: void styleChanged(const QString &styleFile); - void modListDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); protected: diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 1479f7b4..9bc013f1 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -554,6 +554,11 @@ void ModInfoRegular::setNexusDescription(const QString &description) m_MetaInfoChanged = true; } +void ModInfoRegular::addNexusCategory(int categoryID) +{ + m_Categories.insert(CategoryFactory::instance().resolveNexusID(categoryID)); +} + void ModInfoRegular::setIsEndorsed(bool endorsed) { diff --git a/src/modinfo.h b/src/modinfo.h index 3b83d207..e408e812 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -267,6 +267,13 @@ public: */ virtual void setNexusDescription(const QString &description) = 0; + /** + * @brief sets the category id from a nexus category id. Conversion to MO id happens internally + * @param categoryID the nexus category id + * @note if a mapping is not possible, the category is set to the default value + */ + virtual void addNexusCategory(int categoryID) = 0; + /** * update the endorsement state for the mod. This only changes the * buffered state, it does not sync with Nexus @@ -605,6 +612,13 @@ public: */ virtual void setNexusDescription(const QString &description); + /** + * @brief sets the category id from a nexus category id. Conversion to MO id happens internally + * @param categoryID the nexus category id + * @note if a mapping is not possible, the category is set to the default value + */ + virtual void addNexusCategory(int categoryID); + /** * @brief sets the new primary category of the mod * @param categoryID the category to set @@ -854,6 +868,7 @@ public: virtual void setNewestVersion(const MOBase::VersionInfo&) {} virtual void ignoreUpdate(bool) {} virtual void setNexusDescription(const QString&) {} + virtual void addNexusCategory(int) {} virtual void setIsEndorsed(bool) {} virtual void setNeverEndorse() {} virtual bool remove() { return false; } -- cgit v1.3.1