From b4f7f1a2329d55d2ceeeacc0179bdedc1ddba7e5 Mon Sep 17 00:00:00 2001 From: xarkes Date: Thu, 18 Jul 2019 19:56:00 +0200 Subject: [PATCH] Added QtVersion inside AboutDialog --- src/dialogs/AboutDialog.cpp | 34 ++++++++++++++++++++++++++++++++-- src/dialogs/AboutDialog.h | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/dialogs/AboutDialog.cpp b/src/dialogs/AboutDialog.cpp index a2d6e590..9fd1c8e6 100644 --- a/src/dialogs/AboutDialog.cpp +++ b/src/dialogs/AboutDialog.cpp @@ -28,7 +28,8 @@ AboutDialog::AboutDialog(QWidget *parent) : QString aboutString("

Cutter

" + tr("Version") + " " CUTTER_VERSION_FULL "
" - + tr("Using r2-") + R2_GITTAP + + tr("Using r2-") + R2_GITTAP + "
" + + buildQtVersionString() + "

" + tr("Optional Features:") + "
" + QString("Python: %1
").arg( #ifdef CUTTER_ENABLE_PYTHON @@ -91,7 +92,7 @@ void AboutDialog::on_checkForUpdatesButton_clicked() connect(&updateWorker, &UpdateWorker::checkComplete, &waitDialog, &QProgressDialog::cancel); connect(&updateWorker, &UpdateWorker::checkComplete, - [&updateWorker](const QVersionNumber &version, const QString & error) { + [&updateWorker](const QVersionNumber & version, const QString & error) { if (!error.isEmpty()) { QMessageBox::critical(nullptr, tr("Error!"), error); } else { @@ -111,3 +112,32 @@ void AboutDialog::on_updatesCheckBox_stateChanged(int) { Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled()); } + +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 = QLatin1String(" (Apple)"); +#endif + return QLatin1String("Clang " ) + QString::number(__clang_major__) + QLatin1Char('.') + + QString::number(__clang_minor__) + isAppleString; +#elif defined(Q_CC_GNU) + return QLatin1String("GCC " ) + QLatin1String(__VERSION__); +#elif defined(Q_CC_MSVC) + if (_MSC_VER > 1999) + return QLatin1String("MSVC "); + if (_MSC_VER >= 1910) + return QLatin1String("MSVC 2017"); + if (_MSC_VER >= 1900) + return QLatin1String("MSVC 2015"); +#endif + return QLatin1String(""); +} + +QString AboutDialog::buildQtVersionString(void) +{ + return tr("Based on Qt %1 (%2, %3 bit)").arg(QLatin1String(qVersion()), + compilerString(), + QString::number(QSysInfo::WordSize)); +} diff --git a/src/dialogs/AboutDialog.h b/src/dialogs/AboutDialog.h index 3d094736..15a458bd 100644 --- a/src/dialogs/AboutDialog.h +++ b/src/dialogs/AboutDialog.h @@ -38,6 +38,8 @@ private slots: private: std::unique_ptr ui; + + QString buildQtVersionString(void); }; #endif // ABOUTDIALOG_H