From 8a9efd513beb28db627ed127e14aecb6c3eaf090 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 2 Nov 2020 16:59:39 +0100 Subject: [PATCH] about dialog compiler and Qt version used to build meshlab --- src/common/mlapplication.cpp | 68 +++++++++++++++++++++--------- src/common/mlapplication.h | 43 ++++++++++--------- src/meshlab/mainwindow_RunTime.cpp | 6 ++- 3 files changed, 74 insertions(+), 43 deletions(-) diff --git a/src/common/mlapplication.cpp b/src/common/mlapplication.cpp index 7ab057b0e..c7a0b5993 100644 --- a/src/common/mlapplication.cpp +++ b/src/common/mlapplication.cpp @@ -2,29 +2,40 @@ #include "mlexception.h" #include -#define xstr(a) str(a) -#define str(a) #a +#ifndef MESHLAB_VERSION +#define MESHLAB_VERSION 2020.09 +#endif + +#if defined(__GNUC__) || defined(__GNUG__) +#define ML_COMPILER "GCC" +#define ML_COMPILER_VER MeshLabApplication::versionString(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__clang__) +#define ML_COMPILER "Clang" +#define ML_COMPILER_VER MeshLabApplication::versionString(__clang_major__, __clang_minor__, __clang_patchlevel__) +#elif defined(_MSC_VER) +#define ML_COMPILER "MSVC" +#define ML_COMPILER_VER std::to_string(_MSC_VER) +#endif + +#define xstr(a) stringify(a) +#define stringify(a) #a bool MeshLabApplication::notify( QObject * rec, QEvent * ev ) { - try - { - return QApplication::notify(rec,ev); - } - catch (MLException& e) - { - qCritical("%s",e.what()); - } - catch (vcg::MissingComponentException &e ) - { - qCritical("%s",e.what()); - abort(); - } - catch (...) - { - qCritical("Something really bad happened!!!!!!!!!!!!!"); - abort(); - } + try { + return QApplication::notify(rec,ev); + } + catch (MLException& e) { + qCritical("%s",e.what()); + } + catch (vcg::MissingComponentException &e ) { + qCritical("%s",e.what()); + abort(); + } + catch (...) { + qCritical("Something really bad happened!!!!!!!!!!!!!"); + abort(); + } return false; } @@ -33,3 +44,20 @@ const QString MeshLabApplication::appVer() return QString(xstr(MESHLAB_VERSION)); } +const QString MeshLabApplication::compilerVersion() +{ + return QString(ML_COMPILER) + QString(" ") + QString::fromStdString(ML_COMPILER_VER); +} + +const QString MeshLabApplication::qtVersion() +{ + return QString(QT_VERSION_STR); +} + +std::string MeshLabApplication::versionString(int a, int b, int c) +{ + std::ostringstream ss; + ss << a << '.' << b << '.' << c; + return ss.str(); +} + diff --git a/src/common/mlapplication.h b/src/common/mlapplication.h index 43a7a2241..5d77a3ad3 100644 --- a/src/common/mlapplication.h +++ b/src/common/mlapplication.h @@ -7,32 +7,33 @@ #include #include "ml_mesh_type.h" -#ifndef MESHLAB_VERSION -#define MESHLAB_VERSION 2020.02 -#endif - class MeshLabApplication : public QApplication { public: - enum HW_ARCHITECTURE {HW_32BIT = 32,HW_64BIT = 64}; - MeshLabApplication(int &argc, char *argv[]):QApplication(argc,argv){} - ~MeshLabApplication(){} + enum HW_ARCHITECTURE {HW_32BIT = 32,HW_64BIT = 64}; + MeshLabApplication(int &argc, char *argv[]):QApplication(argc,argv){} + ~MeshLabApplication(){} bool notify(QObject * rec, QEvent * ev); - static const QString appName(){return tr("MeshLab"); } - static const QString architecturalSuffix(const HW_ARCHITECTURE hw) {return "_" + QString::number(int(hw)) + "bit";} - static const QString appArchitecturalName(const HW_ARCHITECTURE hw) {return appName() + architecturalSuffix(hw) + "_" + MeshLabScalarTest::floatingPointPrecision();} + static const QString appName(){return tr("MeshLab"); } + static const QString architecturalSuffix(const HW_ARCHITECTURE hw) {return "_" + QString::number(int(hw)) + "bit";} + static const QString appArchitecturalName(const HW_ARCHITECTURE hw) {return appName() + architecturalSuffix(hw) + "_" + MeshLabScalarTest::floatingPointPrecision();} static const QString appVer(); - - static const QString shortName() { return appName() + " " + appVer(); } - static const QString completeName(const HW_ARCHITECTURE hw){return appArchitecturalName(hw) + " v" + appVer(); } - static const QString organization(){return tr("VCG");} - static const QString organizationHost() {return tr("http://vcg.isti.cnr.it");} - static const QString webSite() {return tr("http://www.meshlab.net/");} - static const QString downloadSite() {return tr("http://www.meshlab.net/#download");} - - static const QString pluginsPathRegisterKeyName() {return tr("pluginsPath");} - static const QString versionRegisterKeyName() {return tr("version");} - static const QString wordSizeKeyName() {return tr("wordSize");} + static const QString compilerVersion(); + static const QString qtVersion(); + + static const QString shortName() { return appName() + " " + appVer(); } + static const QString completeName(const HW_ARCHITECTURE hw){return appArchitecturalName(hw) + " v" + appVer(); } + static const QString organization(){return tr("VCG");} + static const QString organizationHost() {return tr("http://vcg.isti.cnr.it");} + static const QString webSite() {return tr("http://www.meshlab.net/");} + static const QString downloadSite() {return tr("http://www.meshlab.net/#download");} + + static const QString pluginsPathRegisterKeyName() {return tr("pluginsPath");} + static const QString versionRegisterKeyName() {return tr("version");} + static const QString wordSizeKeyName() {return tr("wordSize");} + +private: + static std::string versionString(int a, int b, int c); }; #endif diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 3db4ab517..4d822c051 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -2646,8 +2646,10 @@ void MainWindow::about() QDialog *about_dialog = new QDialog(); Ui::aboutDialog temp; temp.setupUi(about_dialog); - temp.labelMLName->setText(MeshLabApplication::completeName(MeshLabApplication::HW_ARCHITECTURE(QSysInfo::WordSize))+" (built on "+__DATE__+")"); - //about_dialog->setFixedSize(566,580); + temp.labelMLName->setText( + MeshLabApplication::completeName(MeshLabApplication::HW_ARCHITECTURE(QSysInfo::WordSize)) + "\n" + + "built on "+__DATE__+" with " + MeshLabApplication::compilerVersion() + + " and Qt " + MeshLabApplication::qtVersion() + "."); about_dialog->show(); }