From 40c433580f69006a42dc27a6444ebd9a6cccc440 Mon Sep 17 00:00:00 2001 From: MikaĆ«l Capelle Date: Fri, 1 May 2020 18:00:31 +0200 Subject: Update ModInfo classes to handle plugin game and clean some declarations. --- src/modinfo.h | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'src/modinfo.h') diff --git a/src/modinfo.h b/src/modinfo.h index 34b1ecdf..d611fa87 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -319,11 +319,23 @@ public: virtual void setNotes(const QString ¬es) = 0; /** - * @brief set/change the source game of this mod + * @brief set/change the game plgin for this mod * - * @param gameName the source game shortName + * @param gamePlugin the game plugin */ - virtual void setGameName(const QString &gameName) = 0; + virtual void setGamePlugin(const MOBase::IPluginGame* gamePlugin) = 0; + + /** + * @brief set the name of this mod + * + * set the name of this mod. This will also update the name of the + * directory that contains this mod + * + * @param name new name of the mod + * @return true on success, false if the new name can't be used (i.e. because the new + * directory name wouldn't be valid) + **/ + virtual bool setName(const QString& name) = 0; /** * @brief set/change the nexus mod id of this mod @@ -336,7 +348,7 @@ public: * @brief set/change the version of this mod * @param version new version of the mod */ - virtual void setVersion(const MOBase::VersionInfo &version); + virtual void setVersion(const MOBase::VersionInfo &version) override; /** * @brief Controls if mod should be highlighted based on plugin selection @@ -382,7 +394,7 @@ public: virtual void addCategory(const QString &categoryName) override; virtual bool removeCategory(const QString &categoryName) override; - virtual QStringList categories() override; + virtual QStringList categories() const override; /** * update the endorsement state for the mod. This only changes the @@ -645,12 +657,12 @@ public: /* *@return the color choosen by the user for the mod/separator */ - virtual QColor getColor() { return QColor(); } + virtual QColor getColor() const { return QColor(); } /* *@return true if the color has been set successfully. */ - virtual void setColor(QColor color) { } + virtual void setColor(QColor) { } /** * @brief adds the information that a file has been installed into this mod @@ -709,12 +721,12 @@ public: /** * @brief updates the mod to flag it as converted in order to ignore the alternate game warning */ - virtual void markConverted(bool converted) {} + virtual void markConverted(bool) {} /** * @brief updates the mod to flag it as valid in order to ignore the invalid game data flag */ - virtual void markValidated(bool validated) {} + virtual void markValidated(bool) {} /** * @brief reads meta information from disk @@ -729,32 +741,32 @@ public: /** * @return retrieve list of mods (as mod index) that are overwritten by this one. Updates may be delayed */ - virtual std::set getModOverwrite() { return std::set(); } + virtual std::set getModOverwrite() const { return std::set(); } /** * @return list of mods (as mod index) that overwrite this one. Updates may be delayed */ - virtual std::set getModOverwritten() { return std::set(); } + virtual std::set getModOverwritten() const { return std::set(); } /** * @return retrieve list of mods (as mod index) with archives that are overwritten by this one. Updates may be delayed */ - virtual std::set getModArchiveOverwrite() { return std::set(); } + virtual std::set getModArchiveOverwrite() const { return std::set(); } /** * @return list of mods (as mod index) with archives that overwrite this one. Updates may be delayed */ - virtual std::set getModArchiveOverwritten() { return std::set(); } + virtual std::set getModArchiveOverwritten() const { return std::set(); } /** * @return retrieve list of mods (as mod index) with archives that are overwritten by thos mod's loose files. Updates may be delayed */ - virtual std::set getModArchiveLooseOverwrite() { return std::set(); } + virtual std::set getModArchiveLooseOverwrite() const { return std::set(); } /** * @return list of mods (as mod index) with loose files that overwrite this one's archive files. Updates may be delayed */ - virtual std::set getModArchiveLooseOverwritten() { return std::set(); } + virtual std::set getModArchiveLooseOverwritten() const { return std::set(); } /** * @brief update conflict information @@ -804,6 +816,13 @@ protected: static void updateIndices(); static bool ByName(const ModInfo::Ptr &LHS, const ModInfo::Ptr &RHS); + /** + * @brief check if the content of this mod is valid. + * + * @return true if the content is valid, false otherwize. + **/ + virtual bool doTestValid() const = 0; + private: static void createFromOverwrite(PluginContainer *pluginContainer, -- cgit v1.3.1