diff --git a/src/App/Metadata.cpp b/src/App/Metadata.cpp index 3b47d60419..05000389a8 100644 --- a/src/App/Metadata.cpp +++ b/src/App/Metadata.cpp @@ -149,7 +149,11 @@ std::string Metadata::name() const Meta::Version Metadata::version() const { - return _version; + return _version; } + +std::string App::Metadata::date() const +{ + return _date; } std::string Metadata::description() const @@ -257,7 +261,11 @@ void Metadata::setName(const std::string& name) void Metadata::setVersion(const Meta::Version& version) { - _version = version; + _version = version; } + +void App::Metadata::setDate(const std::string &date) +{ + _date = date; } void Metadata::setDescription(const std::string& description) @@ -661,6 +669,9 @@ void Metadata::appendToElement(DOMElement* root) const // Only append version if it's not 0.0.0 appendSimpleXMLNode(root, "version", _version.str()); + if (!_date.empty()) + appendSimpleXMLNode(root, "date", _date); + for (const auto& maintainer : _maintainer) { auto element = appendSimpleXMLNode(root, "maintainer", maintainer.name); if (element) @@ -689,6 +700,7 @@ void Metadata::appendToElement(DOMElement* root) const case Meta::UrlType::bugtracker: typeAsString = "bugtracker"; break; case Meta::UrlType::readme: typeAsString = "readme"; break; case Meta::UrlType::documentation: typeAsString = "documentation"; break; + case Meta::UrlType::discussion: typeAsString = "discussion"; break; } addAttribute(element, "type", typeAsString); if (url.type == Meta::UrlType::repository) { @@ -882,6 +894,8 @@ Meta::Url::Url(const XERCES_CPP_NAMESPACE::DOMElement* e) type = UrlType::readme; else if (typeAttribute == "documentation") type = UrlType::documentation; + else if (typeAttribute == "discussion") + type = UrlType::discussion; else type = UrlType::website; diff --git a/src/App/Metadata.h b/src/App/Metadata.h index 2dbce270c9..76458f377a 100644 --- a/src/App/Metadata.h +++ b/src/App/Metadata.h @@ -74,7 +74,8 @@ namespace App { repository, bugtracker, readme, - documentation + documentation, + discussion }; /** @@ -203,6 +204,7 @@ namespace App { std::string name() const; //< A short name for this package, often used as a menu entry. Meta::Version version() const; //< Version string in symantic triplet format, e.g. "1.2.3". + std::string date() const; //< Date string -- currently arbitrary (when C++20 is well-supported we can revisit) std::string description() const; //< Text-only description of the package. No markup. std::vector maintainer() const; //< Must be at least one, and must specify an email address. std::vector license() const; //< Must be at least one, and most licenses require including a license file. @@ -256,6 +258,7 @@ namespace App { // Setters void setName(const std::string& name); void setVersion(const Meta::Version& version); + void setDate(const std::string &date); void setDescription(const std::string& description); void addMaintainer(const Meta::Contact &maintainer); void addLicense(const Meta::License &license); @@ -318,6 +321,7 @@ namespace App { std::string _name; Meta::Version _version; + std::string _date; std::string _description; std::vector _maintainer; std::vector _license; diff --git a/src/App/MetadataPy.xml b/src/App/MetadataPy.xml index 712b5cf15d..e7b75d80a9 100644 --- a/src/App/MetadataPy.xml +++ b/src/App/MetadataPy.xml @@ -44,6 +44,12 @@ file : str\n XML file name. + + + String representing the date of this item in YYYY-MM-DD format (format not currently programmatically enforced) + + + String representing the description of this item (text only, no markup allowed). diff --git a/src/App/MetadataPyImp.cpp b/src/App/MetadataPyImp.cpp index 6d30eab768..2b25309a5b 100644 --- a/src/App/MetadataPyImp.cpp +++ b/src/App/MetadataPyImp.cpp @@ -145,6 +145,21 @@ void MetadataPy::setVersion(Py::Object args) getMetadataPtr()->setVersion(App::Meta::Version()); } +Py::Object MetadataPy::getDate() const +{ + return Py::String(getMetadataPtr()->date()); +} + +void MetadataPy::setDate(Py::Object args) +{ + const char *date = nullptr; + if (!PyArg_Parse(args.ptr(), "z", &date)) + throw Py::Exception(); + if (date) getMetadataPtr()->setDate(date); + else + getMetadataPtr()->setDate(""); +} + Py::Object MetadataPy::getDescription() const { return Py::String(getMetadataPtr()->description()); diff --git a/src/Mod/AddonManager/addonmanager_devmode.py b/src/Mod/AddonManager/addonmanager_devmode.py index 3a431cfe50..ddd0c20996 100644 --- a/src/Mod/AddonManager/addonmanager_devmode.py +++ b/src/Mod/AddonManager/addonmanager_devmode.py @@ -166,6 +166,8 @@ class DeveloperMode: result = self.dialog.exec() if result == QDialog.Accepted: self._sync_metadata_to_ui() + now = datetime.date.today() + self.metadata.Date = str(now) self.metadata.write(os.path.join(self.current_mod, "package.xml")) def _populate_dialog(self, path_to_repo):