From eac2899afb1daec285c76db9a1f628bd49ad0588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 6 May 2015 23:35:40 +0200 Subject: [PATCH] added OpenGLChecker --- YACReader/YACReader.pro | 6 ++++-- YACReader/viewer.cpp | 13 ++++++++++--- YACReaderLibrary/YACReaderLibrary.pro | 6 ++++-- YACReaderLibrary/library_window.cpp | 12 +++++++++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 4de102fe..64beedd8 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -115,7 +115,8 @@ HEADERS += ../common/comic.h \ yacreader_local_client.h \ ../common/http_worker.h \ ../common/exit_check.h \ - ../common/scroll_management.h + ../common/scroll_management.h \ + ../common/opengl_checker.h !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { @@ -158,7 +159,8 @@ SOURCES += ../common/comic.cpp \ ../common/http_worker.cpp \ ../common/yacreader_global.cpp \ ../common/exit_check.cpp \ - ../common/scroll_management.cpp + ../common/scroll_management.cpp \ + ../common/opengl_checker.cpp !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index c4391e20..d0389a0a 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -18,6 +18,8 @@ #include "comic_db.h" #include "shortcuts_manager.h" +#include "opengl_checker.h" + #include @@ -72,10 +74,15 @@ shouldOpenPrevious(false) //CONFIG GOTO_FLOW-------------------------------------------------------- #ifndef NO_OPENGL - if(!settings->contains(USE_OPEN_GL)) - { + + OpenGLChecker openGLChecker; + bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion(); + + if(openGLAvailable && !settings->contains(USE_OPEN_GL)) settings->setValue(USE_OPEN_GL,2); - } + else + if(!openGLAvailable) + settings->setValue(USE_OPEN_GL,0); if((settings->value(USE_OPEN_GL).toBool() == true)) goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType()); diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index e3cbaba0..cd5bd37f 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -135,7 +135,8 @@ HEADERS += comic_flow.h \ empty_container_info.h \ empty_special_list.h \ empty_reading_list_widget.h \ - ../common/scroll_management.h + ../common/scroll_management.h \ + ../common/opengl_checker.h !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { @@ -203,7 +204,8 @@ SOURCES += comic_flow.cpp \ empty_container_info.cpp \ empty_special_list.cpp \ empty_reading_list_widget.cpp \ - ../common/scroll_management.cpp + ../common/scroll_management.cpp \ + ../common/opengl_checker.cpp !CONFIG(no_opengl) { CONFIG(legacy_gl_widget) { diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 691c33ea..51675d36 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -86,6 +86,7 @@ #include "db_helper.h" #include "reading_list_item.h" +#include "opengl_checker.h" #include "QsLog.h" @@ -187,10 +188,15 @@ void LibraryWindow::doLayout() #ifndef NO_OPENGL //FLOW----------------------------------------------------------------------- //--------------------------------------------------------------------------- - if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL)) - { + + OpenGLChecker openGLChecker; + bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion(); + + if(openGLAvailable && !settings->contains(USE_OPEN_GL)) settings->setValue(USE_OPEN_GL,2); - } + else + if(!openGLAvailable) + settings->setValue(USE_OPEN_GL,0); #endif //FOLDERS FILTER------------------------------------------------------------- //---------------------------------------------------------------------------