Commit 2c838ded authored by Jan Möbius's avatar Jan Möbius

Added library version checks

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9768 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 166c21e4
...@@ -208,6 +208,9 @@ Core() : ...@@ -208,6 +208,9 @@ Core() :
*/ */
void void
Core::init() { Core::init() {
// Check library versions
checkLibraryVersions();
// Make root_node available to the plugins ( defined in PluginFunctions.hh) // Make root_node available to the plugins ( defined in PluginFunctions.hh)
PluginFunctions::setDataSeparatorNodes( dataSeparatorNode_ ); PluginFunctions::setDataSeparatorNodes( dataSeparatorNode_ );
...@@ -1409,9 +1412,73 @@ void Core::slotDeleteAllObjects( ){ ...@@ -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() { bool Core::checkOpenGLCapabilities() {
// No gui->no OpenGL
if ( OpenFlipper::Options::nogui() )
return true;
// Status ok? // Status ok?
bool ok = true; bool ok = true;
bool warn = false; bool warn = false;
...@@ -1450,7 +1517,7 @@ bool Core::checkOpenGLCapabilities() { ...@@ -1450,7 +1517,7 @@ bool Core::checkOpenGLCapabilities() {
} }
if ( !ok ) { 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 += tr("The following checks failed:\n\n");
message += missing; message += missing;
message += tr("\n\nPlease update your driver or graphics card.\n"); message += tr("\n\nPlease update your driver or graphics card.\n");
......
...@@ -1115,6 +1115,12 @@ private slots: ...@@ -1115,6 +1115,12 @@ private slots:
* prints an error message if not. * prints an error message if not.
*/ */
bool checkOpenGLCapabilities(); bool checkOpenGLCapabilities();
/** \brief Checks for library inconsistencies
*
* Checks if the used libraries are consistent
*/
bool checkLibraryVersions();
private : private :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment