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