changeset 84:e77bcf5caedd

Some layout & text tweaks
author Chris Cannam
date Wed, 26 Feb 2020 13:27:02 +0000
parents 66a22cdbb50c
children bdd4317e43de
files installer.cpp
diffstat 1 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/installer.cpp	Wed Feb 19 17:32:20 2020 +0000
+++ b/installer.cpp	Wed Feb 26 13:27:02 2020 +0000
@@ -511,7 +511,7 @@
     case RelativeStatus::Same: return QObject::tr("Already installed");
     case RelativeStatus::Upgrade: return QObject::tr("Update");
     case RelativeStatus::Downgrade: return QObject::tr("Newer version installed");
-    case RelativeStatus::TargetNotLoadable: return QObject::tr("<unknown>");
+    case RelativeStatus::TargetNotLoadable: return QObject::tr("Installed version not working");
     default: return {};
     }
 }
@@ -622,6 +622,9 @@
 {
     QDialog dialog;
 
+    int fontHeight = QFontMetrics(dialog.font()).height();
+    int dpratio = dialog.devicePixelRatio();
+
     auto mainLayout = new QGridLayout;
     mainLayout->setSpacing(0);
     dialog.setLayout(mainLayout);
@@ -633,28 +636,37 @@
     ++mainRow;
     
     auto selectionLayout = new QGridLayout;
+    selectionLayout->setContentsMargins(0, 0, 0, 0);
+    selectionLayout->setSpacing(fontHeight / 6);
     selectionFrame->setLayout(selectionLayout);
+
     int selectionRow = 0;
+    int checkColumn = 0;
+    int titleColumn = 1;
+    int statusColumn = 2;
+    int infoColumn = 3;
 
     selectionLayout->addWidget
         (new QLabel(QObject::tr("<b>Vamp Plugin Pack</b> v%1")
                     .arg(PACK_VERSION)),
-         selectionRow, 1);
+         selectionRow, titleColumn, 1, 3);
     ++selectionRow;
 
     selectionLayout->addWidget
         (new QLabel(QObject::tr("Select the plugin libraries to install:")),
-         selectionRow, 1, 1, 3);
+         selectionRow, titleColumn, 1, 3);
     ++selectionRow;
     
     auto checkAll = new QCheckBox;
     checkAll->setChecked(true);
-    selectionLayout->addWidget(checkAll, selectionRow, 0, Qt::AlignHCenter);
+    selectionLayout->addWidget
+        (checkAll, selectionRow, checkColumn, Qt::AlignHCenter);
     ++selectionRow;
 
     auto checkArrow = new QLabel("&#9660;");
     checkArrow->setTextFormat(Qt::RichText);
-    selectionLayout->addWidget(checkArrow, selectionRow, 0, Qt::AlignHCenter);
+    selectionLayout->addWidget
+        (checkArrow, selectionRow, checkColumn, Qt::AlignHCenter);
     ++selectionRow;
 
     map<QString, QCheckBox *> checkBoxMap; // filename -> checkbox
@@ -670,9 +682,6 @@
         orderedInfo[info.title] = info;
     }
 
-    int fontHeight = QFontMetrics(checkArrow->font()).height();
-    int dpratio = dialog.devicePixelRatio();
-    
     QPixmap infoMap(fontHeight * dpratio, fontHeight * dpratio);
     QPixmap moreMap(fontHeight * dpratio * 2, fontHeight * dpratio * 2);
     infoMap.fill(Qt::transparent);
@@ -695,16 +704,17 @@
     for (auto ip: orderedInfo) {
 
         auto cb = new QCheckBox;
-        selectionLayout->addWidget(cb, selectionRow, 0, Qt::AlignHCenter);
+        selectionLayout->addWidget
+            (cb, selectionRow, checkColumn, Qt::AlignHCenter);
 
         LibraryInfo info = ip.second;
 
         auto shortLabel = new QLabel(info.title);
-        selectionLayout->addWidget(shortLabel, selectionRow, 1);
+        selectionLayout->addWidget(shortLabel, selectionRow, titleColumn);
 
         RelativeStatus relativeStatus = getRelativeStatus(info, targetDir);
         auto statusLabel = new QLabel(relativeStatusLabel(relativeStatus));
-        selectionLayout->addWidget(statusLabel, selectionRow, 2);
+        selectionLayout->addWidget(statusLabel, selectionRow, statusColumn);
         cb->setChecked(shouldCheck(relativeStatus));
         
         auto infoButton = new QToolButton;
@@ -718,7 +728,7 @@
         infoButton->setStyleSheet("QToolButton { border: none; }");
 #endif
 
-        selectionLayout->addWidget(infoButton, selectionRow, 3);
+        selectionLayout->addWidget(infoButton, selectionRow, infoColumn);
 
         ++selectionRow;
 
@@ -781,7 +791,7 @@
 
     selectionLayout->addWidget
         (new QLabel(QObject::tr("Installation will be to: %1").arg(targetDir)),
-         selectionRow, 1, 1, 3);
+         selectionRow, titleColumn, 1, 3);
     ++selectionRow; 
 
     QObject::connect(checkAll, &QCheckBox::toggled,