annotate ui/managementwindow.cpp @ 330:1e6d1eab8395

Fix NSS unit test for Windows and change how instructions are written This was supposed to fix the block on error. But it did not.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 08 Apr 2014 15:08:57 +0000
parents 3261b2a9cab7
children
rev   line source
327
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 #include "managementwindow.h"
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 #include <QDebug>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 #include <QMessageBox>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 #include <QAction>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 #include <QMenu>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 #include <QApplication>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include <QHBoxLayout>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QVBoxLayout>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QGroupBox>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QSplitter>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QLabel>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QImage>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QCheckBox>
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 ManagementWindow::ManagementWindow() {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 createActions();
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 createMenuBar();
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 createContent();
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 void ManagementWindow::createActions()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 void ManagementWindow::createMenuBar()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 menuBar = new QMenuBar(this);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 QMenu *menu = new QMenu(tr("Menu"), menuBar);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 menuBar->addMenu(menu);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 QAction *createInstaller = menu->addAction(tr("Create Installer"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 QAction *settings = menu->addAction(tr("Settings"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 menu->addSeparator();
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 QAction *help = menu->addAction(tr("Help"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 QAction *about = menu->addAction(tr("About"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 menu->addSeparator();
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 QAction *quit = menu->addAction(tr("Quit"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller()));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 connect(settings, SIGNAL(triggered()), this, SLOT(showSettings()));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 connect(help, SIGNAL(triggered()), this, SLOT(showHelp()));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 setMenuBar(menuBar);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 void ManagementWindow::createContent()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 // Create a central widget containing the main layout.
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 QWidget *base = new QWidget;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 // Layouts and Container
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 QVBoxLayout *mainLayout = new QVBoxLayout;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 QVBoxLayout *certLayout = new QVBoxLayout;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 QHBoxLayout *headerLayout = new QHBoxLayout;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 QVBoxLayout *headerTextLayout = new QVBoxLayout;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 QHBoxLayout *bottomLayout = new QHBoxLayout;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 // The certificate list
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 certificateList = new QListWidget;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 certLayout->addWidget(certificateList);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 certBox->setLayout(certLayout);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 // The header (icon, about text)
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 QImage *logoImage = new QImage(":/img/logo.png");
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 QLabel *logo = new QLabel;
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 logo->setBackgroundRole(QPalette::Base);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 logo->setPixmap(QPixmap::fromImage(*logoImage));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 QLabel *title = new QLabel("<h2>" + tr("Management Application") + "</h2>");
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 QLabel *subTitle = new QLabel("This Software creates a signed file containing certificates");
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 headerTextLayout->addWidget(title);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 headerTextLayout->addWidget(subTitle);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 headerLayout->addWidget(logo);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 headerLayout->addLayout(headerTextLayout);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 headerLayout->setStretch(0, 0);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 headerLayout->setStretch(1, 10);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 // The buttons.
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 bottomLayout->setAlignment(Qt::AlignBottom);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 saveButton = new QPushButton(tr("Save"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 loadButton = new QPushButton(tr("Load"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 addButton = new QPushButton(tr("Add"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 removeButton = new QPushButton(tr("Remove"));
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 bottomLayout->addWidget(saveButton);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 bottomLayout->addWidget(loadButton);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 bottomLayout->addWidget(addButton);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 bottomLayout->addWidget(removeButton);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 bottomLayout->insertStretch(4, 10);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 mainLayout->addLayout(headerLayout);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 mainLayout->addWidget(certBox);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 mainLayout->addLayout(bottomLayout);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 // QMainWindow allready has a layout. All child layouts and widgets are
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 // managed in the central widget.
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 base->setLayout(mainLayout);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 setCentralWidget(base);
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 void ManagementWindow::showSettings()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 qDebug() << "show settingsdialog";
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 void ManagementWindow::showHelp()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 qDebug() << "show helpdialog";
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 void ManagementWindow::showAbout()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 qDebug() << "show aboutdialog";
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 void ManagementWindow::createInstaller()
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 {
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 qDebug() << "create Installer";
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 }
3261b2a9cab7 Added a first version of the management application gui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120

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