Mercurial > trustbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
249:6a7eb102716d | 250:1e112cf41e92 |
---|---|
14 #include <QGroupBox> | 14 #include <QGroupBox> |
15 #include <QPushButton> | 15 #include <QPushButton> |
16 #include <QSplitter> | 16 #include <QSplitter> |
17 #include <QLabel> | 17 #include <QLabel> |
18 #include <QImage> | 18 #include <QImage> |
19 #include <QCheckBox> | |
19 | 20 |
20 // The amount of time in minutes stay silent if we have | 21 // The amount of time in minutes stay silent if we have |
21 // something to say | 22 // something to say |
22 #define NAG_INTERVAL_MINUTES 2 | 23 #define NAG_INTERVAL_MINUTES 2 |
23 | 24 |
230 void MainWindow::createContent() | 231 void MainWindow::createContent() |
231 { | 232 { |
232 // Create a central widget containing the main layout. | 233 // Create a central widget containing the main layout. |
233 QWidget *base = new QWidget; | 234 QWidget *base = new QWidget; |
234 | 235 |
235 QVBoxLayout *mainLayout = new QVBoxLayout; | 236 // Layouts and Container |
237 QHBoxLayout *mainLayout = new QHBoxLayout; | |
238 QVBoxLayout *infoLayout = new QVBoxLayout; | |
239 QVBoxLayout *certLayout = new QVBoxLayout; | |
236 QHBoxLayout *headerLayout = new QHBoxLayout; | 240 QHBoxLayout *headerLayout = new QHBoxLayout; |
237 QVBoxLayout *headerTextLayout = new QVBoxLayout; | 241 QVBoxLayout *headerTextLayout = new QVBoxLayout; |
238 QHBoxLayout *certLayout = new QHBoxLayout; | 242 QVBoxLayout *toolLayout = new QVBoxLayout; |
239 QHBoxLayout *bottomLayout = new QHBoxLayout; | 243 QHBoxLayout *toolButtonLayout = new QHBoxLayout; |
240 | 244 |
245 // The certificate list | |
246 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); | |
247 certificateList = new QListWidget; | |
248 connect(certificateList, SIGNAL(itemClicked(QListWidgetItem*)), | |
249 this, SLOT(showDetails(QListWidgetItem*))); | |
250 certLayout->addWidget(certificateList); | |
251 certBox->setLayout(certLayout); | |
252 | |
253 // The header (icon, about text) | |
241 QImage *logoImage = new QImage(":/img/logo.png"); | 254 QImage *logoImage = new QImage(":/img/logo.png"); |
242 QLabel *logo = new QLabel; | 255 QLabel *logo = new QLabel; |
243 logo->setBackgroundRole(QPalette::Base); | 256 logo->setBackgroundRole(QPalette::Base); |
244 logo->setPixmap(QPixmap::fromImage(*logoImage)); | 257 logo->setPixmap(QPixmap::fromImage(*logoImage)); |
245 QLabel *title = new QLabel("<h2>" + tr("Certificate Installer") + "</h2>"); | 258 QLabel *title = new QLabel("<h2>" + tr("Certificate Installer") + "</h2>"); |
249 headerLayout->addWidget(logo); | 262 headerLayout->addWidget(logo); |
250 headerLayout->addLayout(headerTextLayout); | 263 headerLayout->addLayout(headerTextLayout); |
251 headerLayout->setStretch(0, 0); | 264 headerLayout->setStretch(0, 0); |
252 headerLayout->setStretch(1, 10); | 265 headerLayout->setStretch(1, 10); |
253 | 266 |
254 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); | 267 // The tools to update the certificate list/software and install |
255 certificateList = new QListWidget; | 268 // certificates. |
256 connect(certificateList, SIGNAL(itemClicked(QListWidgetItem*)), | 269 QCheckBox *autoUpdateOption = new QCheckBox(tr("autoupdate")); |
257 this, SLOT(showDetails(QListWidgetItem*))); | 270 toolLayout->addWidget(autoUpdateOption); |
271 // connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); | |
272 QPushButton *update = new QPushButton(tr("Search for Updates")); | |
273 connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates())); | |
274 QPushButton *install = new QPushButton(tr("Install selected")); | |
275 // connect(update, SIGNAL(clicked()), this, SLOT(installCertificates())); | |
276 toolButtonLayout->addWidget(update); | |
277 toolButtonLayout->addWidget(install); | |
278 toolButtonLayout->insertStretch(2, 10); | |
279 toolLayout->addLayout(toolButtonLayout); | |
280 | |
281 // The certificate details | |
258 certificateDetails = new QTextEdit; | 282 certificateDetails = new QTextEdit; |
259 certificateDetails->setReadOnly(true); | 283 certificateDetails->setReadOnly(true); |
260 QSplitter *splitter = new QSplitter(certBox); | 284 |
261 splitter->addWidget(certificateList); | 285 infoLayout->addSpacing(20); |
262 splitter->addWidget(certificateDetails); | 286 infoLayout->addLayout(headerLayout); |
263 certLayout->addWidget(splitter); | 287 infoLayout->addLayout(toolLayout); |
264 certBox->setLayout(certLayout); | 288 infoLayout->addWidget(certificateDetails); |
265 | 289 |
266 QPushButton *update = new QPushButton("Search for Updates"); | |
267 connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates())); | |
268 bottomLayout->insertStretch(0, 10); | |
269 bottomLayout->addWidget(update); | |
270 mainLayout->addLayout(headerLayout); | |
271 mainLayout->addWidget(certBox); | 290 mainLayout->addWidget(certBox); |
272 mainLayout->addLayout(bottomLayout); | 291 mainLayout->addLayout(infoLayout); |
273 mainLayout->setStretch(0, 0); | 292 |
274 mainLayout->setStretch(1, 10); | |
275 | 293 |
276 // QMainWindow allready has a layout. All child layouts and widgets are | 294 // QMainWindow allready has a layout. All child layouts and widgets are |
277 // managed in the central widget. | 295 // managed in the central widget. |
278 base->setLayout(mainLayout); | 296 base->setLayout(mainLayout); |
279 setCentralWidget(base); | 297 setCentralWidget(base); |