[PATCH] (UI) Changed update header to GridLayout and moved action buttons to bottom left

Wald Commits scm-commit at wald.intevation.org
Wed Jul 2 13:10:25 CEST 2014


# HG changeset patch
# User Emanuel Schuetze <emanuel at intevation.de>
# Date 1404299349 -7200
# Node ID 8f110e6b829559128ac091ac34ac993d870d13c2
# Parent  bd48fae793b603348e2e24e51fd1e7b529f16213
(UI) Changed update header to GridLayout and moved action buttons to bottom left.

diff -r bd48fae793b6 -r 8f110e6b8295 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Wed Jul 02 12:49:11 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jul 02 13:09:09 2014 +0200
@@ -21,6 +21,7 @@
 #include <QTimer>
 #include <QHBoxLayout>
 #include <QVBoxLayout>
+#include <QGridLayout>
 #include <QGroupBox>
 #include <QSplitter>
 #include <QLabel>
@@ -78,7 +79,8 @@
     createActions();
     createTrayIcon();
     createContent();
-    resize(950, 540);
+    resize(1065, 600);
+    setMinimumWidth(760);
     qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
     qRegisterMetaType<Certificate::Status>("Certificate::Status");
 
@@ -526,16 +528,12 @@
     QVBoxLayout *updatesMainLayout = new QVBoxLayout;
     mUpdatesPanel = new QScrollArea;
     QScrollArea *updatesContent = new QScrollArea;
-//    updatesContent->setFrameShape(QFrame::NoFrame);
     mUpdatesWidget = new QWidget;
 
-    /* The updates header */
-    QHBoxLayout *updatesHeaderLayout = new QHBoxLayout;
-    QVBoxLayout *updatesHeaderTextLayout = new QVBoxLayout;
-    QVBoxLayout *updatesHeaderButtonLayout = new QVBoxLayout;
-    QHBoxLayout *updatesHeaderActionLayout = new QHBoxLayout;
-    QHBoxLayout *updatesHeaderSearchLayout = new QHBoxLayout;
+    /* The header */
+    QGridLayout *updatesHeaderLayout = new QGridLayout;
 
+    /* Header 1: Update date and search button */
     mUpdatesHeader =
         new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>");
     mLastCertUpdate =
@@ -552,19 +550,23 @@
         mLastUpdateCheck = new QLabel("");
         mLastUpdateCheck->hide();
     }
-    QLabel *updatesTip =
-        new QLabel(tr("You should apply the following changes to your root certificates:"));
-    updatesTip->setWordWrap(true);
-
-    updatesHeaderTextLayout->addWidget(mUpdatesHeader);
-    updatesHeaderTextLayout->addWidget(mLastCertUpdate);
-    updatesHeaderTextLayout->addWidget(mLastUpdateCheck);
-    updatesHeaderTextLayout->addWidget(mSoftwareVersionLabel);
-    updatesHeaderTextLayout->addSpacing(10);
-    updatesHeaderTextLayout->addWidget(updatesTip);
-
     QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates"));
     searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
+    connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
+
+    // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment])
+    updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2);
+    updatesHeaderLayout->addWidget(mLastCertUpdate, 1, 0, 1, 1);
+    updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 2, 0, 1, 1);
+    updatesHeaderLayout->addWidget(mLastUpdateCheck, 3, 0, 1, 1);
+    updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight);
+    updatesHeaderLayout->setRowMinimumHeight(4, 15);
+
+    /* Header 2: Action text and buttons */
+    QLabel *updatesTip =
+        new QLabel(tr("You should apply the following, recommended changes to your root certificates."));
+    updatesTip->setWordWrap(true);
+    QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout;
     mQuitButton = new QPushButton(" " + tr("Quit without saving"));
     mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
     QPushButton *installButton = new QPushButton(" " + tr("Apply changes"));
@@ -578,19 +580,13 @@
 #endif
     connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
     connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
-    connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
 
-    updatesHeaderActionLayout->addWidget(installButton);
-    updatesHeaderActionLayout->addWidget(mQuitButton);
-    updatesHeaderSearchLayout->insertStretch(0, 1);
-    updatesHeaderSearchLayout->addWidget(searchUpdates);
-
-    updatesHeaderButtonLayout->addLayout(updatesHeaderSearchLayout);
-    updatesHeaderButtonLayout->addLayout(updatesHeaderActionLayout);
-
-    updatesHeaderLayout->addLayout(updatesHeaderTextLayout);
-    updatesHeaderLayout->insertStretch(1, 10);
-    updatesHeaderLayout->addLayout(updatesHeaderButtonLayout);
+    // addWidget(*Widget, row, column, rowspan, colspan)
+    updatesHeaderLayout->addWidget(updatesTip, 5, 0, 1, 2);
+    updatesHeaderActionButtonLayout->addWidget(installButton);
+    updatesHeaderActionButtonLayout->addWidget(mQuitButton);
+    updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1);
+    updatesHeaderLayout->setRowMinimumHeight(7, 10);
 
     /* The central panels. */
     QVBoxLayout *updatesCenterLayout = new QVBoxLayout;


More information about the Trustbridge-commits mailing list