mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 09:08:20 -04:00
Merge
This commit is contained in:
parent
c02cbc8992
commit
81ed438239
@ -113,7 +113,8 @@ HEADERS += ../common/comic.h \
|
|||||||
yacreader_local_client.h \
|
yacreader_local_client.h \
|
||||||
../common/http_worker.h \
|
../common/http_worker.h \
|
||||||
../common/exit_check.h \
|
../common/exit_check.h \
|
||||||
../common/scroll_management.h
|
../common/scroll_management.h \
|
||||||
|
../common/opengl_checker.h
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
CONFIG(legacy_gl_widget) {
|
CONFIG(legacy_gl_widget) {
|
||||||
@ -156,7 +157,8 @@ SOURCES += ../common/comic.cpp \
|
|||||||
../common/http_worker.cpp \
|
../common/http_worker.cpp \
|
||||||
../common/yacreader_global.cpp \
|
../common/yacreader_global.cpp \
|
||||||
../common/exit_check.cpp \
|
../common/exit_check.cpp \
|
||||||
../common/scroll_management.cpp
|
../common/scroll_management.cpp \
|
||||||
|
../common/opengl_checker.cpp
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
CONFIG(legacy_gl_widget) {
|
CONFIG(legacy_gl_widget) {
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
#include "shortcuts_manager.h"
|
#include "shortcuts_manager.h"
|
||||||
|
|
||||||
|
#include "opengl_checker.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
|
||||||
@ -72,10 +74,15 @@ shouldOpenPrevious(false)
|
|||||||
|
|
||||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||||
#ifndef NO_OPENGL
|
#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);
|
settings->setValue(USE_OPEN_GL,2);
|
||||||
}
|
else
|
||||||
|
if(!openGLAvailable)
|
||||||
|
settings->setValue(USE_OPEN_GL,0);
|
||||||
|
|
||||||
if((settings->value(USE_OPEN_GL).toBool() == true))
|
if((settings->value(USE_OPEN_GL).toBool() == true))
|
||||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||||
|
@ -134,7 +134,8 @@ HEADERS += comic_flow.h \
|
|||||||
empty_container_info.h \
|
empty_container_info.h \
|
||||||
empty_special_list.h \
|
empty_special_list.h \
|
||||||
empty_reading_list_widget.h \
|
empty_reading_list_widget.h \
|
||||||
../common/scroll_management.h
|
../common/scroll_management.h \
|
||||||
|
../common/opengl_checker.h
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
CONFIG(legacy_gl_widget) {
|
CONFIG(legacy_gl_widget) {
|
||||||
@ -202,7 +203,8 @@ SOURCES += comic_flow.cpp \
|
|||||||
empty_container_info.cpp \
|
empty_container_info.cpp \
|
||||||
empty_special_list.cpp \
|
empty_special_list.cpp \
|
||||||
empty_reading_list_widget.cpp \
|
empty_reading_list_widget.cpp \
|
||||||
../common/scroll_management.cpp
|
../common/scroll_management.cpp \
|
||||||
|
../common/opengl_checker.cpp
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
CONFIG(legacy_gl_widget) {
|
CONFIG(legacy_gl_widget) {
|
||||||
|
@ -86,6 +86,7 @@
|
|||||||
#include "db_helper.h"
|
#include "db_helper.h"
|
||||||
|
|
||||||
#include "reading_list_item.h"
|
#include "reading_list_item.h"
|
||||||
|
#include "opengl_checker.h"
|
||||||
|
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
@ -187,10 +188,15 @@ void LibraryWindow::doLayout()
|
|||||||
#ifndef NO_OPENGL
|
#ifndef NO_OPENGL
|
||||||
//FLOW-----------------------------------------------------------------------
|
//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);
|
settings->setValue(USE_OPEN_GL,2);
|
||||||
}
|
else
|
||||||
|
if(!openGLAvailable)
|
||||||
|
settings->setValue(USE_OPEN_GL,0);
|
||||||
#endif
|
#endif
|
||||||
//FOLDERS FILTER-------------------------------------------------------------
|
//FOLDERS FILTER-------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
44
common/opengl_checker.cpp
Normal file
44
common/opengl_checker.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "opengl_checker.h"
|
||||||
|
|
||||||
|
#include "QsLog.h"
|
||||||
|
|
||||||
|
OpenGLChecker::OpenGLChecker()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OpenGLChecker::hasCompatibleOpenGLVersion()
|
||||||
|
{
|
||||||
|
QOpenGLContext * openGLContext = new QOpenGLContext();
|
||||||
|
openGLContext->create();
|
||||||
|
|
||||||
|
if(!openGLContext->isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QSurfaceFormat format = openGLContext->format();
|
||||||
|
|
||||||
|
int majorVersion = format.majorVersion();
|
||||||
|
int minorVersion = format.minorVersion();
|
||||||
|
|
||||||
|
delete openGLContext;
|
||||||
|
|
||||||
|
QLOG_INFO() << QString("OpenGL version %1.%2").arg(majorVersion).arg(minorVersion);
|
||||||
|
|
||||||
|
if(format.renderableType() != QSurfaceFormat::OpenGL) //Desktop OpenGL
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN //TODO check Qt version, and set this values depending on the use of QOpenGLWidget or QGLWidget
|
||||||
|
int majorTargetVersion = 1;
|
||||||
|
int minorTargetVersion = 5;
|
||||||
|
#else
|
||||||
|
int majorTargetVersion = 2;
|
||||||
|
int minorTargetVersion = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(majorVersion < majorTargetVersion)
|
||||||
|
return false;
|
||||||
|
if(majorVersion == majorTargetVersion && minorVersion < minorTargetVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
15
common/opengl_checker.h
Normal file
15
common/opengl_checker.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef OPENGL_CHECKER_H
|
||||||
|
#define OPENGL_CHECKER_H
|
||||||
|
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
|
||||||
|
class OpenGLChecker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenGLChecker();
|
||||||
|
bool hasCompatibleOpenGLVersion();
|
||||||
|
private:
|
||||||
|
//??
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPENGL_CHECKER_H
|
Loading…
x
Reference in New Issue
Block a user