diff --git a/Modules/QtWidgetsExt/src/QmitkAboutDialog.cpp b/Modules/QtWidgetsExt/src/QmitkAboutDialog.cpp index 43b0aa316b..789d97b141 100644 --- a/Modules/QtWidgetsExt/src/QmitkAboutDialog.cpp +++ b/Modules/QtWidgetsExt/src/QmitkAboutDialog.cpp @@ -1,82 +1,107 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "QmitkAboutDialog.h" #include "QmitkModulesDialog.h" #include +#include #include #include #include -QmitkAboutDialog::QmitkAboutDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +namespace { - m_GUI.setupUi(this); + QString CreateRevisionLabelText() + { + auto revisionText = QString("

Revision: %1").arg(MITK_REVISION); + QString mitkRevisionDescription(MITK_REVISION_DESC); + + if (!mitkRevisionDescription.isEmpty()) + revisionText += QString("
Description: %1").arg(mitkRevisionDescription); + + revisionText += "

"; + + return revisionText; + } + + QString CreateToolkitVersionsLabelText() + { + auto itkVersion = QString("%1.%2.%3").arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH); + return QString("ITK %1, VTK %2, Qt %3").arg(itkVersion, VTK_VERSION, QT_VERSION_STR); + } - QString mitkRevision(MITK_REVISION); - QString mitkRevisionDescription(MITK_REVISION_DESC); - QString itkVersion = QString("%1.%2.%3").arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH); - QString vtkVersion = QString("%1.%2.%3").arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION); + QString MatchDocumentationToReleaseVersion(QString nightly) + { + QRegularExpression regEx("^v(\\d\\d\\d\\d\\.\\d\\d)$"); // "v", 4 digits, dot, 2 digits + auto match = regEx.match(MITK_REVISION_DESC); - QString revisionText = QString("Revision: %1").arg(MITK_REVISION); + if (match.hasMatch()) + nightly.replace("nightly", match.captured(1)); // Replace with captured 4 digits, dot, 2 digits - if (!QString(MITK_REVISION_DESC).isEmpty()) - revisionText += QString("\nDescription: %1").arg(MITK_REVISION_DESC); + return nightly; + } +} + +QmitkAboutDialog::QmitkAboutDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +{ + m_GUI.setupUi(this); - m_GUI.m_RevisionLabel->setText(revisionText); - m_GUI.m_ToolkitVersionsLabel->setText(QString("ITK %1, VTK %2, Qt %3").arg(itkVersion, vtkVersion, QT_VERSION_STR)); + m_GUI.m_RevisionLabel->setText(CreateRevisionLabelText()); + m_GUI.m_ToolkitVersionsLabel->setText(CreateToolkitVersionsLabelText()); + m_GUI.m_AboutLabel->setText(MatchDocumentationToReleaseVersion(m_GUI.m_AboutLabel->text())); - QPushButton *btnModules = new QPushButton(QIcon(":/QtWidgetsExt/ModuleView.png"), "Modules"); + auto* btnModules = new QPushButton(QIcon(":/QtWidgetsExt/ModuleView.png"), "Modules"); m_GUI.m_ButtonBox->addButton(btnModules, QDialogButtonBox::ActionRole); connect(btnModules, SIGNAL(clicked()), this, SLOT(ShowModules())); connect(m_GUI.m_ButtonBox, SIGNAL(rejected()), this, SLOT(reject())); } QmitkAboutDialog::~QmitkAboutDialog() { } void QmitkAboutDialog::ShowModules() { QmitkModulesDialog dialog(this); dialog.exec(); } QString QmitkAboutDialog::GetAboutText() const { return m_GUI.m_AboutLabel->text(); } QString QmitkAboutDialog::GetCaptionText() const { return m_GUI.m_CaptionLabel->text(); } QString QmitkAboutDialog::GetRevisionText() const { return m_GUI.m_RevisionLabel->text(); } void QmitkAboutDialog::SetAboutText(const QString &text) { m_GUI.m_AboutLabel->setText(text); } void QmitkAboutDialog::SetCaptionText(const QString &text) { m_GUI.m_CaptionLabel->setText(text); } void QmitkAboutDialog::SetRevisionText(const QString &text) { m_GUI.m_RevisionLabel->setText(text); } diff --git a/Modules/QtWidgetsExt/src/QmitkAboutDialogGUI.ui b/Modules/QtWidgetsExt/src/QmitkAboutDialogGUI.ui index e0a3b8db25..5d67f714ec 100644 --- a/Modules/QtWidgetsExt/src/QmitkAboutDialogGUI.ui +++ b/Modules/QtWidgetsExt/src/QmitkAboutDialogGUI.ui @@ -1,175 +1,185 @@ QmitkAboutDialog 0 0 534 421 About false 0 0 MS Sans Serif 48 - 75 true MITK Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft 0 0 - Revision: hash -Description: + <html><head/><body><p>Revision: &lt;hash&gt;<br/>Description:</p></body></html> + + + Qt::RichText Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true + ITK x.x.x, VTK x.x.x, Qt x.x.x + + Qt::PlainText + Qt::Horizontal QSizePolicy::Expanding 40 20 272 54 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.mitk.org"><span style=" text-decoration: underline; color:#0000ff;"><img src=":/QtWidgetsExt/defaultWatermarkSmall.png" /></span></a></p></body></html> true true Qt::Vertical 20 40 true 0 0 514 - 221 + 192 - <html><head/><body><p><span style=" font-size:8pt;">The Medical Imaging Interaction Toolkit (MITK) [1] has been developed by the Division of Computer-Assisted Medical Interventions and the Division of Medical Image Computing of the German Cancer Research Center (DKFZ) [2,3].</span></p><p><span style=" font-size:8pt;">[1] </span><a href="http://www.mitk.org/"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">mitk.org<br/></span></a><span style=" font-size:8pt;">[2] </span><a href="https://www.dkfz.de/en/cami/index.php"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">dkfz.de/en/cami<br/></span></a><span style=" font-size:8pt;">[3] </span><a href="https://www.dkfz.de/en/mic/index.php"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">dkfz.de/en/mic</span></a></p><p><span style=" font-size:8pt;">To contact the MITK team, see </span><a href="http://www.mitk.org/wiki/Contact"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">mitk.org/wiki/contact</span></a><span style=" font-size:8pt;">.</span></p><p><span style=" font-size:10pt; font-weight:600;">Third Party Libraries<br/></span><a href="https://docs.mitk.org/nightly/thirdpartylibs.html"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">docs.mitk.org/nightly/thirdpartylibs.html</span></a></p></body></html> + <html><head/><body><p><span style=" font-size:8pt;">The Medical Imaging Interaction Toolkit (MITK) [1] is developed by the Division of Medical Image Computing [2] of the German Cancer Research Center (DKFZ) [3].</span></p><p><span style=" font-size:8pt;">[1] </span><a href="https://www.mitk.org"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">mitk.org<br/></span></a><span style=" font-size:8pt;">[2] </span><a href="https://www.dkfz.de/en/mic/index.php"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">dkfz.de/en/mic<br/></span></a><span style=" font-size:8pt;">[3] </span><a href="https://www.dkfz.de"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">dkfz.de</span></a></p><p><span style=" font-size:8pt;">To contact the MITK team, visit </span><a href="https://www.mitk.org/wiki/Contact"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">mitk.org/wiki/Contact</span></a><span style=" font-size:8pt;">.</span></p><p><span style=" font-size:10pt; font-weight:600;">Third Party Libraries<br/></span><a href="https://docs.mitk.org/nightly/thirdpartylibs.html"><span style=" font-size:8pt; text-decoration: underline; color:#5555ff;">docs.mitk.org/nightly/thirdpartylibs.html</span></a></p></body></html> + + + Qt::RichText true true QDialogButtonBox::Close