From baedc3eed143618137134945f36b06cec10ce61e Mon Sep 17 00:00:00 2001 From: Andreas Stallinger Date: Wed, 9 Sep 2015 14:54:51 +0200 Subject: [PATCH] ui: aboutwindow changed about window that it is consistent with the other windows --- src/app/CMakeLists.txt | 2 + src/app/qt/window/QtAbout.cpp | 58 +++++++++++++++++++ src/app/qt/window/QtAbout.h | 33 +++++++++++ .../qt/window/QtApplicationSettingsScreen.cpp | 1 + src/app/qt/window/QtMainWindow.cpp | 25 +++----- src/app/qt/window/QtMainWindow.h | 2 + 6 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 src/app/qt/window/QtAbout.cpp create mode 100644 src/app/qt/window/QtAbout.h diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 59e1bbf3..eca7a4ab 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -91,6 +91,8 @@ add_files( qt/view/QtViewWidgetWrapper.cpp qt/view/QtViewWidgetWrapper.h + qt/window/QtAbout.cpp + qt/window/QtAbout.h qt/window/QtAboutLicense.cpp qt/window/QtAboutLicense.h qt/window/QtApplicationSettingsScreen.cpp diff --git a/src/app/qt/window/QtAbout.cpp b/src/app/qt/window/QtAbout.cpp new file mode 100644 index 00000000..6ae4411f --- /dev/null +++ b/src/app/qt/window/QtAbout.cpp @@ -0,0 +1,58 @@ +#include "qt/window/QtAbout.h" + +#include +#include +#include + +#include "version.h" + +QtAbout::QtAbout(QWidget *parent) + : QtSettingsWindow(parent) +{ + raise(); +} + +QSize QtAbout::sizeHint() const +{ + return QSize(500,500); +} + +void QtAbout::setup() +{ + setupForm(); + + updateTitle("About Coati"); + updateDoneButton("Ok"); + hideCancelButton(true); +} + +void QtAbout::populateForm(QFormLayout* layout) +{ + QLabel* developerLabel = new QLabel( + "\nManuel Dobusch\n" + "Eberhard Gräther\n" + "Malte Langkabel\n" + "Victoria Pfausler\n" + "Andreas Stallinger\n"); + + layout->addRow(QString("Developed by:"), developerLabel); + layout->addRow(QString("Version:"), new QLabel(GIT_VERSION_NUMBER)); + layout->addRow(QString("Branch:"), new QLabel(GIT_BRANCH)); + layout->addRow(QString("Buildtype:"), new QLabel(BUILD_TYPE)); + layout->addRow(QString("Date:"), new QLabel(GIT_COMMIT_TIME)); +} + +void QtAbout::handleCancelButtonPress() +{ + emit canceled(); +} + +void QtAbout::handleUpdateButtonPress() +{ + close(); +} + +void QtAbout::handleDoneButtonPress() +{ + close(); +} diff --git a/src/app/qt/window/QtAbout.h b/src/app/qt/window/QtAbout.h new file mode 100644 index 00000000..2d17e8ee --- /dev/null +++ b/src/app/qt/window/QtAbout.h @@ -0,0 +1,33 @@ +#ifndef QT_ABOUT_H +#define QT_ABOUT_H + +#include +#include + +#include "qt/window/QtSettingsWindow.h" + +class QtAbout + : public QtSettingsWindow +{ + Q_OBJECT + +public: + QtAbout(QWidget* parent = 0); + QSize sizeHint() const Q_DECL_OVERRIDE; + + virtual void setup() override; +protected: + virtual void populateForm(QFormLayout* layout) override; + +private slots: + void handleCancelButtonPress(); + void handleUpdateButtonPress(); + void handleDoneButtonPress(); + +private: + QPushButton* m_cancelButton; + QPushButton* m_updateButton; + +}; + +#endif //QT_ABOUT_H diff --git a/src/app/qt/window/QtApplicationSettingsScreen.cpp b/src/app/qt/window/QtApplicationSettingsScreen.cpp index d5deb5f5..e26d3ce2 100644 --- a/src/app/qt/window/QtApplicationSettingsScreen.cpp +++ b/src/app/qt/window/QtApplicationSettingsScreen.cpp @@ -12,6 +12,7 @@ QtApplicationSettingsScreen::QtApplicationSettingsScreen(QWidget *parent) : QtSettingsWindow(parent) + , m_frameworkPaths(nullptr) { raise(); } diff --git a/src/app/qt/window/QtMainWindow.cpp b/src/app/qt/window/QtMainWindow.cpp index 184317c4..30129d71 100644 --- a/src/app/qt/window/QtMainWindow.cpp +++ b/src/app/qt/window/QtMainWindow.cpp @@ -149,22 +149,10 @@ bool QtMainWindow::event(QEvent* event) void QtMainWindow::about() { - QMessageBox::about( - this, - tr("About"), - tr( - "Developed by:\n\n" - "Manuel Dobusch\n" - "Eberhard Gräther\n" - "Malte Langkabel\n" - "Victoria Pfausler\n" - "Andreas Stallinger\n" - "\nVersion: " GIT_VERSION_NUMBER - "\nBranch: " GIT_BRANCH - "\nBuildtype: " BUILD_TYPE - "\nDate: " GIT_COMMIT_TIME - ) - ); + hideScreens(); + m_aboutWindow = std::make_shared(this); + m_aboutWindow->setup(); + m_aboutWindow->show(); } void QtMainWindow::hideScreens() @@ -188,6 +176,11 @@ void QtMainWindow::hideScreens() { m_licenseWindow->hide(); } + + if(m_aboutWindow) + { + m_aboutWindow->hide(); + } } void QtMainWindow::closeScreens() diff --git a/src/app/qt/window/QtMainWindow.h b/src/app/qt/window/QtMainWindow.h index 2ecfe83d..975bc046 100644 --- a/src/app/qt/window/QtMainWindow.h +++ b/src/app/qt/window/QtMainWindow.h @@ -12,6 +12,7 @@ #include "qt/window/QtStartScreen.h" #include "qt/window/QtProjectSetupScreen.h" #include "qt/window/QtAboutLicense.h" +#include "qt/window/QtAbout.h" class QDockWidget; class View; @@ -81,6 +82,7 @@ private: std::shared_ptr m_startScreen; std::shared_ptr m_newProjectDialog; std::shared_ptr m_licenseWindow; + std::shared_ptr m_aboutWindow; std::vector> m_dockWidgets;