12#include "ui_VuoEditorAboutBox.h"
14const QString VuoEditorAboutBox::htmlHead =
"<head><style>a { color: #0099a9; }</style></head>";
25 QString buildDate = __DATE__;
27 QString versionAndBuild = VUO_VERSION_AND_BUILD_STRING;
28 QRegularExpressionMatch match = QRegularExpression(
"\\d+\\.\\d+\\.\\d+").match(versionAndBuild);
29 QString versionNumber = match.captured(0);
30 QString versionSuffix = versionAndBuild.mid(match.capturedEnd());
31 if (!versionSuffix.isEmpty())
32 versionSuffix =
"<span style=\"font-size:20pt; color:rgba(0,0,0,.35)\">" + versionSuffix +
"</span>";
34 QString commitHash = VUO_GIT_COMMIT;
35 if (!commitHash.isEmpty())
36 commitHash = QString(
" (revision ") + VUO_GIT_COMMIT +
")";
39 QString missionMarkdown = tr(
40 "**Create memorable interactive experiences — without coding.**\n"
42 "Drag, drop, and connect Vuo's simple building blocks to support your creative work: \n"
43 "VJ gigs, exhibits, installations, stage productions, dome graphics, visual signage, \n"
44 "video effects, maker projects, trade show booths, and more. \n"
47 .arg(
"[vuo.org](https://vuo.org)");
51 QString descriptiveText = \
52 QString(
"<html>%3<body>"
53 "<p><span style=\"font-size:28pt;\">Vuo</span>"
54 "<span style=\"font-size:20pt;\"> %1</span>%5<br>"
55 "<span style=\"font-size:12pt; color:rgba(0,0,0,.5)\">" + tr(
"Built on %2") +
"<br>"
56 "Copyright © 2012–2023 Kosada Incorporated</span></p>%4"
60 buildDate + commitHash,
67 contributorFont = ui->textEdit->font();
69 licenseFont.setFamily(
"Monaco");
70 licenseFont.setStyleHint(QFont::Monospace);
71 licenseFont.setFixedPitch(
true);
72 licenseFont.setPointSize(11);
75 QFontMetricsF fontMetrics(licenseFont);
76 ui->textEdit->setTabStopDistance(spacesPerTab * fontMetrics.horizontalAdvance(
' '));
79 ui->textLabel->setText(descriptiveText);
82 contributors =
new QTreeWidgetItem(ui->treeWidget);
83 contributors->setText(0, tr(
"Contributors"));
84 dependencies =
new QTreeWidgetItem(ui->treeWidget);
85 dependencies->setText(0, tr(
"Dependencies"));
88 contributorsText = fetchMarkdown(
"CONTRIBUTORS.md", tr(
"Please see the list of contributors at <a href=\"%1\">%1</a>.").arg(
"https://community.vuo.org/badges"));
89 dependenciesText = fetchMarkdown(
"DEPENDENCIES.md", tr(
"Please see the list of dependencies at <a href=\"%1\">%1</a>.").arg(
"https://github.com/vuo/vuo/blob/main/conanfile.py"));
90 populateLicenseTexts();
92 ui->textEdit->setReadOnly(
true);
95 connect(ui->treeWidget, &QTreeWidget::currentItemChanged,
this, &VuoEditorAboutBox::updateDisplayedTextContent);
98 ui->treeWidget->setCurrentItem(contributors);
100 setFixedSize(size());
101 setAttribute(Qt::WA_DeleteOnClose,
false);
108QString VuoEditorAboutBox::fetchMarkdown(
const QString &filename,
const QString &fallback)
110 QFile f(QApplication::applicationDirPath().append(
"/../Resources/").append(filename));
111 if (!f.open(QIODevice::ReadOnly))
114 QTextStream textStream(&f);
121void VuoEditorAboutBox::populateLicenseTexts()
123 QDir licenseTextDir(QApplication::applicationDirPath().append(
"/../Frameworks/Vuo.framework/Documentation/Licenses"));
124 if (!licenseTextDir.exists())
127 QStringList licenseFileList(licenseTextDir.entryList(QDir::Files|QDir::Readable));
128 foreach (QString licenseFileName, licenseFileList)
130 QFile licenseFile(licenseTextDir.filePath(licenseFileName));
131 if (licenseFile.open(QIODevice::ReadOnly))
133 QFileInfo licenseFileInfo(licenseFile);
134 QString dependencyIdentifier = licenseFileInfo.completeBaseName();
135 QTreeWidgetItem *dependencyLicenseItem =
new QTreeWidgetItem();
136 dependencyLicenseItem->setText(0, dependencyIdentifier);
137 dependencies->addChild(dependencyLicenseItem);
139 QTextStream textStream(&licenseFile);
140 licenseTextForDependency[dependencyIdentifier] = textStream.readAll();
149void VuoEditorAboutBox::updateDisplayedTextContent()
151 QTreeWidgetItem *currentItem = ui->treeWidget->currentItem();
152 if (currentItem == contributors)
154 ui->textEdit->setFont(contributorFont);
155 ui->textEdit->setText(htmlHead + contributorsText);
157 else if (currentItem == dependencies)
159 ui->textEdit->setFont(contributorFont);
160 ui->textEdit->setText(htmlHead + dependenciesText);
164 ui->textEdit->setFont(licenseFont);
170 QString licenseText = licenseTextForDependency[currentItem->text(0)];
171 if (Qt::mightBeRichText(licenseText))
172 ui->textEdit->document()->setHtml(htmlHead + licenseText);
174 ui->textEdit->document()->setPlainText(licenseText);
178VuoEditorAboutBox::~VuoEditorAboutBox()