mirror of
https://github.com/YACReader/yacreader
synced 2026-03-01 10:22:58 -05:00
Add an initial rhi implementation that mimics the opengl implementation
This commit is contained in:
@ -27,10 +27,20 @@ INCLUDEPATH += ../common \
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
INCLUDEPATH += ../common/gl
|
||||
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
|
||||
INCLUDEPATH += ../common/rhi
|
||||
DEFINES += YACREADER_USE_RHI
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -luser32
|
||||
LIBS += -loleaut32 -lole32 -lshell32 -luser32
|
||||
# When using RHI (Qt 6.7+), don't link OpenGL directly - QRhiWidget handles graphics APIs
|
||||
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
|
||||
message("RHI mode: not linking opengl32 (using QRhiWidget)")
|
||||
} else {
|
||||
LIBS += -lopengl32
|
||||
}
|
||||
|
||||
msvc {
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
@ -51,6 +61,10 @@ QT += network widgets core multimedia svg
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5): QT += openglwidgets core5compat
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
|
||||
QT += gui-private
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
|
||||
@ -93,6 +107,10 @@ HEADERS += ../common/comic.h \
|
||||
!CONFIG(no_opengl) {
|
||||
HEADERS += ../common/gl/yacreader_flow_gl.h \
|
||||
goto_flow_gl.h
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
|
||||
HEADERS += ../common/rhi/yacreader_flow_rhi.h
|
||||
}
|
||||
}
|
||||
|
||||
SOURCES += ../common/comic.cpp \
|
||||
@ -132,6 +150,11 @@ SOURCES += ../common/comic.cpp \
|
||||
!CONFIG(no_opengl) {
|
||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp \
|
||||
goto_flow_gl.cpp
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 6) {
|
||||
SOURCES += ../common/rhi/yacreader_flow_rhi.cpp
|
||||
RESOURCES += ../common/rhi/shaders/shaders.qrc
|
||||
}
|
||||
}
|
||||
|
||||
include(../custom_widgets/custom_widgets_yacreader.pri)
|
||||
|
||||
@ -15,17 +15,17 @@ GoToFlowGL::GoToFlowGL(QWidget *parent, FlowType flowType)
|
||||
: GoToFlowWidget(parent)
|
||||
{
|
||||
Q_UNUSED(flowType)
|
||||
flow = new YACReaderPageFlowGL(this);
|
||||
flow = new YACReaderPageFlowImpl(this);
|
||||
flow->setShowMarks(false);
|
||||
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
|
||||
flow->setSlideSize(imageSize);
|
||||
connect(flow, &YACReaderFlowGL::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
|
||||
connect(flow, &YACReaderFlowGL::selected, this, &GoToFlowGL::goToPage);
|
||||
connect(flow, &YACReaderPageFlowImpl::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
|
||||
connect(flow, &YACReaderPageFlowImpl::selected, this, &GoToFlowGL::goToPage);
|
||||
|
||||
connect(toolBar, &GoToFlowToolBar::goToPage, this, &GoToFlowGL::goToPage);
|
||||
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &YACReaderFlowGL::setCenterIndex);
|
||||
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &YACReaderPageFlowImpl::setCenterIndex);
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
|
||||
@ -3,7 +3,15 @@
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "goto_flow_widget.h"
|
||||
|
||||
// Conditional include based on Qt version and RHI availability
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) && defined(YACREADER_USE_RHI)
|
||||
#include "yacreader_flow_rhi.h"
|
||||
using YACReaderPageFlowImpl = YACReaderPageFlow3D;
|
||||
#else
|
||||
#include "yacreader_flow_gl.h"
|
||||
using YACReaderPageFlowImpl = YACReaderPageFlowGL;
|
||||
#endif
|
||||
|
||||
class QLineEdit;
|
||||
class QIntValidator;
|
||||
@ -28,7 +36,7 @@ public:
|
||||
void setFlowRightToLeft(bool b) override;
|
||||
|
||||
private:
|
||||
YACReaderPageFlowGL *flow;
|
||||
YACReaderPageFlowImpl *flow;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
// Comic * comic;
|
||||
|
||||
@ -86,6 +86,13 @@ Viewer::Viewer(QWidget *parent)
|
||||
// CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
#ifndef NO_OPENGL
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) && defined(YACREADER_USE_RHI)
|
||||
// When using RHI, don't check OpenGL - assume hardware acceleration is available
|
||||
bool openGLAvailable = true;
|
||||
|
||||
if (!settings->contains(USE_OPEN_GL))
|
||||
settings->setValue(USE_OPEN_GL, 2);
|
||||
#else
|
||||
OpenGLChecker openGLChecker;
|
||||
bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion();
|
||||
|
||||
@ -93,6 +100,7 @@ Viewer::Viewer(QWidget *parent)
|
||||
settings->setValue(USE_OPEN_GL, 2);
|
||||
else if (!openGLAvailable)
|
||||
settings->setValue(USE_OPEN_GL, 0);
|
||||
#endif
|
||||
|
||||
if ((settings->value(USE_OPEN_GL).toBool() == true))
|
||||
goToFlow = new GoToFlowGL(this, Configuration::getConfiguration().getFlowType());
|
||||
|
||||
Reference in New Issue
Block a user