reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 83bcd6a9b848b9d84178382a6f023b4261fe688b
parent 5def8798a8e18d7422526382c9e905e8a5595f10
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon,  1 Feb 2016 23:08:44 -0500

add back the author metadata for the about dialog

Diffstat:
Msrc/about.cpp | 7+++++--
Msrc/index_v1.cpp | 3+++
Msrc/package.hpp | 4++++
Mtest/index_v1.cpp | 10++++++++++
Dtest/indexes/v1/ReaPack/anonymous_package.xml | 5-----
Atest/indexes/v1/ReaPack/developer_name.xml | 9+++++++++
Mtest/package.cpp | 8++++++++
7 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/src/about.cpp b/src/about.cpp @@ -51,7 +51,7 @@ void About::onInit() m_packages = createControl<ListView>(IDC_PACKAGES, ListView::Columns{ {AUTO_STR("Name"), NAME_SIZE}, {AUTO_STR("Version"), 80}, - {AUTO_STR("Author"), 90}, + {AUTO_STR("Developer"), 90}, }); m_tabs = createControl<TabBar>(IDC_TABS, TabBar::Tabs{ @@ -134,8 +134,11 @@ void About::updatePackages() for(Package *pkg : *pkgList) { const auto_string &name = make_autostring(pkg->name()); + const auto_string &author = make_autostring(pkg->author()); const auto_string &lastVer = make_autostring(pkg->lastVersion()->name()); - m_packages->addRow({name, lastVer, AUTO_STR("John Doe")}); + + m_packages->addRow({name, lastVer, + author.empty() ? AUTO_STR("Unknown") : author}); } m_currentCat = catIndex; diff --git a/src/index_v1.cpp b/src/index_v1.cpp @@ -81,6 +81,9 @@ void LoadPackageV1(TiXmlElement *packNode, Category *cat) Package *pack = new Package(Package::ConvertType(type), name, cat); unique_ptr<Package> ptr(pack); + const char *author = packNode->Attribute("author"); + if(author) pack->setAuthor(author); + TiXmlElement *verNode = packNode->FirstChildElement("version"); while(verNode) { diff --git a/src/package.hpp b/src/package.hpp @@ -43,6 +43,9 @@ public: const std::string &name() const { return m_name; } std::string fullName() const; + void setAuthor(const std::string &author) { m_author = author; } + const std::string &author() const { return m_author; } + void addVersion(Version *ver); const VersionSet &versions() const { return m_versions; } Version *version(const size_t i) const; @@ -55,6 +58,7 @@ private: Type m_type; std::string m_name; + std::string m_author; VersionSet m_versions; }; diff --git a/test/index_v1.cpp b/test/index_v1.cpp @@ -69,6 +69,16 @@ TEST_CASE("null package type", M) { } } +TEST_CASE("read package developer", M) { + UseRootPath root(RIPATH); + + RemoteIndex *ri = RemoteIndex::load("developer_name"); + RIPTR(ri); + + CHECK(ri->packages().size() == 1); + REQUIRE(ri->category(0)->package(0)->author() == "Watanabe Saki"); +} + TEST_CASE("invalid version tag", M) { UseRootPath root(RIPATH); diff --git a/test/indexes/v1/ReaPack/anonymous_package.xml b/test/indexes/v1/ReaPack/anonymous_package.xml @@ -1,5 +0,0 @@ -<index version="1"> - <category name="test"> - <reapack name="abc" type="script" /> - </category> -</index> diff --git a/test/indexes/v1/ReaPack/developer_name.xml b/test/indexes/v1/ReaPack/developer_name.xml @@ -0,0 +1,9 @@ +<index version="1"> + <category name="catname"> + <reapack name="packname" author="Watanabe Saki" type="script"> + <version name="1.0"> + <source platform="all" file="filename">https://google.com/</source> + </version> + </reapack> + </category> +</index> diff --git a/test/package.cpp b/test/package.cpp @@ -142,3 +142,11 @@ TEST_CASE("full name", M) { REQUIRE(pack.fullName() == "Remote Name/Category Name/file.name"); } } + +TEST_CASE("package developer", M) { + Package pack(Package::ScriptType, "packname"); + CHECK(pack.author().empty()); + + pack.setAuthor("cfillion"); + REQUIRE(pack.author() == "cfillion"); +}