Mercurial > trustbridge
comparison ui/listupdatedialog.cpp @ 80:01286d0872ca
Add some UI in listupdatedialog
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Mar 2014 16:36:34 +0000 |
parents | f22a99f7cb69 |
children | 1f27d6db5ee3 |
comparison
equal
deleted
inserted
replaced
79:1dd8e91972a8 | 80:01286d0872ca |
---|---|
1 #include "listupdatedialog.h" | 1 #include "listupdatedialog.h" |
2 #include <QDebug> | 2 #include <QDebug> |
3 #include <QPushButton> | |
4 #include <QGroupBox> | |
5 #include <QHBoxLayout> | |
6 #include <QListWidget> | |
7 #include <QVBoxLayout> | |
8 #include "certificate.h" | |
3 | 9 |
4 ListUpdateDialog::ListUpdateDialog(QDialog *parent, | 10 ListUpdateDialog::ListUpdateDialog(QDialog *parent, |
5 const CertificateList &listToInstall) : | 11 const CertificateList &listToInstall) : |
6 QDialog(parent), | 12 QDialog(parent), |
7 mCertificateList(listToInstall) | 13 mCertificateList(listToInstall) |
10 setupGUI(); | 16 setupGUI(); |
11 } | 17 } |
12 | 18 |
13 void ListUpdateDialog::setupGUI() | 19 void ListUpdateDialog::setupGUI() |
14 { | 20 { |
21 /* Top level layout / widgets */ | |
22 QVBoxLayout *topLayout = new QVBoxLayout; | |
23 QHBoxLayout *listLayout = new QHBoxLayout; | |
24 QPushButton *executeUpdate = new QPushButton(tr("Update Stores")); | |
25 | |
26 /* The remove groups */ | |
27 QVBoxLayout *removeGroupLayout = new QVBoxLayout; | |
28 QListWidget *removeListWidget = new QListWidget; | |
29 removeGroupLayout->addWidget(removeListWidget); | |
30 QGroupBox *removeGroup = new QGroupBox(tr("Select certificates to be removed")); | |
31 removeGroup->setLayout(removeGroupLayout); | |
32 | |
33 /* The install group */ | |
34 QVBoxLayout *installGroupLayout = new QVBoxLayout; | |
35 QListWidget *installListWidget = new QListWidget; | |
36 QGroupBox *installGroup = new QGroupBox(tr("Select certificates to install")); | |
37 installGroupLayout->addWidget(installListWidget); | |
38 installGroup->setLayout(installGroupLayout); | |
39 | |
40 foreach (const Certificate& cert, mCertificateList.getInstallCertificates()) { | |
41 if (!cert.isValid()) { | |
42 qWarning() << "Invalid certificate in list"; | |
43 continue; | |
44 } | |
45 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); | |
46 item->setFlags(item->flags() | Qt::ItemIsUserCheckable); | |
47 item->setCheckState(Qt::Checked); | |
48 installListWidget->addItem(item); | |
49 } | |
50 | |
51 /* Add groups to layout */ | |
52 listLayout->addWidget(installGroup); | |
53 listLayout->addWidget(removeGroup); | |
54 | |
55 /* Fill top level layout */ | |
56 topLayout->addLayout(listLayout); | |
57 topLayout->addWidget(executeUpdate); | |
58 | |
59 setLayout(topLayout); | |
60 | |
15 return; | 61 return; |
16 } | 62 } |