diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2017-11-13 16:06:20 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2017-11-14 10:57:04 +0000 |
commit | cdd961041fc4030b9cbb485dd4ef1b98c6e2d9a0 (patch) | |
tree | fb55dc14692f4c75fef50a2dc10d9235665fbb05 | |
parent | bff881bd66821f5efe5a8e67a555349ffc0dd9f5 (diff) |
Add build information to about dialog
About dialog now shows the Qt version studio was built against,
build time stamp, and the build revision number, if it is defined
via compiler define QT3DSTUDIO_REVISION, which is extracted from
.tag file contents.
The logic for composing this information was copied from Qt Creator.
Task-number: QT3DS-435
Change-Id: I77fd45ce8538c008ea93eb99da4d28f3a77bf447
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | .tag | 1 | ||||
-rw-r--r-- | src/Authoring/Studio/Qt3DStudio.pro | 7 | ||||
-rw-r--r-- | src/Authoring/Studio/_Win/Application/AboutDlg.cpp | 57 | ||||
-rw-r--r-- | src/Authoring/Studio/_Win/Application/AboutDlg.ui | 47 |
4 files changed, 89 insertions, 23 deletions
@@ -0,0 +1 @@ +$Format:%H$ diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro index 679d7440..c7e31afe 100644 --- a/src/Authoring/Studio/Qt3DStudio.pro +++ b/src/Authoring/Studio/Qt3DStudio.pro @@ -499,3 +499,10 @@ target.path = $$[QT_INSTALL_BINS] INSTALLS += target RC_ICONS = images/3D-studio.ico + +# Extract SHA from .tag file if project has it +exists($$ABS_PRJ_ROOT/.tag) { + STUDIO_TAG = $$cat($$ABS_PRJ_ROOT/.tag) + FIRST_CHAR = $$str_member($$STUDIO_TAG, 0, 0) + !equals(FIRST_CHAR, "$"): DEFINES += QT3DSTUDIO_REVISION=$$first(STUDIO_TAG) +} diff --git a/src/Authoring/Studio/_Win/Application/AboutDlg.cpp b/src/Authoring/Studio/_Win/Application/AboutDlg.cpp index c5bdd6ac..4b313ee4 100644 --- a/src/Authoring/Studio/_Win/Application/AboutDlg.cpp +++ b/src/Authoring/Studio/_Win/Application/AboutDlg.cpp @@ -44,6 +44,12 @@ #include <QtGui/qpalette.h> +#ifdef QT3DSTUDIO_REVISION +#define STRINGIFY_INTERNAL(x) #x +#define STRINGIFY(x) STRINGIFY_INTERNAL(x) +const char *const QT3DSTUDIO_REVISION_STR = STRINGIFY(QT3DSTUDIO_REVISION); +#endif + //============================================================================== /** * Constructor: Initializes the object. @@ -81,6 +87,28 @@ void CAboutDlg::paintEvent(QPaintEvent* event) setFixedSize(size()); } +static QString compilerString() +{ +#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too + QString isAppleString; +#if defined(__apple_build_version__) // Apple clang has other version numbers + isAppleString = QStringLiteral(" (Apple)"); +#endif + return QStringLiteral("Clang " ) + QString::number(__clang_major__) + QStringLiteral(".") + + QString::number(__clang_minor__) + isAppleString; +#elif defined(Q_CC_GNU) + return QStringLiteral("GCC " ) + QStringLiteral(__VERSION__); +#elif defined(Q_CC_MSVC) + if (_MSC_VER > 1999) + return QStringLiteral("MSVC <unknown>"); + if (_MSC_VER >= 1910) + return QStringLiteral("MSVC 2017"); + if (_MSC_VER >= 1900) + return QStringLiteral("MSVC 2015"); +#endif + return QStringLiteral("<unknown compiler>"); +} + void CAboutDlg::OnInitDialog() { // Set the Studio version @@ -97,17 +125,6 @@ void CAboutDlg::OnInitDialog() m_Credit1Str.Format(::LoadResourceString(IDS_ABOUT_FBX_CREDIT)); #endif -#ifdef STUDIOSTORYNUM - m_ProductVersionStr += " (Story #"; - m_ProductVersionStr += STUDIOSTORYNUM; - m_ProductVersionStr += ")"; -#endif - -#ifdef BETA - // Add "beta" to the Studio version if necessary - m_ProductVersionStr += " BETA"; -#endif - // Add link to Web site Q3DStudio::CString theURL(::LoadResourceString(IDS_HELP_VISIT_QT)); @@ -137,6 +154,20 @@ void CAboutDlg::OnInitDialog() m_ui->m_Copyright->setText(m_CopyrightStr.toQString()); m_ui->m_Credit1->setText(m_Credit1Str.toQString()); - // We don't currently have secondary credit, so clear that - m_ui->m_Credit2->setText(QString()); + // Information about build + m_ui->m_buildTimestamp->setText( + tr("Built on %1 %2").arg(QStringLiteral(__DATE__), QStringLiteral(__TIME__))); + m_ui->m_qtVersion->setText( + tr("Based on Qt %1 (%2, %3 bit)").arg( + QString::fromLatin1(qVersion()), + compilerString(), + QString::number(QSysInfo::WordSize))); +#ifdef QT3DSTUDIO_REVISION + m_ui->m_revisionSHA->setText( + tr("From revision %1").arg( + QString::fromLatin1(QT3DSTUDIO_REVISION_STR).left(10))); +#else + m_ui->m_revisionSHA->setText(QString()); + m_ui->m_revisionSHA->setMaximumHeight(0); +#endif } diff --git a/src/Authoring/Studio/_Win/Application/AboutDlg.ui b/src/Authoring/Studio/_Win/Application/AboutDlg.ui index 0e106d48..85054337 100644 --- a/src/Authoring/Studio/_Win/Application/AboutDlg.ui +++ b/src/Authoring/Studio/_Win/Application/AboutDlg.ui @@ -63,6 +63,43 @@ </widget> </item> <item> + <spacer name="verticalSpacer_7"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>12</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="m_qtVersion"> + <property name="text"> + <string><Based on Qt version goes here></string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="m_buildTimestamp"> + <property name="text"> + <string><Built on timestamp goes here></string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="m_revisionSHA"> + <property name="text"> + <string><From revision SHA goes here></string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -128,16 +165,6 @@ </spacer> </item> <item> - <widget class="QLabel" name="m_Credit2"> - <property name="text"> - <string><Credit 2 goes here></string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> <widget class="Line" name="m_Line2"> <property name="orientation"> <enum>Qt::Horizontal</enum> |