Skip to content
Snippets Groups Projects
Commit 60e1ec67 authored by Mohammad Mahadi Hasan's avatar Mohammad Mahadi Hasan
Browse files

added "About BornAgain" dialog widget

parent 1e2b3365
No related branches found
No related tags found
No related merge requests found
#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);
}
#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
......@@ -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);
}
......
......@@ -30,6 +30,7 @@ private:
QAction *m_openAction;
QAction *m_saveAction;
QAction *m_exitAction;
QAction *m_aboutAction;
QList<QAction *> m_recentProjectActions;
QMenuBar *m_menuBar;
......
......@@ -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();
}
......@@ -57,6 +57,7 @@ public slots:
void readSettings();
void writeSettings();
void onRunSimulationShortcut();
void onAboutApplication();
protected:
virtual void closeEvent(QCloseEvent *event);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment