Skip to content

Commit

Permalink
Add possibility to specify homepage for authors/contributors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Aug 10, 2024
1 parent 5c1d8c5 commit 3a64b4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 6 additions & 2 deletions include/uibase/extensions/extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,22 @@ enum class ExtensionType
class QDLLEXPORT ExtensionContributor
{
public:
ExtensionContributor(QString name);
ExtensionContributor(QString name, QString homepage);

// retrieve the name of the contributor
//
const auto& name() const { return m_Name; }

// retrieve the homagepage of the contributor
//
const auto& homepage() const { return m_Homepage; }

private:
ExtensionContributor() = default;

friend class ExtensionMetaData;

QString m_Name;
QString m_Name, m_Homepage;
};

class QDLLEXPORT ExtensionMetaData
Expand Down
11 changes: 7 additions & 4 deletions src/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,25 @@ namespace
ExtensionContributor parseContributor(QJsonValue const& value)
{
if (value.isNull()) {
return ExtensionContributor("");
return ExtensionContributor("", "");
}

// TODO: handle more fields in the future, handle string authors similar to NPM

if (value.isObject()) {
const auto contrib = value.toObject();
return ExtensionContributor(contrib["name"].toString());
return ExtensionContributor(contrib["name"].toString(),
contrib["homepage"].toString());
}

return ExtensionContributor(value.toString());
return ExtensionContributor(value.toString(), {});
}

} // namespace

ExtensionContributor::ExtensionContributor(QString name) : m_Name{name} {}
ExtensionContributor::ExtensionContributor(QString name, QString homepage)
: m_Name{std::move(name)}, m_Homepage{std::move(homepage)}
{}

ExtensionMetaData::ExtensionMetaData(std::filesystem::path const& path,
QJsonObject const& jsonData)
Expand Down

0 comments on commit 3a64b4c

Please sign in to comment.