changeset 709:8f110e6b8295

(UI) Changed update header to GridLayout and moved action buttons to bottom left.
author Emanuel Schuetze <emanuel@intevation.de>
date Wed, 02 Jul 2014 13:09:09 +0200
parents bd48fae793b6
children 86c9ff4cfb02
files ui/mainwindow.cpp
diffstat 1 files changed, 27 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- 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;

http://wald.intevation.org/projects/trustbridge/