From 2e96a21f6f1f961b2c2a83da94036c656aec27ac Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Fri, 22 Dec 2023 18:05:09 +0800 Subject: [PATCH] Improve compiler check in about dialog (#167) * improve compiler check in about dialog * fix typo --- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 20 +++++++++-- RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 21 ++++++++++-- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 20 +++++++++-- RedPandaIDE/widgets/aboutdialog.cpp | 34 ++++++++++++++++--- 4 files changed, 84 insertions(+), 11 deletions(-) diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 3a85db4d..1095f62c 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -56,8 +56,24 @@ Website: <a href="%1">%1</a> - Microsoft Visual C++ - + Next Generation Microsoft Visual C++ + Microsoft Visual C++ de Próxima Geração + + + Microsoft Visual C++ 2022 + Microsoft Visual C++ 2022 + + + Microsoft Visual C++ 2019 + Microsoft Visual C++ 2019 + + + Microsoft Visual C++ 2017 + Microsoft Visual C++ 2017 + + + Legacy Microsoft Visual C++ + Microsoft Visual C++ Legado diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 8cdbb157..1032be09 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -125,9 +125,24 @@ p, li { white-space: pre-wrap; } 版本: - - Microsoft Visual C++ - Microsoft Visual C++ + Next Generation Microsoft Visual C++ + 下一代 Microsoft Visual C++ + + + Microsoft Visual C++ 2022 + Microsoft Visual C++ 2022 + + + Microsoft Visual C++ 2019 + Microsoft Visual C++ 2019 + + + Microsoft Visual C++ 2017 + Microsoft Visual C++ 2017 + + + Legacy Microsoft Visual C++ + 旧版 Microsoft Visual C++ diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 6d00c08b..b13f5626 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -52,8 +52,24 @@ - Microsoft Visual C++ - + Next Generation Microsoft Visual C++ + 下一代 Microsoft Visual C++ + + + Microsoft Visual C++ 2022 + Microsoft Visual C++ 2022 + + + Microsoft Visual C++ 2019 + Microsoft Visual C++ 2019 + + + Microsoft Visual C++ 2017 + Microsoft Visual C++ 2017 + + + Legacy Microsoft Visual C++ + 舊版 Microsoft Visual C++ diff --git a/RedPandaIDE/widgets/aboutdialog.cpp b/RedPandaIDE/widgets/aboutdialog.cpp index 8ed8cce1..1a57b867 100644 --- a/RedPandaIDE/widgets/aboutdialog.cpp +++ b/RedPandaIDE/widgets/aboutdialog.cpp @@ -29,16 +29,42 @@ AboutDialog::AboutDialog(QWidget *parent) : ui->setupUi(this); ui->lblTitle->setText(ui->lblTitle->text() + tr("Version: ") + REDPANDA_CPP_VERSION); -#ifdef __GNUC__ +#if defined(__clang__) // Clang always pretends to be GCC/MSVC. Check it first. +# if defined(_MSC_VER) + QString templ = "Clang %1.%2.%3 MSVC ABI"; +# elif defined(__apple_build_version__) + QString templ = "Apple Clang %1.%2.%3"; +# else + QString templ = "Clang %1.%2.%3"; +# endif + ui->lblQt->setText(ui->lblQt->text() + .arg(qVersion()) + .arg(templ + .arg(__clang_major__) + .arg(__clang_minor__) + .arg(__clang_patchlevel__))); +#elif defined(__GNUC__) ui->lblQt->setText(ui->lblQt->text() .arg(qVersion()) - .arg(QString("GCC %1.%2") + .arg(QString("GCC %1.%2.%3") .arg(__GNUC__) - .arg(__GNUC_MINOR__))); + .arg(__GNUC_MINOR__) + .arg(__GNUC_PATCHLEVEL__))); #elif defined(_MSC_VER) +# if (_MSC_VER >= 1940) + QString name = tr("Next Generation Microsoft Visual C++"); +# elif (_MSC_VER >= 1930) + QString name = tr("Microsoft Visual C++ 2022"); +# elif (_MSC_VER >= 1920) + QString name = tr("Microsoft Visual C++ 2019"); +# elif (_MSC_VER >= 1910) + QString name = tr("Microsoft Visual C++ 2017"); +# else + QString name = tr("Legacy Microsoft Visual C++"); +# endif ui->lblQt->setText(ui->lblQt->text() .arg(qVersion()) - .arg(tr("Microsoft Visual C++"))); + .arg(name)); #else ui->lblQt->setText(ui->lblQt->text() .arg(qVersion())