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