comparison ui/administratorwindow.cpp @ 333:de94c4ec22b1

Renamed management to administrator application.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 09 Apr 2014 12:41:07 +0200
parents
children 811eec4e1b99
comparison
equal deleted inserted replaced
331:455d6d00e896 333:de94c4ec22b1
1 #include "administratorwindow.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 AdministratorWindow::AdministratorWindow() {
17 createActions();
18 createMenuBar();
19 createContent();
20 }
21
22 void AdministratorWindow::createActions()
23 {
24 }
25
26 void AdministratorWindow::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 AdministratorWindow::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("Administrator 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 AdministratorWindow::showSettings()
102 {
103 qDebug() << "show settingsdialog";
104 }
105
106 void AdministratorWindow::showHelp()
107 {
108 qDebug() << "show helpdialog";
109 }
110
111 void AdministratorWindow::showAbout()
112 {
113 qDebug() << "show aboutdialog";
114 }
115
116 void AdministratorWindow::createInstaller()
117 {
118 qDebug() << "create Installer";
119 }
120

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