Improve compiler check in about dialog (#167)

* improve compiler check in about dialog

* fix typo
This commit is contained in:
Cyano Hao 2023-12-22 18:05:09 +08:00 committed by GitHub
parent e542613acf
commit 2e96a21f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 11 deletions

View File

@ -56,8 +56,24 @@
<translation>Website: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;</translation> <translation>Website: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;</translation>
</message> </message>
<message> <message>
<source>Microsoft Visual C++</source> <source>Next Generation Microsoft Visual C++</source>
<translation type="unfinished"></translation> <translation>Microsoft Visual C++ de Próxima Geração</translation>
</message>
<message>
<source>Microsoft Visual C++ 2022</source>
<translation>Microsoft Visual C++ 2022</translation>
</message>
<message>
<source>Microsoft Visual C++ 2019</source>
<translation>Microsoft Visual C++ 2019</translation>
</message>
<message>
<source>Microsoft Visual C++ 2017</source>
<translation>Microsoft Visual C++ 2017</translation>
</message>
<message>
<source>Legacy Microsoft Visual C++</source>
<translation>Microsoft Visual C++ Legado</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -125,9 +125,24 @@ p, li { white-space: pre-wrap; }
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../widgets/aboutdialog.cpp" line="41"/> <source>Next Generation Microsoft Visual C++</source>
<source>Microsoft Visual C++</source> <translation> Microsoft Visual C++</translation>
<translation>Microsoft Visual C++</translation> </message>
<message>
<source>Microsoft Visual C++ 2022</source>
<translation>Microsoft Visual C++ 2022</translation>
</message>
<message>
<source>Microsoft Visual C++ 2019</source>
<translation>Microsoft Visual C++ 2019</translation>
</message>
<message>
<source>Microsoft Visual C++ 2017</source>
<translation>Microsoft Visual C++ 2017</translation>
</message>
<message>
<source>Legacy Microsoft Visual C++</source>
<translation> Microsoft Visual C++</translation>
</message> </message>
<message> <message>
<location filename="../widgets/aboutdialog.cpp" line="45"/> <location filename="../widgets/aboutdialog.cpp" line="45"/>

View File

@ -52,8 +52,24 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Microsoft Visual C++</source> <source>Next Generation Microsoft Visual C++</source>
<translation type="unfinished"></translation> <translation> Microsoft Visual C++</translation>
</message>
<message>
<source>Microsoft Visual C++ 2022</source>
<translation>Microsoft Visual C++ 2022</translation>
</message>
<message>
<source>Microsoft Visual C++ 2019</source>
<translation>Microsoft Visual C++ 2019</translation>
</message>
<message>
<source>Microsoft Visual C++ 2017</source>
<translation>Microsoft Visual C++ 2017</translation>
</message>
<message>
<source>Legacy Microsoft Visual C++</source>
<translation> Microsoft Visual C++</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -29,16 +29,42 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
ui->lblTitle->setText(ui->lblTitle->text() + tr("Version: ") + REDPANDA_CPP_VERSION); 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() ui->lblQt->setText(ui->lblQt->text()
.arg(qVersion()) .arg(qVersion())
.arg(QString("GCC %1.%2") .arg(QString("GCC %1.%2.%3")
.arg(__GNUC__) .arg(__GNUC__)
.arg(__GNUC_MINOR__))); .arg(__GNUC_MINOR__)
.arg(__GNUC_PATCHLEVEL__)));
#elif defined(_MSC_VER) #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() ui->lblQt->setText(ui->lblQt->text()
.arg(qVersion()) .arg(qVersion())
.arg(tr("Microsoft Visual C++"))); .arg(name));
#else #else
ui->lblQt->setText(ui->lblQt->text() ui->lblQt->setText(ui->lblQt->text()
.arg(qVersion()) .arg(qVersion())