diff --git a/Core/Core.cc b/Core/Core.cc index 306ca7dce1d7811dd053860790b64b6c4677568e..223a1c8765b3d50e223d2d1cccbb7cad4d74dd0a 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -208,6 +208,9 @@ Core() : */ void Core::init() { + + // Check library versions + checkLibraryVersions(); // Make root_node available to the plugins ( defined in PluginFunctions.hh) PluginFunctions::setDataSeparatorNodes( dataSeparatorNode_ ); @@ -1409,9 +1412,73 @@ void Core::slotDeleteAllObjects( ){ //----------------------------------------------------------------------------- +bool Core::checkLibraryVersions() { + + bool ok = true; + bool warn = false; + + QString messages; + + QString qtCompiledVersion = QString( QT_VERSION_STR ); + QString qtCurrentVersion = qVersion(); + + if ( qtCompiledVersion != qtCurrentVersion ) { + messages += tr("QT Library Version mismatch!\n"); + + messages += tr("Currently used QT Version:\t") + qVersion(); + messages += tr("Link time QT Version:\t\t") + QString( QT_VERSION_STR ); + messages += tr("This inconsistency may lead to an unstable behaviour of OpenFLipper!"); + + warn = true; + } + + if ( !ok ) { + QString message = tr("Error! Library tests failed!\n"); + message += tr("The following problems have been found:\n\n"); + + message += messages; + + std::cerr << message.toStdString() << std::endl; + + if ( OpenFlipper::Options::gui() ) { + QMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message ); + } + + // Unsafe operation, so quit the application + exit(1); + + } else if ( warn ) { + + QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n"); + message += tr("The following checks failed:\n\n"); + message += messages; + + std::cerr << message.toStdString() << std::endl; + + if ( OpenFlipper::Options::gui() ) { + QMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message ); + } + + } + #ifndef NDEBUG + else { + std::cerr << "Library Check succeeded" << std::endl; + return true; + } + #endif + + return true; +} + +//----------------------------------------------------------------------------- + bool Core::checkOpenGLCapabilities() { + // No gui->no OpenGL + if ( OpenFlipper::Options::nogui() ) + return true; + // Status ok? bool ok = true; bool warn = false; @@ -1450,7 +1517,7 @@ bool Core::checkOpenGLCapabilities() { } if ( !ok ) { - QString message = tr("Warning! The OpenGL capabilities of your current machine/driver are not sufficient!\n"); + QString message = tr("Error! The OpenGL capabilities of your current machine/driver are not sufficient!\n"); message += tr("The following checks failed:\n\n"); message += missing; message += tr("\n\nPlease update your driver or graphics card.\n"); diff --git a/Core/Core.hh b/Core/Core.hh index 08390a9ddecc6d371974b1fa87400d0f887c012b..8040b3d544aa07674d0c619a648cff59d39c3ffc 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -1115,6 +1115,12 @@ private slots: * prints an error message if not. */ bool checkOpenGLCapabilities(); + + /** \brief Checks for library inconsistencies + * + * Checks if the used libraries are consistent + */ + bool checkLibraryVersions(); private :