SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
aboutdialog.cpp
Go to the documentation of this file.
1#include "aboutdialog.h"
2#include <QApplication>
3#include <QScreen>
4#include <QFont>
5#include <QFrame>
6
8 : QDialog(parent),
9 versionLabel(nullptr),
10 buildDateLabel(nullptr),
11 descriptionBrowser(nullptr)
12{
13 setupUI();
14}
15
17{
18 setWindowTitle(tr("About SedSat3"));
19 setModal(true);
20 setMinimumSize(500, 400);
21 resize(600, 500);
22
23 // Main layout
24 QVBoxLayout* mainLayout = new QVBoxLayout(this);
25 mainLayout->setSpacing(0);
26 mainLayout->setContentsMargins(0, 0, 0, 0);
27
28 // Add sections
29 mainLayout->addWidget(createHeader());
30 mainLayout->addWidget(createInfoSection());
31 mainLayout->addWidget(createDescriptionSection(), 1); // Stretch factor 1
32 mainLayout->addWidget(createFooter());
33
34 setLayout(mainLayout);
35}
36
38{
39 QWidget* headerWidget = new QWidget(this);
40 headerWidget->setStyleSheet(
41 "QWidget { "
42 "background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
43 "stop:0 #2c3e50, stop:1 #34495e); "
44 "}"
45 );
46 headerWidget->setMinimumHeight(100);
47
48 QVBoxLayout* headerLayout = new QVBoxLayout(headerWidget);
49 headerLayout->setContentsMargins(20, 20, 20, 20);
50
51 // Application title
52 QLabel* titleLabel = new QLabel(tr("SedSat3"), headerWidget);
53 QFont titleFont = titleLabel->font();
54 titleFont.setPointSize(24);
55 titleFont.setBold(true);
56 titleLabel->setFont(titleFont);
57 titleLabel->setStyleSheet("QLabel { color: white; }");
58 titleLabel->setAlignment(Qt::AlignCenter);
59
60 // Subtitle
61 QLabel* subtitleLabel = new QLabel(
62 tr("Sediment Source Apportionment Tool"),
63 headerWidget
64 );
65 QFont subtitleFont = subtitleLabel->font();
66 subtitleFont.setPointSize(11);
67 subtitleLabel->setFont(subtitleFont);
68 subtitleLabel->setStyleSheet("QLabel { color: #ecf0f1; }");
69 subtitleLabel->setAlignment(Qt::AlignCenter);
70
71 headerLayout->addWidget(titleLabel);
72 headerLayout->addWidget(subtitleLabel);
73
74 return headerWidget;
75}
76
78{
79 QWidget* infoWidget = new QWidget(this);
80 infoWidget->setStyleSheet("QWidget { background-color: white; }");
81
82 QVBoxLayout* infoLayout = new QVBoxLayout(infoWidget);
83 infoLayout->setContentsMargins(20, 20, 20, 10);
84 infoLayout->setSpacing(10);
85
86 // Version
87 versionLabel = new QLabel(tr("Version: "), infoWidget);
88 QFont boldFont = versionLabel->font();
89 boldFont.setPointSize(10);
90 versionLabel->setFont(boldFont);
91
92 // Build date
93 buildDateLabel = new QLabel(tr("Build Date: "), infoWidget);
94 buildDateLabel->setFont(boldFont);
95
96 // Authors section
97 QLabel* authorsLabel = new QLabel(tr("<b>Authors:</b>"), infoWidget);
98 authorsLabel->setFont(boldFont);
99
100 QLabel* authorsText = new QLabel(
101 tr("Arash Massoudieh<br>"
102 "Allen Gellis<br>"
103 "Cara Peterman Phipps"),
104 infoWidget
105 );
106 authorsText->setIndent(20);
107 authorsText->setTextFormat(Qt::RichText);
108
109 // Description
110 QLabel* descriptionLabel = new QLabel(
111 tr("<b>Description:</b>"),
112 infoWidget
113 );
114 descriptionLabel->setFont(boldFont);
115
116 infoLayout->addWidget(versionLabel);
117 infoLayout->addWidget(buildDateLabel);
118 infoLayout->addSpacing(10);
119 infoLayout->addWidget(authorsLabel);
120 infoLayout->addWidget(authorsText);
121 infoLayout->addSpacing(10);
122 infoLayout->addWidget(descriptionLabel);
123
124 return infoWidget;
125}
126
128{
129 descriptionBrowser = new QTextBrowser(this);
130 descriptionBrowser->setFrameStyle(QFrame::NoFrame);
131 descriptionBrowser->setStyleSheet(
132 "QTextBrowser { "
133 "background-color: white; "
134 "border: none; "
135 "padding-left: 20px; "
136 "padding-right: 20px; "
137 "}"
138 );
139 descriptionBrowser->setOpenExternalLinks(true);
140
141 // Default description
142 descriptionBrowser->setHtml(
143 tr("<p>SedSat3 is a comprehensive tool for sediment source apportionment "
144 "analysis using advanced statistical methods including Chemical Mass "
145 "Balance (CMB) modeling, Bayesian inference, MCMC sampling, and "
146 "multivariate statistical techniques.</p>"
147 "<p>This software enables researchers to identify and quantify the "
148 "contributions of different sediment sources to receptor sites, "
149 "supporting environmental pollution research and watershed management.</p>")
150 );
151
152 return descriptionBrowser;
153}
154
156{
157 QWidget* footerWidget = new QWidget(this);
158 footerWidget->setStyleSheet("QWidget { background-color: #f8f9fa; }");
159
160 QVBoxLayout* footerLayout = new QVBoxLayout(footerWidget);
161 footerLayout->setContentsMargins(20, 15, 20, 15);
162 footerLayout->setSpacing(10);
163
164 // Copyright
165 QLabel* copyrightLabel = new QLabel(
166 tr("© 2025 SedSat3 Development Team"),
167 footerWidget
168 );
169 copyrightLabel->setAlignment(Qt::AlignCenter);
170 QFont copyrightFont = copyrightLabel->font();
171 copyrightFont.setPointSize(9);
172 copyrightLabel->setFont(copyrightFont);
173 copyrightLabel->setStyleSheet("QLabel { color: #6c757d; }");
174
175 // Close button
176 QPushButton* closeButton = new QPushButton(tr("Close"), footerWidget);
177 closeButton->setMinimumWidth(100);
178 closeButton->setStyleSheet(
179 "QPushButton { "
180 "background-color: #3498db; "
181 "color: white; "
182 "border: none; "
183 "padding: 8px 16px; "
184 "border-radius: 4px; "
185 "font-weight: bold; "
186 "} "
187 "QPushButton:hover { "
188 "background-color: #2980b9; "
189 "} "
190 "QPushButton:pressed { "
191 "background-color: #21618c; "
192 "}"
193 );
194
195 connect(closeButton, &QPushButton::clicked, this, &AboutDialog::accept);
196
197 // Button layout
198 QHBoxLayout* buttonLayout = new QHBoxLayout();
199 buttonLayout->addStretch();
200 buttonLayout->addWidget(closeButton);
201 buttonLayout->addStretch();
202
203 footerLayout->addWidget(copyrightLabel);
204 footerLayout->addLayout(buttonLayout);
205
206 return footerWidget;
207}
208
210{
211 if (versionLabel)
212 {
213 versionLabel->setText(tr("Version: %1").arg(version));
214 }
215}
216
217void AboutDialog::setBuildDate(const QString& date)
218{
219 if (buildDateLabel)
220 {
221 buildDateLabel->setText(tr("Build Date: %1").arg(date));
222 }
223}
224
225void AboutDialog::appendText(const QString& text)
226{
228 {
229 descriptionBrowser->append(text);
230 }
231}
232
234{
236 {
237 descriptionBrowser->clear();
238 }
239}
QWidget * createFooter()
Creates the footer with copyright and buttons.
void setVersion(const QString &version)
Sets the application version.
void setupUI()
Sets up the dialog UI.
AboutDialog(QWidget *parent=nullptr)
Constructs the about dialog.
QTextBrowser * descriptionBrowser
Definition aboutdialog.h:91
QWidget * createInfoSection()
Creates the information section with version and authors.
QLabel * buildDateLabel
Definition aboutdialog.h:90
QLabel * versionLabel
Definition aboutdialog.h:89
QTextBrowser * createDescriptionSection()
Creates the description text browser.
void appendText(const QString &text)
Appends additional text to the description area.
void clearText()
Clears all text from the description area.
QWidget * createHeader()
Creates the header section with logo and title.
void setBuildDate(const QString &date)
Sets the build date.
#define version