diff ui/mainwindow.cpp @ 187:0c06a608e15f

Create the mainwindow content.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 26 Mar 2014 09:10:46 +0100
parents c0fdb8d336cf
children 5f0d45ca9de4
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Mar 25 09:23:47 2014 +0100
+++ b/ui/mainwindow.cpp	Wed Mar 26 09:10:46 2014 +0100
@@ -9,6 +9,11 @@
 #include <QApplication>
 #include <QFile>
 #include <QTimer>
+#include <QHBoxLayout>
+#include <QListWidget>
+#include <QVBoxLayout>
+#include <QGroupBox>
+#include <QPushButton>
 
 // The amount of time in minutes stay silent if we have
 // something to say
@@ -26,6 +31,7 @@
     createActions();
     createTrayIcon();
     createMenuBar();
+    createContent();
     qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
 
     connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
@@ -213,6 +219,35 @@
     setMenuBar(mMenuBar);
 }
 
+void MainWindow::createContent()
+{
+    // Create a central widget containing the main layout.
+    QWidget *base = new QWidget;
+
+    QVBoxLayout *mainLayout = new QVBoxLayout;
+    QHBoxLayout *certLayout = new QHBoxLayout;
+    QHBoxLayout *bottomLayout = new QHBoxLayout;
+
+    QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
+    QListWidget *certificates = new QListWidget;
+    QListWidget *details = new QListWidget;
+    certLayout->addWidget(certificates);
+    certLayout->addWidget(details);
+    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->addWidget(certBox);
+    mainLayout->addLayout(bottomLayout);
+
+    // QMainWindow allready has a layout. All child layouts and widgets are
+    // managed in the central widget.
+    base->setLayout(mainLayout);
+    setCentralWidget(base);
+}
+
 void MainWindow::showSettings() {
     qDebug() << "show settingsdialog";
 }
@@ -226,3 +261,4 @@
 {
     qDebug() << "show aboutdialog";
 }
+

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