comparison 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
comparison
equal deleted inserted replaced
156:f09a0817e3bc 187:0c06a608e15f
7 #include <QDialog> 7 #include <QDialog>
8 #include <QMenu> 8 #include <QMenu>
9 #include <QApplication> 9 #include <QApplication>
10 #include <QFile> 10 #include <QFile>
11 #include <QTimer> 11 #include <QTimer>
12 #include <QHBoxLayout>
13 #include <QListWidget>
14 #include <QVBoxLayout>
15 #include <QGroupBox>
16 #include <QPushButton>
12 17
13 // The amount of time in minutes stay silent if we have 18 // The amount of time in minutes stay silent if we have
14 // something to say 19 // something to say
15 #define NAG_INTERVAL_MINUTES 2 20 #define NAG_INTERVAL_MINUTES 2
16 21
24 29
25 MainWindow::MainWindow() { 30 MainWindow::MainWindow() {
26 createActions(); 31 createActions();
27 createTrayIcon(); 32 createTrayIcon();
28 createMenuBar(); 33 createMenuBar();
34 createContent();
29 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); 35 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
30 36
31 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), 37 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
32 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); 38 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
33 39
211 connect(about, SIGNAL(triggered()), this, SLOT(showAbout())); 217 connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
212 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit())); 218 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
213 setMenuBar(mMenuBar); 219 setMenuBar(mMenuBar);
214 } 220 }
215 221
222 void MainWindow::createContent()
223 {
224 // Create a central widget containing the main layout.
225 QWidget *base = new QWidget;
226
227 QVBoxLayout *mainLayout = new QVBoxLayout;
228 QHBoxLayout *certLayout = new QHBoxLayout;
229 QHBoxLayout *bottomLayout = new QHBoxLayout;
230
231 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
232 QListWidget *certificates = new QListWidget;
233 QListWidget *details = new QListWidget;
234 certLayout->addWidget(certificates);
235 certLayout->addWidget(details);
236 certBox->setLayout(certLayout);
237
238 QPushButton *update = new QPushButton("Search for Updates");
239 connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates()));
240 bottomLayout->insertStretch(0, 10);
241 bottomLayout->addWidget(update);
242 mainLayout->addWidget(certBox);
243 mainLayout->addLayout(bottomLayout);
244
245 // QMainWindow allready has a layout. All child layouts and widgets are
246 // managed in the central widget.
247 base->setLayout(mainLayout);
248 setCentralWidget(base);
249 }
250
216 void MainWindow::showSettings() { 251 void MainWindow::showSettings() {
217 qDebug() << "show settingsdialog"; 252 qDebug() << "show settingsdialog";
218 } 253 }
219 254
220 void MainWindow::showHelp() 255 void MainWindow::showHelp()
224 259
225 void MainWindow::showAbout() 260 void MainWindow::showAbout()
226 { 261 {
227 qDebug() << "show aboutdialog"; 262 qDebug() << "show aboutdialog";
228 } 263 }
264

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