forked from qt-creator/qt-creator
ExtensionSystem: Add field "DocumentationUrl" to PluginSpec
Task-number: QTCREATORBUG-31199 Change-Id: Ieb20d35cc9b4fe976207491bd201750fa4ca0032 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -132,6 +132,11 @@
|
||||
\li String
|
||||
\li Link to further information about the plugin, like
|
||||
\c{http://www.mycompany-online.com/products/greatplugin}.
|
||||
\row
|
||||
\li DocumentationUrl
|
||||
\li String
|
||||
\li Link to online documentation for the plugin, like
|
||||
\c{https://www.mycompany-online.com/docs/greatplugin/manual.html}.
|
||||
\endtable
|
||||
|
||||
\section2 Dependencies
|
||||
@@ -309,6 +314,7 @@
|
||||
"It demonstrates the great use of the plugin meta data."
|
||||
],
|
||||
"Url" : "http://www.mycompany-online.com/products/greatplugin",
|
||||
"DocumentationUrl" : "https://www.mycompany-online.com/docs/greatplugin/manual.html",
|
||||
"Arguments" : [
|
||||
{
|
||||
"Name" : "-variant",
|
||||
|
@@ -7,5 +7,6 @@
|
||||
\"License\" : \"%{License}\",
|
||||
\"Description\" : \"%{Description}\",
|
||||
\"Url\" : \"%{Url}\",
|
||||
\"DocumentationUrl\" : \"\",
|
||||
${IDE_PLUGIN_DEPENDENCIES}
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
, vendor(createContentsLabel())
|
||||
, component(createContentsLabel())
|
||||
, url(createContentsLabel())
|
||||
, documentationUrl(createContentsLabel())
|
||||
, location(createContentsLabel())
|
||||
, platforms(createContentsLabel())
|
||||
, description(createTextEdit())
|
||||
@@ -67,6 +68,7 @@ public:
|
||||
Tr::tr("Vendor:"), vendor, br,
|
||||
Tr::tr("Group:"), component, br,
|
||||
Tr::tr("URL:"), url, br,
|
||||
Tr::tr("Documentation:"), documentationUrl, br,
|
||||
Tr::tr("Location:"), location, br,
|
||||
Tr::tr("Platforms:"), platforms, br,
|
||||
Tr::tr("Description:"), description, br,
|
||||
@@ -87,6 +89,7 @@ public:
|
||||
QLabel *vendor = nullptr;
|
||||
QLabel *component = nullptr;
|
||||
QLabel *url = nullptr;
|
||||
QLabel *documentationUrl = nullptr;
|
||||
QLabel *location = nullptr;
|
||||
QLabel *platforms = nullptr;
|
||||
QTextEdit *description = nullptr;
|
||||
@@ -145,7 +148,11 @@ void PluginDetailsView::update(PluginSpec *spec)
|
||||
d->compatVersion->setText(spec->compatVersion());
|
||||
d->vendor->setText(spec->vendor());
|
||||
d->component->setText(spec->category().isEmpty() ? Tr::tr("None") : spec->category());
|
||||
d->url->setText(QString::fromLatin1("<a href=\"%1\">%1</a>").arg(spec->url()));
|
||||
const auto toHtmlLink = [](const QString &url) {
|
||||
return QString::fromLatin1("<a href=\"%1\">%1</a>").arg(url);
|
||||
};
|
||||
d->url->setText(toHtmlLink(spec->url()));
|
||||
d->documentationUrl->setText(toHtmlLink(spec->documentationUrl()));
|
||||
d->location->setText(spec->filePath().toUserOutput());
|
||||
const QString pattern = spec->platformSpecification().pattern();
|
||||
const QString platform = pattern.isEmpty() ? Tr::tr("All") : pattern;
|
||||
|
@@ -193,6 +193,7 @@ public:
|
||||
QString description;
|
||||
QString longDescription;
|
||||
QString url;
|
||||
QString documentationUrl;
|
||||
QString license;
|
||||
QString revision;
|
||||
QString copyright;
|
||||
@@ -324,6 +325,15 @@ QString PluginSpec::url() const
|
||||
return d->url;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the documentation URL where you can find the online manual about the plugin.
|
||||
This is valid after the PluginSpec::Read state is reached.
|
||||
*/
|
||||
QString PluginSpec::documentationUrl() const
|
||||
{
|
||||
return d->documentationUrl;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the category that the plugin belongs to. Categories are used to
|
||||
group plugins together in the UI.
|
||||
@@ -676,6 +686,7 @@ namespace {
|
||||
const char DESCRIPTION[] = "Description";
|
||||
const char LONGDESCRIPTION[] = "LongDescription";
|
||||
const char URL[] = "Url";
|
||||
const char DOCUMENTATIONURL[] = "DocumentationUrl";
|
||||
const char CATEGORY[] = "Category";
|
||||
const char PLATFORM[] = "Platform";
|
||||
const char DEPENDENCIES[] = "Dependencies";
|
||||
@@ -877,6 +888,11 @@ Utils::expected_str<void> PluginSpecPrivate::readMetaData(const QJsonObject &dat
|
||||
return reportError(msgValueIsNotAString(URL));
|
||||
url = value.toString();
|
||||
|
||||
value = metaData.value(QLatin1String(DOCUMENTATIONURL));
|
||||
if (!value.isUndefined() && !value.isString())
|
||||
return reportError(msgValueIsNotAString(DOCUMENTATIONURL));
|
||||
documentationUrl = value.toString();
|
||||
|
||||
value = metaData.value(QLatin1String(CATEGORY));
|
||||
if (!value.isUndefined() && !value.isString())
|
||||
return reportError(msgValueIsNotAString(CATEGORY));
|
||||
|
@@ -104,6 +104,7 @@ public:
|
||||
virtual QString description() const;
|
||||
virtual QString longDescription() const;
|
||||
virtual QString url() const;
|
||||
virtual QString documentationUrl() const;
|
||||
virtual QString category() const;
|
||||
virtual QString revision() const;
|
||||
virtual QRegularExpression platformSpecification() const;
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "extensionsmodel.h"
|
||||
|
||||
#include "extensionmanagertr.h"
|
||||
|
||||
#include "utils/algorithm.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -224,6 +226,8 @@ static Extension extensionFromPluginSpec(const PluginSpec *pluginSpec)
|
||||
LinksData links;
|
||||
if (const QString url = pluginSpec->url(); !url.isEmpty())
|
||||
links.append({{}, url});
|
||||
if (const QString docUrl = pluginSpec->documentationUrl(); !docUrl.isEmpty())
|
||||
links.append({{Tr::tr("Documentation")}, docUrl});
|
||||
const Description description = {
|
||||
.images = {},
|
||||
.links = links,
|
||||
|
@@ -18,6 +18,7 @@ Qtc = {}
|
||||
---@field Description? string A short one line description of the plugin.
|
||||
---@field LongDescription? string A long description of the plugin. Can contain newlines.
|
||||
---@field Url? string The url of the plugin.
|
||||
---@field DocumentationUrl? string The url of the online documentation for the plugin.
|
||||
---@field License? string The license text of the plugin.
|
||||
---@field Revision? string The revision of the plugin.
|
||||
---@field Copyright? string The copyright of the plugin.
|
||||
|
@@ -8,6 +8,7 @@ return {
|
||||
Category = "My Plugins",
|
||||
Description = "%{Description}",
|
||||
Url = "%{Url}",
|
||||
DocumentationUrl = "",
|
||||
Experimental = true,
|
||||
DisabledByDefault = false,
|
||||
LongDescription = [[
|
||||
|
Reference in New Issue
Block a user