changeset 1599:5e091b0e317c

Add list of packs, fix download test logic
author Chris Cannam
date Wed, 22 Apr 2020 13:08:12 +0100
parents b1f3b5678549
children 1acd7be4df9a
files widgets/TransformFinder.cpp
diffstat 1 files changed, 36 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/TransformFinder.cpp	Mon Apr 20 18:46:49 2020 +0100
+++ b/widgets/TransformFinder.cpp	Wed Apr 22 13:08:12 2020 +0100
@@ -285,25 +285,53 @@
                 .arg(XmlExportable::encodeEntities(desc.description));
         }
 
+        QString indentation = tr("      —");
+        
         selectedText += tr("<small>");
         if (desc.type != TransformDescription::UnknownType) {
-            selectedText += tr("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&mdash; Plugin type: %1")
-                .arg(XmlExportable::encodeEntities(factory->getTransformTypeName(desc.type)));
+            selectedText += tr("<br>%1 Plugin type: %2")
+                .arg(indentation)
+                .arg(XmlExportable::encodeEntities
+                     (factory->getTransformTypeName(desc.type)));
         }
         if (desc.category != "") {
-            selectedText += tr("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&mdash; Category: %1")
+            selectedText += tr("<br>%1 Category: %2")
+                .arg(indentation)
                 .arg(XmlExportable::encodeEntities(desc.category));
         }
-        selectedText += tr("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&mdash; System identifier: %1")
+        selectedText += tr("<br>%1 System identifier: %2")
+            .arg(indentation)
             .arg(XmlExportable::encodeEntities(desc.identifier));
         if (desc.provider.infoUrl != "") {
-            selectedText += tr("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&mdash; More information: <a href=\"%1\">%1</a>")
+            selectedText += tr("<br>%1 More information: <a href=\"%2\">%2</a>")
+                .arg(indentation)
                 .arg(desc.provider.infoUrl);
         }
-        if (desc.provider.downloadUrl != "") {
-            selectedText += tr("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&mdash; Downloads: <a href=\"%1\">%1</a>")
-                .arg(desc.provider.downloadUrl);
+        if (status != TransformFactory::TransformInstalled) {
+            bool haveSuitableDownloadLink =
+                (desc.provider.downloadUrl != "" &&
+                 desc.provider.hasDownloadForThisPlatform());
+            if (haveSuitableDownloadLink) {
+                selectedText += tr("<br>%1 Download for %2: <a href=\"%3\">%3</a>")
+                    .arg(indentation)
+                    .arg(desc.provider.thisPlatformName())
+                    .arg(desc.provider.downloadUrl);
+            }
+            if (!desc.provider.foundInPacks.empty()) {
+                QStringList packsLinks;
+                for (auto p: desc.provider.foundInPacks) {
+                    packsLinks <<
+                        tr("<a href=\"%1\">%2</a>").arg(p.second).arg(p.first);
+                }
+                selectedText +=
+                    (haveSuitableDownloadLink ?
+                     tr("<br>%1 Also available in: %2") :
+                     tr("<br>%1 Available in: %2"))
+                    .arg(indentation)
+                    .arg(packsLinks.join(tr(", ")));
+            }
         }
+
         selectedText += tr("</small>");
 
         if (i >= (int)m_labels.size()) {