changeset 46:6dc29a50b89a

Start fancifying layout
author Chris Cannam
date Wed, 22 Jan 2020 13:54:03 +0000
parents 8c1f0280c425
children c9e811d9edbe
files installer.cpp
diffstat 1 files changed, 48 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/installer.cpp	Tue Jan 21 14:56:43 2020 +0000
+++ b/installer.cpp	Wed Jan 22 13:54:03 2020 +0000
@@ -8,7 +8,9 @@
 #include <QFrame>
 #include <QVBoxLayout>
 #include <QCheckBox>
+#include <QScrollArea>
 #include <QDialogButtonBox>
+#include <QLabel>
 
 #include <vamp-hostsdk/PluginHostAdapter.h>
 
@@ -141,8 +143,15 @@
                                            Node()));
         if (maker.type == Node::Literal) {
             info.maker = maker.value;
+        } else if (maker != Node()) {
+            maker = store.complete(Triple(maker,
+                                          store.expand("foaf:name"),
+                                          Node()));
+            if (maker.type == Node::Literal) {
+                info.maker = maker.value;
+            }
         }
-
+            
         Node desc = store.complete(Triple(t.subject(),
                                           store.expand("dc:description"),
                                           Node()));
@@ -183,7 +192,24 @@
 getUserApprovedPluginLibraries(vector<LibraryInfo> libraries)
 {
     QDialog dialog;
-    auto layout = new QVBoxLayout;
+
+    auto mainLayout = new QGridLayout;
+    dialog.setLayout(mainLayout);
+
+    int mainRow = 0;
+    
+    //!!! at top: title and check/uncheck all button
+    
+    auto scroll = new QScrollArea;
+    mainLayout->addWidget(scroll, mainRow, 0, 1, 2);
+    mainLayout->setRowStretch(mainRow, 10);
+    ++mainRow;
+
+    auto selectionFrame = new QWidget;
+    
+    auto selectionLayout = new QGridLayout;
+    selectionFrame->setLayout(selectionLayout);
+    int selectionRow = 0;
 
     map<QString, QCheckBox *> checkBoxMap;
 
@@ -193,20 +219,35 @@
     }
     
     for (auto ip: orderedInfo) {
+
+        auto cb = new QCheckBox;
+        selectionLayout->addWidget(cb, selectionRow, 0, Qt::AlignTop);
+
         LibraryInfo info = ip.second;
-        auto cb = new QCheckBox(info.title);
-        layout->addWidget(cb);
+
+        QString text = QObject::tr("<b>%1</b> (%2)<br><i>%3</i>")
+            .arg(info.title)
+            .arg(info.id)
+            .arg(info.maker);
+        
+        auto label = new QLabel(text);
+        
+        selectionLayout->addWidget(label, selectionRow, 1, Qt::AlignTop);
+
+        ++selectionRow;
+
         checkBoxMap[info.fileName] = cb;
     }
 
+    scroll->setWidget(selectionFrame);
+
     auto bb = new QDialogButtonBox(QDialogButtonBox::Ok |
                                    QDialogButtonBox::Cancel);
-    layout->addWidget(bb);
+    mainLayout->addWidget(bb, mainRow, 0, 1, 2);
+    ++mainRow;
     QObject::connect(bb, SIGNAL(accepted()), &dialog, SLOT(accept()));
     QObject::connect(bb, SIGNAL(rejected()), &dialog, SLOT(reject()));
 
-    dialog.setLayout(layout);
-    
     if (dialog.exec() == QDialog::Accepted) {
         cerr << "accepted" << endl;
     } else {