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
......@@ -209,6 +209,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");
......
......@@ -1116,6 +1116,12 @@ private slots:
*/
bool checkOpenGLCapabilities();
/** \brief Checks for library inconsistencies
*
* Checks if the used libraries are consistent
*/
bool checkLibraryVersions();
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