annotate ui/administratorwindow.cpp @ 343:e3d6de930c90

Updated the table ui in administrator app.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 10 Apr 2014 10:06:47 +0200
parents 811eec4e1b99
children 4454a4dc73a3
rev   line source
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 #include "administratorwindow.h"
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 #include <QDebug>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 #include <QMessageBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 #include <QAction>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 #include <QMenu>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 #include <QApplication>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include <QHBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QVBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QGroupBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QSplitter>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QLabel>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QImage>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QCheckBox>
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
15 #include <QHeaderView>
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
16
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
17 #include "certificatetablemodel.h"
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 AdministratorWindow::AdministratorWindow() {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 createActions();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 createMenuBar();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 createContent();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 void AdministratorWindow::createActions()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 void AdministratorWindow::createMenuBar()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 menuBar = new QMenuBar(this);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 QMenu *menu = new QMenu(tr("Menu"), menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 menuBar->addMenu(menu);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 QAction *createInstaller = menu->addAction(tr("Create Installer"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 QAction *settings = menu->addAction(tr("Settings"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 menu->addSeparator();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 QAction *help = menu->addAction(tr("Help"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 QAction *about = menu->addAction(tr("About"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 menu->addSeparator();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 QAction *quit = menu->addAction(tr("Quit"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 connect(settings, SIGNAL(triggered()), this, SLOT(showSettings()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 connect(help, SIGNAL(triggered()), this, SLOT(showHelp()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 setMenuBar(menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 void AdministratorWindow::createContent()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 // Create a central widget containing the main layout.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 QWidget *base = new QWidget;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 // Layouts and Container
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 QVBoxLayout *mainLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 QVBoxLayout *certLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 QHBoxLayout *headerLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 QVBoxLayout *headerTextLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 QHBoxLayout *bottomLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 // The certificate list
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
63 certificateView = new QTableView;
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
64 certificateModel = new CertificateTabelModel();
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
65 certificateView->setModel(certificateModel);
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
66 certificateView->setColumnWidth(0, 60);
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
67 certificateView->setColumnWidth(2, 130);
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
68 certificateView->setColumnWidth(3, 130);
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
69 certificateView->setColumnWidth(4, 200);
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
70 certificateView->setSelectionBehavior(QAbstractItemView::SelectRows);
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
71 certificateView->verticalHeader()->setVisible(false);
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
72 certLayout->addWidget(certificateView);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 certBox->setLayout(certLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 // The header (icon, about text)
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 QImage *logoImage = new QImage(":/img/logo.png");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 QLabel *logo = new QLabel;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 logo->setBackgroundRole(QPalette::Base);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 logo->setPixmap(QPixmap::fromImage(*logoImage));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 QLabel *title = new QLabel("<h2>" + tr("Administrator Application") + "</h2>");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 QLabel *subTitle = new QLabel("This Software creates a signed file containing certificates");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 headerTextLayout->addWidget(title);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 headerTextLayout->addWidget(subTitle);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 headerLayout->addWidget(logo);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 headerLayout->addLayout(headerTextLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 headerLayout->setStretch(0, 0);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 headerLayout->setStretch(1, 10);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 // The buttons.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 bottomLayout->setAlignment(Qt::AlignBottom);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 saveButton = new QPushButton(tr("Save"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 loadButton = new QPushButton(tr("Load"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 addButton = new QPushButton(tr("Add"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 removeButton = new QPushButton(tr("Remove"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 bottomLayout->addWidget(saveButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 bottomLayout->addWidget(loadButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 bottomLayout->addWidget(addButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 bottomLayout->addWidget(removeButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 bottomLayout->insertStretch(4, 10);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 mainLayout->addLayout(headerLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 mainLayout->addWidget(certBox);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 mainLayout->addLayout(bottomLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 // QMainWindow allready has a layout. All child layouts and widgets are
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 // managed in the central widget.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 base->setLayout(mainLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 setCentralWidget(base);
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
110 certificateView->horizontalHeader()->setSectionResizeMode(1,
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
111 QHeaderView::Stretch);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 void AdministratorWindow::showSettings()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 qDebug() << "show settingsdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 void AdministratorWindow::showHelp()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 qDebug() << "show helpdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 void AdministratorWindow::showAbout()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 qDebug() << "show aboutdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 void AdministratorWindow::createInstaller()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
131 qDebug() << "create Installer";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133

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