From 9fa021e3c6b5d92bfdb7a1758573ee3637489ead Mon Sep 17 00:00:00 2001
From: Adriaan de Groot <groot@kde.org>
Date: Tue, 3 Dec 2019 13:00:12 +0100
Subject: [PATCH] [license] Reduce margins hugely

 - Move layouting code into the .ui file
 - Reduce margins hugely -- atop the title block, around the
   scroll area, etc -- so that more license is visible at once.
---
 src/modules/license/LicensePage.cpp | 26 ++++++++------------------
 src/modules/license/LicensePage.ui  | 18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/modules/license/LicensePage.cpp b/src/modules/license/LicensePage.cpp
index 915b396a7..fc90d843c 100644
--- a/src/modules/license/LicensePage.cpp
+++ b/src/modules/license/LicensePage.cpp
@@ -98,21 +98,14 @@ LicensePage::LicensePage( QWidget* parent )
 {
     ui->setupUi( this );
 
-    ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() );
+    // ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() );
+    CalamaresUtils::unmarginLayout( ui->verticalLayout );
 
-    ui->mainText->setAlignment( Qt::AlignCenter );
     ui->mainText->setWordWrap( true );
     ui->mainText->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
 
     ui->additionalText->setWordWrap( true );
 
-    ui->verticalLayout->insertSpacing( 4, CalamaresUtils::defaultFontHeight() / 2 );
-
-    ui->verticalLayout->setContentsMargins( CalamaresUtils::defaultFontHeight(),
-                                            CalamaresUtils::defaultFontHeight() * 3,
-                                            CalamaresUtils::defaultFontHeight(),
-                                            CalamaresUtils::defaultFontHeight() );
-
     ui->acceptFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
     ui->acceptFrame->setStyleSheet( "#acceptFrame { border: 1px solid red;"
                                     "background-color: #fff6f6;"
@@ -153,25 +146,22 @@ LicensePage::retranslate()
 {
     ui->acceptCheckBox->setText( tr( "I accept the terms and conditions above." ) );
 
-    QString header = tr( "<h1>License Agreement</h1>" );
     QString review = tr( "Please review the End User License Agreements (EULAs)." );
     const auto br = QStringLiteral( "<br/>" );
 
     if ( !m_allLicensesOptional )
     {
-        ui->mainText->setText( header
-                               + tr( "This setup procedure will install proprietary "
-                                     "software that is subject to licensing terms." )
+        ui->mainText->setText( tr( "This setup procedure will install proprietary "
+                                   "software that is subject to licensing terms." )
                                + br + review );
         ui->additionalText->setText( tr( "If you do not agree with the terms, the setup procedure cannot continue." ) );
     }
     else
     {
-        ui->mainText->setText( header
-                               + tr( "This setup procedure can install proprietary "
-                                     "software that is subject to licensing terms "
-                                     "in order to provide additional features and enhance the user "
-                                     "experience." )
+        ui->mainText->setText( tr( "This setup procedure can install proprietary "
+                                   "software that is subject to licensing terms "
+                                   "in order to provide additional features and enhance the user "
+                                   "experience." )
                                + br + review );
         ui->additionalText->setText( tr( "If you do not agree with the terms, proprietary software will not "
                                          "be installed, and open source alternatives will be used instead." ) );
diff --git a/src/modules/license/LicensePage.ui b/src/modules/license/LicensePage.ui
index 13c4d94b1..a81fae2b8 100644
--- a/src/modules/license/LicensePage.ui
+++ b/src/modules/license/LicensePage.ui
@@ -16,6 +16,16 @@
   <layout class="QHBoxLayout" name="horizontalLayout">
    <item>
     <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0">
+     <item>
+      <widget class="QLabel" name="titleLabel">
+       <property name="text">
+        <string>&lt;h1&gt;License Agreement&lt;/h1&gt;</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </item>
      <item>
       <widget class="QLabel" name="mainText">
        <property name="sizePolicy">
@@ -30,6 +40,12 @@
        <property name="text">
         <string notr="true">&lt;Calamares license text&gt;</string>
        </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
       </widget>
      </item>
      <item>
@@ -71,7 +87,7 @@
           <x>0</x>
           <y>0</y>
           <width>765</width>
-          <height>86</height>
+          <height>81</height>
          </rect>
         </property>
         <layout class="QVBoxLayout" name="licenseEntriesLayout"/>