diff --git a/docs/plugin-info.schema.json b/docs/plugin-info.schema.json index 3493ead28..1f29867b5 100644 --- a/docs/plugin-info.schema.json +++ b/docs/plugin-info.schema.json @@ -14,8 +14,11 @@ "description": "Plugin description shown to the user." }, "authors": { - "type": "string", - "description": "A string describing authors of the Plugin. This could be a list of names, an organisation or something else, as long as it's clear who made the Plugin." + "type": "array", + "description": "An array of authors of this Plugin.", + "items": { + "type": "string" + } }, "homepage": { "type": "string", diff --git a/src/controllers/plugins/Plugin.hpp b/src/controllers/plugins/Plugin.hpp index a1b51ec9c..177a8c617 100644 --- a/src/controllers/plugins/Plugin.hpp +++ b/src/controllers/plugins/Plugin.hpp @@ -22,7 +22,7 @@ struct PluginMeta { // required fields QString name; QString description; - QString authors; + std::vector authors; QString license; semver::version version; @@ -53,12 +53,31 @@ struct PluginMeta { this->description = descrObj.toString(); auto authorsObj = obj.value("authors"); - if (!authorsObj.isString()) + if (authorsObj.isArray()) { - this->invalidWhy.emplace_back("description is not a string"); + auto authorsArr = authorsObj.toArray(); + for (int i = 0; i < authorsArr.size(); i++) + { + const auto &t = authorsArr.at(i); + if (!t.isString()) + { + this->invalidWhy.push_back( + QString( + "authors element #%1 is not a string (it is a %2)") + .arg(i) + .arg(QString::fromStdString( + std::string(magic_enum::enum_name(t.type()))))); + this->valid = false; + return; + } + this->authors.push_back(t.toString()); + } + } + else + { + this->invalidWhy.emplace_back("authors is not an array"); this->valid = false; } - this->authors = authorsObj.toString(); auto licenseObj = obj.value("license"); if (!licenseObj.isString()) diff --git a/src/widgets/settingspages/PluginsPage.cpp b/src/widgets/settingspages/PluginsPage.cpp index c7b5a544e..596280519 100644 --- a/src/widgets/settingspages/PluginsPage.cpp +++ b/src/widgets/settingspages/PluginsPage.cpp @@ -91,7 +91,19 @@ void PluginsPage::rebuildContent() descrText->setWordWrap(true); descrText->setStyleSheet("color: #bbb"); pl->addRow(descrText); - pl->addRow("Authors", new QLabel(plugin->meta.authors)); + + QString authorsTxt; + for (const auto &author : plugin->meta.authors) + { + if (!authorsTxt.isEmpty()) + { + authorsTxt += ", "; + } + + authorsTxt += author; + } + pl->addRow("Authors", new QLabel(authorsTxt)); + auto *homepage = new QLabel(formatRichLink(plugin->meta.homepage)); homepage->setOpenExternalLinks(true);