Mercurial > trustbridge
changeset 333:de94c4ec22b1
Renamed management to administrator application.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 09 Apr 2014 12:41:07 +0200 |
parents | 455d6d00e896 |
children | 36be67070dcb |
files | ui/CMakeLists.txt ui/administrator.cpp ui/administratorwindow.cpp ui/administratorwindow.h ui/management.cpp ui/managementwindow.cpp ui/managementwindow.h |
diffstat | 7 files changed, 217 insertions(+), 217 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/CMakeLists.txt Tue Apr 08 15:09:13 2014 +0000 +++ b/ui/CMakeLists.txt Wed Apr 09 12:41:07 2014 +0200 @@ -27,9 +27,9 @@ ${DOWNLOADER_SOURCES} ) -set(MANAGEMENT_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/management.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/managementwindow.cpp +set(ADMINSTRATOR_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/administratorwindow.cpp ${CERTIFICATELIST_SOURCES} ) @@ -39,7 +39,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/certs.qrc ) -set(MANAGEMENT_RESOURCES +set(ADMINSTRATOR_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc ) @@ -96,11 +96,11 @@ ${EXTRA_STATIC_LIBS} ${PROFILING_LIBS}) -set(MANAGEMENT_SOURCES_WITH_RESOURCES ${MANAGEMENT_SOURCES}) -qt5_add_resources(MANAGEMENT_SOURCES_WITH_RESOURCES ${MANAGEMENT_RESOURCES}) -add_executable(management ${MANAGEMENT_SOURCES_WITH_RESOURCES}) +set(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_SOURCES}) +qt5_add_resources(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES}) +add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES}) -target_link_libraries(management Qt5::Widgets +target_link_libraries(administrator Qt5::Widgets m13_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS} @@ -110,4 +110,4 @@ add_subdirectory(tests) install(TARGETS m13ui DESTINATION bin) -install(TARGETS management DESTINATION bin) +install(TARGETS administrator DESTINATION bin)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/administrator.cpp Wed Apr 09 12:41:07 2014 +0200 @@ -0,0 +1,41 @@ +#include "administratorwindow.h" + +#include <QApplication> +#include <QtPlugin> +#include <QMessageBox> +#include <QSettings> + +#ifndef VERSION +#define VERSION "0.0.1" +#endif + +#ifndef APPNAME +#define APPNAME "administrator" +#endif + +#ifndef ORGANIZATION +#define ORGANIZATION "m13org" +#endif + +#ifdef Q_OS_WIN + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#else + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + +int main(int argc, char **argv) +{ + QApplication app (argc, argv); + + QStringList arguments = QApplication::arguments(); + + QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); + QApplication::setApplicationName(QString::fromLatin1(APPNAME)); + QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); + QSettings::setDefaultFormat(QSettings::IniFormat); + + AdministratorWindow adminWin; + adminWin.show(); + + return app.exec(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/administratorwindow.cpp Wed Apr 09 12:41:07 2014 +0200 @@ -0,0 +1,120 @@ +#include "administratorwindow.h" + +#include <QDebug> +#include <QMessageBox> +#include <QAction> +#include <QMenu> +#include <QApplication> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QGroupBox> +#include <QSplitter> +#include <QLabel> +#include <QImage> +#include <QCheckBox> + +AdministratorWindow::AdministratorWindow() { + createActions(); + createMenuBar(); + createContent(); +} + +void AdministratorWindow::createActions() +{ +} + +void AdministratorWindow::createMenuBar() +{ + menuBar = new QMenuBar(this); + QMenu *menu = new QMenu(tr("Menu"), menuBar); + menuBar->addMenu(menu); + QAction *createInstaller = menu->addAction(tr("Create Installer")); + QAction *settings = menu->addAction(tr("Settings")); + menu->addSeparator(); + QAction *help = menu->addAction(tr("Help")); + QAction *about = menu->addAction(tr("About")); + menu->addSeparator(); + QAction *quit = menu->addAction(tr("Quit")); + connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller())); + connect(settings, SIGNAL(triggered()), this, SLOT(showSettings())); + connect(help, SIGNAL(triggered()), this, SLOT(showHelp())); + connect(about, SIGNAL(triggered()), this, SLOT(showAbout())); + connect(quit, SIGNAL(triggered()), qApp, SLOT(quit())); + setMenuBar(menuBar); +} + +void AdministratorWindow::createContent() +{ + // Create a central widget containing the main layout. + QWidget *base = new QWidget; + + // Layouts and Container + QVBoxLayout *mainLayout = new QVBoxLayout; + QVBoxLayout *certLayout = new QVBoxLayout; + QHBoxLayout *headerLayout = new QHBoxLayout; + QVBoxLayout *headerTextLayout = new QVBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; + + // The certificate list + QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); + certificateList = new QListWidget(); + certLayout->addWidget(certificateList); + certBox->setLayout(certLayout); + + // The header (icon, about text) + QImage *logoImage = new QImage(":/img/logo.png"); + QLabel *logo = new QLabel; + logo->setBackgroundRole(QPalette::Base); + logo->setPixmap(QPixmap::fromImage(*logoImage)); + QLabel *title = new QLabel("<h2>" + tr("Administrator Application") + "</h2>"); + QLabel *subTitle = new QLabel("This Software creates a signed file containing certificates"); + headerTextLayout->addWidget(title); + headerTextLayout->addWidget(subTitle); + headerLayout->addWidget(logo); + headerLayout->addLayout(headerTextLayout); + headerLayout->setStretch(0, 0); + headerLayout->setStretch(1, 10); + + // The buttons. + bottomLayout->setAlignment(Qt::AlignBottom); + saveButton = new QPushButton(tr("Save")); + loadButton = new QPushButton(tr("Load")); + addButton = new QPushButton(tr("Add")); + removeButton = new QPushButton(tr("Remove")); + bottomLayout->addWidget(saveButton); + bottomLayout->addWidget(loadButton); + bottomLayout->addWidget(addButton); + bottomLayout->addWidget(removeButton); + bottomLayout->insertStretch(4, 10); + + mainLayout->addLayout(headerLayout); + mainLayout->addWidget(certBox); + mainLayout->addLayout(bottomLayout); + + + // QMainWindow allready has a layout. All child layouts and widgets are + // managed in the central widget. + base->setLayout(mainLayout); + setCentralWidget(base); +} + +void AdministratorWindow::showSettings() +{ + qDebug() << "show settingsdialog"; +} + +void AdministratorWindow::showHelp() +{ + qDebug() << "show helpdialog"; +} + +void AdministratorWindow::showAbout() +{ + qDebug() << "show aboutdialog"; +} + +void AdministratorWindow::createInstaller() +{ + qDebug() << "create Installer"; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/administratorwindow.h Wed Apr 09 12:41:07 2014 +0200 @@ -0,0 +1,47 @@ +#ifndef ADMINSTRATORWINDOW_H +#define ADMINSTRATORWINDOW_H + +/** + * @file administratorwindow.h + * @brief Administrator UI controller + */ + +#include <QMainWindow> +#include <QSettings> +#include <QMenuBar> +#include <QListWidget> +#include <QPushButton> + +class QMenu; +class QAction; + +class AdministratorWindow : public QMainWindow +{ + Q_OBJECT + +public: + AdministratorWindow(); + +private slots: + void createInstaller(); + void showSettings(); + void showHelp(); + void showAbout(); + +private: + void createActions(); + void createMenuBar(); + void createContent(); + + QSettings settings; + + QMenuBar *menuBar; + + QListWidget *certificateList; + QPushButton *saveButton; + QPushButton *loadButton; + QPushButton *addButton; + QPushButton *removeButton; +}; + +#endif // ADMINSTRATORWINDOW_H
--- a/ui/management.cpp Tue Apr 08 15:09:13 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -#include "managementwindow.h" - -#include <QApplication> -#include <QtPlugin> -#include <QMessageBox> -#include <QSettings> - -#ifndef VERSION -#define VERSION "0.0.1" -#endif - -#ifndef APPNAME -#define APPNAME "management" -#endif - -#ifndef ORGANIZATION -#define ORGANIZATION "m13org" -#endif - -#ifdef Q_OS_WIN - Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -#else - Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) -#endif - -int main(int argc, char **argv) -{ - QApplication app (argc, argv); - - QStringList arguments = QApplication::arguments(); - - QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); - QApplication::setApplicationName(QString::fromLatin1(APPNAME)); - QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); - QSettings::setDefaultFormat(QSettings::IniFormat); - - ManagementWindow mgntWin; - mgntWin.show(); - - return app.exec(); -}
--- a/ui/managementwindow.cpp Tue Apr 08 15:09:13 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -#include "managementwindow.h" - -#include <QDebug> -#include <QMessageBox> -#include <QAction> -#include <QMenu> -#include <QApplication> -#include <QHBoxLayout> -#include <QVBoxLayout> -#include <QGroupBox> -#include <QSplitter> -#include <QLabel> -#include <QImage> -#include <QCheckBox> - -ManagementWindow::ManagementWindow() { - createActions(); - createMenuBar(); - createContent(); -} - -void ManagementWindow::createActions() -{ -} - -void ManagementWindow::createMenuBar() -{ - menuBar = new QMenuBar(this); - QMenu *menu = new QMenu(tr("Menu"), menuBar); - menuBar->addMenu(menu); - QAction *createInstaller = menu->addAction(tr("Create Installer")); - QAction *settings = menu->addAction(tr("Settings")); - menu->addSeparator(); - QAction *help = menu->addAction(tr("Help")); - QAction *about = menu->addAction(tr("About")); - menu->addSeparator(); - QAction *quit = menu->addAction(tr("Quit")); - connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller())); - connect(settings, SIGNAL(triggered()), this, SLOT(showSettings())); - connect(help, SIGNAL(triggered()), this, SLOT(showHelp())); - connect(about, SIGNAL(triggered()), this, SLOT(showAbout())); - connect(quit, SIGNAL(triggered()), qApp, SLOT(quit())); - setMenuBar(menuBar); -} - -void ManagementWindow::createContent() -{ - // Create a central widget containing the main layout. - QWidget *base = new QWidget; - - // Layouts and Container - QVBoxLayout *mainLayout = new QVBoxLayout; - QVBoxLayout *certLayout = new QVBoxLayout; - QHBoxLayout *headerLayout = new QHBoxLayout; - QVBoxLayout *headerTextLayout = new QVBoxLayout; - QHBoxLayout *bottomLayout = new QHBoxLayout; - - // The certificate list - QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); - certificateList = new QListWidget; - certLayout->addWidget(certificateList); - certBox->setLayout(certLayout); - - // The header (icon, about text) - QImage *logoImage = new QImage(":/img/logo.png"); - QLabel *logo = new QLabel; - logo->setBackgroundRole(QPalette::Base); - logo->setPixmap(QPixmap::fromImage(*logoImage)); - QLabel *title = new QLabel("<h2>" + tr("Management Application") + "</h2>"); - QLabel *subTitle = new QLabel("This Software creates a signed file containing certificates"); - headerTextLayout->addWidget(title); - headerTextLayout->addWidget(subTitle); - headerLayout->addWidget(logo); - headerLayout->addLayout(headerTextLayout); - headerLayout->setStretch(0, 0); - headerLayout->setStretch(1, 10); - - // The buttons. - bottomLayout->setAlignment(Qt::AlignBottom); - saveButton = new QPushButton(tr("Save")); - loadButton = new QPushButton(tr("Load")); - addButton = new QPushButton(tr("Add")); - removeButton = new QPushButton(tr("Remove")); - bottomLayout->addWidget(saveButton); - bottomLayout->addWidget(loadButton); - bottomLayout->addWidget(addButton); - bottomLayout->addWidget(removeButton); - bottomLayout->insertStretch(4, 10); - - mainLayout->addLayout(headerLayout); - mainLayout->addWidget(certBox); - mainLayout->addLayout(bottomLayout); - - - // QMainWindow allready has a layout. All child layouts and widgets are - // managed in the central widget. - base->setLayout(mainLayout); - setCentralWidget(base); -} - -void ManagementWindow::showSettings() -{ - qDebug() << "show settingsdialog"; -} - -void ManagementWindow::showHelp() -{ - qDebug() << "show helpdialog"; -} - -void ManagementWindow::showAbout() -{ - qDebug() << "show aboutdialog"; -} - -void ManagementWindow::createInstaller() -{ - qDebug() << "create Installer"; -} -
--- a/ui/managementwindow.h Tue Apr 08 15:09:13 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#ifndef MANAGEMENTWINDOW_H -#define MANAGEMENTWINDOW_H - -/** - * @file managementwindow.h - * @brief Management UI controller - */ - -#include <QMainWindow> -#include <QSettings> -#include <QMenuBar> -#include <QListWidget> -#include <QPushButton> - -class QMenu; -class QAction; - -class ManagementWindow : public QMainWindow -{ - Q_OBJECT - -public: - ManagementWindow(); - -private slots: - void createInstaller(); - void showSettings(); - void showHelp(); - void showAbout(); - -private: - void createActions(); - void createMenuBar(); - void createContent(); - - QSettings settings; - - QMenuBar *menuBar; - - QListWidget *certificateList; - QPushButton *saveButton; - QPushButton *loadButton; - QPushButton *addButton; - QPushButton *removeButton; -}; - -#endif // MANAGEMENTWINDOW_H