diff --git a/GUI/coregui/mainwindow/aboutapplicationdialog.cpp b/GUI/coregui/mainwindow/aboutapplicationdialog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecbba2f576c99306481fe0603a0de16be04a2ca0 --- /dev/null +++ b/GUI/coregui/mainwindow/aboutapplicationdialog.cpp @@ -0,0 +1,81 @@ +#include "aboutapplicationdialog.h" +#include "mainwindow_constants.h" +#include <QLabel> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QPushButton> + +#include <iostream> + +AboutApplicationDialog::AboutApplicationDialog(QWidget *parent) + : QDialog(parent) + +{ + QColor bgColor(240,240,240,255); + QPalette palette; + palette.setColor(QPalette::Background, bgColor); + setAutoFillBackground(true); + setPalette(palette); + + setFixedSize(450, 230); + setWindowTitle("About BornAgain"); + + //setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); + setWindowFlags( Qt::Dialog ); + + + QFont titleFont; + titleFont.setPointSize(18); + titleFont.setBold(true); + + QFont normalFont; + titleFont.setPointSize(14); + titleFont.setBold(false); + + + QPixmap logo(":/images/BornAgain.ico"); + QLabel *logoLabel = new QLabel; + logoLabel->setPixmap(logo.scaled(120,120,Qt::KeepAspectRatio)); + + + QLabel *aboutTitleLabel = new QLabel(QString(Constants::APPLICATION_NAME).append(" ").append(Constants::APPLICATION_VERSION)); + aboutTitleLabel->setFont(titleFont); + + QString description = "A software to simulate and fit grazing-incidence small-angle scattering (GISAS), using distorted-wave Born approximation (DWBA). The software equally supports neutron and x-ray scattering (GISANS and GISAXS)."; + QLabel *descriptionLabel = new QLabel(description); + descriptionLabel->setFont(normalFont); + descriptionLabel->setWordWrap(true); + + QVBoxLayout *logoLayout = new QVBoxLayout; + logoLayout->addWidget(logoLabel); + logoLayout->addStretch(1); + logoLayout->setContentsMargins(15,15,15,15); + + QVBoxLayout *textLayout = new QVBoxLayout; + textLayout->addWidget(aboutTitleLabel); + textLayout->addWidget(descriptionLabel); + textLayout->addStretch(1); + textLayout->setContentsMargins(0,15,5,5); + + + QHBoxLayout *detailsLayout = new QHBoxLayout; + detailsLayout->addLayout(logoLayout); + detailsLayout->addLayout(textLayout); + + + m_closeButton = new QPushButton(tr("Close")); + connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject())); + + QHBoxLayout *buttonsLayout = new QHBoxLayout; + buttonsLayout->addStretch(1); + buttonsLayout->addWidget(m_closeButton); + + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addLayout(detailsLayout); + mainLayout->addLayout(buttonsLayout); + + setLayout(mainLayout); +} + + diff --git a/GUI/coregui/mainwindow/aboutapplicationdialog.h b/GUI/coregui/mainwindow/aboutapplicationdialog.h new file mode 100644 index 0000000000000000000000000000000000000000..1debf9ca4f0512c160883aff97a83a3914c21d96 --- /dev/null +++ b/GUI/coregui/mainwindow/aboutapplicationdialog.h @@ -0,0 +1,29 @@ +#ifndef ABOUTAPPLICATIONDIALOG_H +#define ABOUTAPPLICATIONDIALOG_H + +#include "WinDllMacros.h" +#include <QDialog> +#include <QString> + + +class QLabel; +class QPushButton; +class QStatusBar; +class QPalette; + + +//! new project dialog window +class BA_CORE_API_ AboutApplicationDialog : public QDialog +{ + Q_OBJECT +public: + AboutApplicationDialog(QWidget *parent = 0); + + +private: + QPushButton *m_closeButton; + +}; + + +#endif diff --git a/GUI/coregui/mainwindow/actionmanager.cpp b/GUI/coregui/mainwindow/actionmanager.cpp index cfa79c1c4be7cc63372e53aa70998f632aedf9a6..10681abc7d2e032d210453ad932e61be24511ef4 100644 --- a/GUI/coregui/mainwindow/actionmanager.cpp +++ b/GUI/coregui/mainwindow/actionmanager.cpp @@ -65,6 +65,13 @@ void ActionManager::createActions() m_exitAction->setStatusTip(tr("Exit the application")); connect(m_exitAction, SIGNAL(triggered()), m_mainWindow, SLOT(close())); + // about application action + icon = QIcon::fromTheme(QLatin1String("help-about")); + m_aboutAction = new QAction(icon, tr("About &BornAgain"), this); + //m_aboutAction->setShortcuts(QKeySequence::HelpContents); + m_aboutAction->setStatusTip(tr("About the application")); + connect(m_aboutAction, SIGNAL(triggered()), m_mainWindow, SLOT(onAboutApplication())); + } @@ -91,6 +98,7 @@ void ActionManager::createMenus() // Help Menu m_helpMenu = m_menuBar->addMenu(tr("&Help")); + m_helpMenu->addAction(m_aboutAction); } diff --git a/GUI/coregui/mainwindow/actionmanager.h b/GUI/coregui/mainwindow/actionmanager.h index 02d11d3693a35da8a94c10b210df44820a4cbf24..a52b9786839e0d1a31790b7f26dacc855d89ca53 100644 --- a/GUI/coregui/mainwindow/actionmanager.h +++ b/GUI/coregui/mainwindow/actionmanager.h @@ -30,6 +30,7 @@ private: QAction *m_openAction; QAction *m_saveAction; QAction *m_exitAction; + QAction *m_aboutAction; QList<QAction *> m_recentProjectActions; QMenuBar *m_menuBar; diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index fe519b316b6e283ed8c60f92ae95e19f162f9f6c..81549e7e6cc3a0b022c2178e03daf03dbe88313f 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -40,6 +40,7 @@ #include "ScientificDoubleProperty.h" #include "SampleModel.h" #include "JobView.h" +#include "aboutapplicationdialog.h" #include <boost/scoped_ptr.hpp> #include <QApplication> @@ -312,3 +313,9 @@ void MainWindow::testGUIObjectBuilder() guiBuilder.populateSampleModel(m_sampleModel, sample.get()); } +void MainWindow::onAboutApplication() +{ + AboutApplicationDialog dialog(this); + dialog.exec(); +} + diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index d07d0adbc179a843e24afcfc54d3f0d10e84e84d..8a26e2dc9e78cadb362d89b226cb3535479ca286 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -57,6 +57,7 @@ public slots: void readSettings(); void writeSettings(); void onRunSimulationShortcut(); + void onAboutApplication(); protected: virtual void closeEvent(QCloseEvent *event);