BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
AboutDialog Class Reference

Description

About BornAgain dialog.

Definition at line 24 of file AboutDialog.h.

Inheritance diagram for AboutDialog:
[legend]
Collaboration diagram for AboutDialog:
[legend]

Public Member Functions

 AboutDialog (QWidget *parent=nullptr)
 

Private Member Functions

QBoxLayout * createButtonLayout ()
 
QBoxLayout * createLogoLayout ()
 
QBoxLayout * createTextLayout ()
 

Constructor & Destructor Documentation

◆ AboutDialog()

AboutDialog::AboutDialog ( QWidget *  parent = nullptr)

Definition at line 46 of file AboutDialog.cpp.

47  : QDialog(parent)
48 {
49  QColor bgColor(240, 240, 240, 255);
50  QPalette palette;
51  palette.setColor(QPalette::Window, bgColor);
52  setAutoFillBackground(true);
53  setPalette(palette);
54 
55  setWindowTitle("About BornAgain");
56  setWindowFlags(Qt::Dialog);
57 
58  auto* detailsLayout = new QHBoxLayout;
59  detailsLayout->addLayout(createLogoLayout());
60  detailsLayout->addLayout(createTextLayout());
61 
62  auto* mainLayout = new QVBoxLayout;
63  mainLayout->addLayout(detailsLayout);
64  mainLayout->addLayout(createButtonLayout());
65 
66  setLayout(mainLayout);
67 }
QBoxLayout * createButtonLayout()
QBoxLayout * createTextLayout()
Definition: AboutDialog.cpp:84
QBoxLayout * createLogoLayout()
Definition: AboutDialog.cpp:69

References createButtonLayout(), createLogoLayout(), and createTextLayout().

Here is the call graph for this function:

Member Function Documentation

◆ createButtonLayout()

QBoxLayout * AboutDialog::createButtonLayout ( )
private

Definition at line 141 of file AboutDialog.cpp.

142 {
143  auto* result = new QHBoxLayout;
144 
145  auto* closeButton = new QPushButton("Close");
146  connect(closeButton, &QPushButton::clicked, this, &QDialog::reject);
147 
148  result->addStretch(1);
149  result->addWidget(closeButton);
150 
151  static const char mydata[] = {0x64, 0x65, 0x76, 0x73};
152  QByteArray b = QByteArray::fromRawData(mydata, sizeof(mydata));
153  auto* f = new ShortcodeFilter(b, this);
154  connect(f, &ShortcodeFilter::found, this, [=]() { layout()->addWidget(createLogoLabel()); });
155  installEventFilter(f);
156 
157  return result;
158 }
Event filter for global tracking of shortcodes.

References ShortcodeFilter::found().

Referenced by AboutDialog().

◆ createLogoLayout()

QBoxLayout * AboutDialog::createLogoLayout ( )
private

Definition at line 69 of file AboutDialog.cpp.

70 {
71  auto* result = new QVBoxLayout;
72 
73  QPixmap logo(":/images/about_icon.png");
74  auto* label = new QLabel;
75  label->setPixmap(logo.scaled(120, 120, Qt::KeepAspectRatio));
76 
77  result->addWidget(label);
78  result->addStretch(1);
79  result->setContentsMargins(5, 5, 5, 5);
80 
81  return result;
82 }

Referenced by AboutDialog().

◆ createTextLayout()

QBoxLayout * AboutDialog::createTextLayout ( )
private

Definition at line 84 of file AboutDialog.cpp.

85 {
86  auto* result = new QVBoxLayout;
87 
88  QFont titleFont;
89  titleFont.setPointSize(DesignerHelper::getLabelFontSize() + 2);
90  titleFont.setBold(true);
91 
92  QFont normalFont;
93  normalFont.setPointSize(DesignerHelper::getLabelFontSize() + 2);
94  normalFont.setBold(false);
95 
96  // title
97  auto* aboutTitleLabel =
98  new QLabel("BornAgain version " + GUI::Util::Path::getBornAgainVersionString());
99  aboutTitleLabel->setFont(titleFont);
100 
101  // description
102  QString description = "Open-source research software to simulate and fit neutron and x-ray"
103  " reflectometry and grazing-incidence small-angle scattering.";
104  auto* descriptionLabel = new QLabel(description);
105  descriptionLabel->setFont(normalFont);
106  descriptionLabel->setWordWrap(true);
107 
108  // copyright
109  auto* copyrightLabel = new QLabel("Copyright: Forschungszentrum Jülich GmbH 2012-"
110  + QDate::currentDate().toString("yyyy") + ".");
111  copyrightLabel->setFont(normalFont);
112 
113  // home page
114  auto* homepageLabel = createLinkLabel(
115  "Homepage: "
116  " <a href=\"https://www.bornagainproject.org\">www.bornagainproject.org</a>.");
117  homepageLabel->setFont(normalFont);
118 
119  // mailing list
120  auto* mailingLabel = createLinkLabel(
121  "For updates, subscribe to <a "
122  "href = \"https://lists.fz-juelich.de/mailman/listinfo/BornAgain-announcements\">"
123  "bornagain-announcements</a>.");
124  mailingLabel->setFont(normalFont);
125  mailingLabel->setWordWrap(true);
126 
127  result->addWidget(aboutTitleLabel);
128  result->addStretch(1);
129  result->addWidget(descriptionLabel);
130  result->addStretch(1);
131  result->addWidget(copyrightLabel);
132  result->addStretch(1);
133  result->addWidget(homepageLabel);
134  result->addStretch(1);
135  result->addWidget(mailingLabel);
136  result->addStretch(1);
137 
138  return result;
139 }
static int getLabelFontSize()
QString getBornAgainVersionString()
Definition: Path.cpp:60
QString toString(const QModelIndex &index)
Provides string representation of index data.

References GUI::Util::Path::getBornAgainVersionString(), DesignerHelper::getLabelFontSize(), and GUI::View::PropertyEditorFactory::toString().

Referenced by AboutDialog().

Here is the call graph for this function:

The documentation for this class was generated from the following files: