diff ui/mainwindow.cpp @ 250:1e112cf41e92

Updated the mainwindow layout.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 31 Mar 2014 11:41:43 +0200
parents 6a7eb102716d
children ffd47b045d19
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Mon Mar 31 08:06:17 2014 +0000
+++ b/ui/mainwindow.cpp	Mon Mar 31 11:41:43 2014 +0200
@@ -16,6 +16,7 @@
 #include <QSplitter>
 #include <QLabel>
 #include <QImage>
+#include <QCheckBox>
 
 // The amount of time in minutes stay silent if we have
 // something to say
@@ -232,12 +233,24 @@
     // Create a central widget containing the main layout.
     QWidget *base = new QWidget;
 
-    QVBoxLayout *mainLayout = new QVBoxLayout;
+    // Layouts and Container
+    QHBoxLayout *mainLayout = new QHBoxLayout;
+    QVBoxLayout *infoLayout = new QVBoxLayout;
+    QVBoxLayout *certLayout = new QVBoxLayout;
     QHBoxLayout *headerLayout = new QHBoxLayout;
     QVBoxLayout *headerTextLayout = new QVBoxLayout;
-    QHBoxLayout *certLayout = new QHBoxLayout;
-    QHBoxLayout *bottomLayout = new QHBoxLayout;
+    QVBoxLayout *toolLayout = new QVBoxLayout;
+    QHBoxLayout *toolButtonLayout = new QHBoxLayout;
 
+    // The certificate list
+    QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
+    certificateList = new QListWidget;
+    connect(certificateList, SIGNAL(itemClicked(QListWidgetItem*)),
+        this, SLOT(showDetails(QListWidgetItem*)));
+    certLayout->addWidget(certificateList);
+    certBox->setLayout(certLayout);
+
+    // The header (icon, about text)
     QImage *logoImage = new QImage(":/img/logo.png");
     QLabel *logo = new QLabel;
     logo->setBackgroundRole(QPalette::Base);
@@ -251,27 +264,32 @@
     headerLayout->setStretch(0, 0);
     headerLayout->setStretch(1, 10);
 
-    QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
-    certificateList = new QListWidget;
-    connect(certificateList, SIGNAL(itemClicked(QListWidgetItem*)),
-        this, SLOT(showDetails(QListWidgetItem*)));
+    // The tools to update the certificate list/software and install
+    // certificates.
+    QCheckBox *autoUpdateOption = new QCheckBox(tr("autoupdate"));
+    toolLayout->addWidget(autoUpdateOption);
+//    connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate()));
+    QPushButton *update = new QPushButton(tr("Search for Updates"));
+    connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates()));
+    QPushButton *install = new QPushButton(tr("Install selected"));
+//    connect(update, SIGNAL(clicked()), this, SLOT(installCertificates()));
+    toolButtonLayout->addWidget(update);
+    toolButtonLayout->addWidget(install);
+    toolButtonLayout->insertStretch(2, 10);
+    toolLayout->addLayout(toolButtonLayout);
+
+    // The certificate details
     certificateDetails = new QTextEdit;
     certificateDetails->setReadOnly(true);
-    QSplitter *splitter = new QSplitter(certBox);
-    splitter->addWidget(certificateList);
-    splitter->addWidget(certificateDetails);
-    certLayout->addWidget(splitter);
-    certBox->setLayout(certLayout);
 
-    QPushButton *update = new QPushButton("Search for Updates");
-    connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates()));
-    bottomLayout->insertStretch(0, 10);
-    bottomLayout->addWidget(update);
-    mainLayout->addLayout(headerLayout);
+    infoLayout->addSpacing(20);
+    infoLayout->addLayout(headerLayout);
+    infoLayout->addLayout(toolLayout);
+    infoLayout->addWidget(certificateDetails);
+
     mainLayout->addWidget(certBox);
-    mainLayout->addLayout(bottomLayout);
-    mainLayout->setStretch(0, 0);
-    mainLayout->setStretch(1, 10);
+    mainLayout->addLayout(infoLayout);
+
 
     // QMainWindow allready has a layout. All child layouts and widgets are
     // managed in the central widget.

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