From 9ad10c009b4279781d9173dea92fb173fb8ea9a4 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 3 Jul 2026 10:00:25 +1000 Subject: [PATCH] Add Bonsai Viewer about license Replace the settings About placeholder with product, GPL, and third-party license information. Generated with the assistance of an AI coding tool. --- src/bonsaiviewer/modules/settings/Dialog.cpp | 75 +++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/src/bonsaiviewer/modules/settings/Dialog.cpp b/src/bonsaiviewer/modules/settings/Dialog.cpp index 699b954906..b10455edad 100644 --- a/src/bonsaiviewer/modules/settings/Dialog.cpp +++ b/src/bonsaiviewer/modules/settings/Dialog.cpp @@ -274,11 +274,84 @@ void SettingsDialog::setupUi() { return tab; }; + auto make_about_tab = [this]() { + auto* tab = new QWidget(this); + auto* layout = new QVBoxLayout(tab); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(components::style::metrics::padding); + layout->setAlignment(Qt::AlignTop); + + auto make_rich_label = [](const QString& text, QWidget* parent) { + const QString link_color = bonsaiviewer::ViewerSettings::instance().color("icon_accent_color"); + auto* label = new QLabel(QString("%2").arg(link_color, text), parent); + label->setTextFormat(Qt::RichText); + label->setTextInteractionFlags(Qt::TextBrowserInteraction); + label->setOpenExternalLinks(true); + label->setWordWrap(true); + return label; + }; + + auto* about_section = new components::Section( + "About Bonsai Viewer", components::SectionHeaderMode::Visible, tab); + auto* about_body = new QWidget(about_section); + auto* about_layout = new QVBoxLayout(about_body); + about_layout->setContentsMargins(0, 0, 0, 0); + about_layout->setSpacing(8); + about_layout->addWidget(make_rich_label( + "Bonsai Viewer
" + "A high performance IFC viewing and coordination tool for large OpenBIM projects.

" + "bonsaibim.org | " + "Source code", + about_body)); + about_section->addBodyWidget(about_body); + layout->addWidget(about_section); + + auto* license_section = new components::Section("License", components::SectionHeaderMode::Visible, tab); + auto* license_body = new QWidget(license_section); + auto* license_layout = new QVBoxLayout(license_body); + license_layout->setContentsMargins(0, 0, 0, 0); + license_layout->setSpacing(8); + license_layout->addWidget(make_rich_label( + "Bonsai Viewer is free software: you can redistribute it and/or modify it under the terms of " + "the GNU General Public License as published by the Free Software Foundation, either " + "version 3.0 of the License, or (at your option) any later version.

" + "Bonsai Viewer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; " + "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " + "See the GNU General Public License " + "for more details.", + license_body)); + license_section->addBodyWidget(license_body); + layout->addWidget(license_section); + + auto* dependencies_section = new components::Section( + "Third-party licenses", components::SectionHeaderMode::Visible, tab); + auto* dependencies_body = new QWidget(dependencies_section); + auto* dependencies_layout = new QVBoxLayout(dependencies_body); + dependencies_layout->setContentsMargins(0, 0, 0, 0); + dependencies_layout->setSpacing(8); + dependencies_layout->addWidget(make_rich_label( + "" + "See the bundled dependency notices and source distributions for the complete license texts.", + dependencies_body)); + dependencies_section->addBodyWidget(dependencies_body); + layout->addWidget(dependencies_section); + layout->addStretch(1); + return tab; + }; + addTab("Interface", interface_tab); addTab("Keybindings", make_placeholder_tab("Keybindings", "Shortcut presets and command bindings will live here.")); addTab("Graphics", graphics_tab); addTab("Connectors", buildConnectorsTab()); - addTab("About", make_placeholder_tab("About", "Version, credits, and environment information will live here.")); + addTab("About", make_about_tab()); auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); if (auto* ok = buttons->button(QDialogButtonBox::Ok)) {