annotate 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
rev   line source
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 #include "listupdatedialog.h"
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 #include <QDebug>
80
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
3 #include <QPushButton>
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
4 #include <QGroupBox>
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
5 #include <QHBoxLayout>
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
6 #include <QListWidget>
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
7 #include <QVBoxLayout>
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
8 #include "certificate.h"
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 ListUpdateDialog::ListUpdateDialog(QDialog *parent,
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11 const CertificateList &listToInstall) :
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
12 QDialog(parent),
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 mCertificateList(listToInstall)
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 {
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15 qDebug() << "I am a happy list update dialog";
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 setupGUI();
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 }
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
18
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 void ListUpdateDialog::setupGUI()
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20 {
80
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
21 /* Top level layout / widgets */
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
22 QVBoxLayout *topLayout = new QVBoxLayout;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
23 QHBoxLayout *listLayout = new QHBoxLayout;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
24 QPushButton *executeUpdate = new QPushButton(tr("Update Stores"));
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
25
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
26 /* The remove groups */
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
27 QVBoxLayout *removeGroupLayout = new QVBoxLayout;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
28 QListWidget *removeListWidget = new QListWidget;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
29 removeGroupLayout->addWidget(removeListWidget);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
30 QGroupBox *removeGroup = new QGroupBox(tr("Select certificates to be removed"));
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
31 removeGroup->setLayout(removeGroupLayout);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
32
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
33 /* The install group */
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
34 QVBoxLayout *installGroupLayout = new QVBoxLayout;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
35 QListWidget *installListWidget = new QListWidget;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
36 QGroupBox *installGroup = new QGroupBox(tr("Select certificates to install"));
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
37 installGroupLayout->addWidget(installListWidget);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
38 installGroup->setLayout(installGroupLayout);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
39
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
40 foreach (const Certificate& cert, mCertificateList.getInstallCertificates()) {
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
41 if (!cert.isValid()) {
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
42 qWarning() << "Invalid certificate in list";
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
43 continue;
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
44 }
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
45 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
46 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
47 item->setCheckState(Qt::Checked);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
48 installListWidget->addItem(item);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
49 }
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
50
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
51 /* Add groups to layout */
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
52 listLayout->addWidget(installGroup);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
53 listLayout->addWidget(removeGroup);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
54
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
55 /* Fill top level layout */
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
56 topLayout->addLayout(listLayout);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
57 topLayout->addWidget(executeUpdate);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
58
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
59 setLayout(topLayout);
01286d0872ca Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
60
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
61 return;
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 }

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