From 33aaf19fe6db0f5a09d797d6c1da58c7c8b4f759 Mon Sep 17 00:00:00 2001 From: Felix Kauselmann <2039670+selmf@users.noreply.github.com> Date: Tue, 17 Feb 2015 11:33:32 +0100 Subject: [PATCH] NO_OPENGL support for Reader --- YACReader/YACReader.pri | 11 +++---- YACReader/YACReader.pro | 2 +- YACReader/options_dialog.cpp | 7 ++++- YACReader/viewer.cpp | 9 +++++- YACReaderLibrary/YACReaderLibrary.pro | 5 ++-- custom_widgets/yacreader_options_dialog.cpp | 33 +++++++++++++++------ custom_widgets/yacreader_options_dialog.h | 9 +++++- 7 files changed, 56 insertions(+), 20 deletions(-) diff --git a/YACReader/YACReader.pri b/YACReader/YACReader.pri index b4c9ba4e..56627b50 100644 --- a/YACReader/YACReader.pri +++ b/YACReader/YACReader.pri @@ -57,7 +57,8 @@ HEADERS += $$PWD/../common/pdf_comic.h } -QT += network opengl +QT += network widgets core +#opengl #CONFIG += release CONFIG -= flat @@ -81,7 +82,7 @@ HEADERS += $$PWD/../common/comic.h \ $$PWD/render.h \ $$PWD/shortcuts_dialog.h \ $$PWD/translator.h \ - $$PWD/goto_flow_gl.h \ + #$$PWD/goto_flow_gl.h \ $$PWD/goto_flow_widget.h \ $$PWD/page_label_widget.h \ $$PWD/goto_flow_toolbar.h \ @@ -92,7 +93,7 @@ HEADERS += $$PWD/../common/comic.h \ $$PWD/../common/custom_widgets.h \ $$PWD/../common/check_new_version.h \ $$PWD/../common/qnaturalsorting.h \ - $$PWD/../common/yacreader_flow_gl.h \ + #$$PWD/../common/yacreader_flow_gl.h \ $$PWD/../common/yacreader_global.h \ $$PWD/../common/onstart_flow_selection_dialog.h \ $$PWD/../common/comic_db.h \ @@ -116,7 +117,7 @@ SOURCES += $$PWD/../common/comic.cpp \ $$PWD/render.cpp \ $$PWD/shortcuts_dialog.cpp \ $$PWD/translator.cpp \ - $$PWD/goto_flow_gl.cpp \ + #$$PWD/goto_flow_gl.cpp \ $$PWD/goto_flow_widget.cpp \ $$PWD/page_label_widget.cpp \ $$PWD/goto_flow_toolbar.cpp \ @@ -127,7 +128,7 @@ SOURCES += $$PWD/../common/comic.cpp \ $$PWD/../common/custom_widgets.cpp \ $$PWD/../common/check_new_version.cpp \ $$PWD/../common/qnaturalsorting.cpp \ - $$PWD/../common/yacreader_flow_gl.cpp \ + #$$PWD/../common/yacreader_flow_gl.cpp \ $$PWD/../common/onstart_flow_selection_dialog.cpp \ $$PWD/../common/comic_db.cpp \ $$PWD/../common/folder.cpp \ diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 1b189b16..7eca55a3 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -6,7 +6,7 @@ TARGET = YACReader DEPENDPATH += . \ release -DEFINES += NOMINMAX YACREADER +DEFINES += NOMINMAX YACREADER NO_OPENGL unix:!macx{ QMAKE_CXXFLAGS += -std=c++11 diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 3a6e751f..2ed4eee2 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -14,7 +14,9 @@ #include "yacreader_spin_slider_widget.h" #include "yacreader_flow_config_widget.h" +#ifndef NO_OPENGL #include "yacreader_gl_flow_config_widget.h" +#endif OptionsDialog::OptionsDialog(QWidget * parent) :YACReaderOptionsDialog(parent) @@ -116,8 +118,10 @@ OptionsDialog::OptionsDialog(QWidget * parent) layoutGeneral->addWidget(shortcutsBox); layoutGeneral->addStretch(); layoutFlow->addWidget(sw); +#ifndef NO_OPENGL layoutFlow->addWidget(gl); layoutFlow->addWidget(useGL); +#endif layoutFlow->addStretch(); layoutImage->addWidget(new QLabel(tr("Brightness")),0,0); layoutImage->addWidget(new QLabel(tr("Contrast")),1,0); @@ -151,8 +155,9 @@ OptionsDialog::OptionsDialog(QWidget * parent) setLayout(layout); //disable vSyncCheck +#ifndef NO_OPENGL gl->vSyncCheck->hide(); - +#endif //restoreOptions(); //load options //resize(400,0); setModal (true); diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 44ab17bf..c4391e20 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -3,7 +3,11 @@ #include "configuration.h" #include "magnifying_glass.h" #include "goto_flow.h" +#ifndef NO_OPENGL #include "goto_flow_gl.h" +#else +#include +#endif #include "bookmarks_dialog.h" #include "render.h" #include "goto_dialog.h" @@ -67,6 +71,7 @@ shouldOpenPrevious(false) QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat); //CONFIG GOTO_FLOW-------------------------------------------------------- +#ifndef NO_OPENGL if(!settings->contains(USE_OPEN_GL)) { settings->setValue(USE_OPEN_GL,2); @@ -76,7 +81,9 @@ shouldOpenPrevious(false) goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType()); else goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); - +#else + goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); +#endif goToFlow->setFocusPolicy(Qt::StrongFocus); goToFlow->hide(); showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos"); diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index be62fe6d..b276c9a6 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -13,7 +13,7 @@ INCLUDEPATH += ../common \ ./comic_vine \ ./comic_vine/model -DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY +DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY NO_OPENGL win32 { @@ -72,7 +72,8 @@ QMAKE_CXXFLAGS += -std=c++11 #CONFIG += release CONFIG -= flat -QT += sql network opengl script +QT += sql network widgets script +#opengl # Input HEADERS += comic_flow.h \ diff --git a/custom_widgets/yacreader_options_dialog.cpp b/custom_widgets/yacreader_options_dialog.cpp index c89b44dc..a6f4d91f 100644 --- a/custom_widgets/yacreader_options_dialog.cpp +++ b/custom_widgets/yacreader_options_dialog.cpp @@ -1,7 +1,11 @@ #include "yacreader_options_dialog.h" #include "yacreader_flow_config_widget.h" +#ifndef NO_OPENGL #include "yacreader_gl_flow_config_widget.h" +#else +#include "pictureflow.h" +#endif #include "yacreader_spin_slider_widget.h" #include "yacreader_global.h" @@ -11,14 +15,16 @@ #include #include #include +#include YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) :QDialog(parent) { sw = new YACReaderFlowConfigWidget(this); +#ifndef NO_OPENGL gl = new YACReaderGLFlowConfigWidget(this); - +#endif accept = new QPushButton(tr("Save")); cancel = new QPushButton(tr("Cancel")); @@ -37,15 +43,15 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions())); connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this connect(cancel,SIGNAL(clicked()),this,SLOT(close())); - +#ifndef NO_OPENGL useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)")); connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int))); - +#endif //sw CONNECTIONS connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW())); connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW())); connect(sw->radio3,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfigSW())); - +#ifndef NO_OPENGL //gl CONNECTIONS connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig())); connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig())); @@ -122,6 +128,9 @@ void YACReaderOptionsDialog::saveFlowParameters() settings->setValue(LIGHT_STRENGTH,gl->lightStrength->getValue()); settings->setValue(MAX_ANGLE,gl->maxAngle->getValue()); } +#else +} +#endif void YACReaderOptionsDialog::saveOptions() { @@ -129,8 +138,10 @@ void YACReaderOptionsDialog::saveOptions() close(); } +#ifndef NO_OPENGL void YACReaderOptionsDialog::saveUseGL(int b) { + if(Qt::Checked == b) { sw->setVisible(false); @@ -144,9 +155,10 @@ void YACReaderOptionsDialog::saveUseGL(int b) resize(0,0); settings->setValue(USE_OPEN_GL,b); - } +#endif +#ifndef NO_OPENGL void YACReaderOptionsDialog::saveXRotation(int value) { settings->setValue(FLOW_TYPE_GL,Custom); @@ -203,13 +215,13 @@ void YACReaderOptionsDialog::saveMaxAngle(int value) settings->setValue(FLOW_TYPE_GL,Custom); settings->setValue(MAX_ANGLE,value); } - +#endif void YACReaderOptionsDialog::restoreOptions(QSettings * settings) { this->settings = settings; //FLOW CONFIG - +#ifndef NO_OPENGL if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked) { sw->setVisible(false); @@ -305,8 +317,9 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) } //END FLOW CONFIG + #endif } - +#ifndef NO_OPENGL void YACReaderOptionsDialog::loadConfig() { gl->xRotation->setValue(settings->value(X_ROTATION).toInt()); @@ -321,7 +334,7 @@ void YACReaderOptionsDialog::loadConfig() gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt()); gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt()); } - +#endif void YACReaderOptionsDialog::setClassicConfigSW() { settings->setValue(FLOW_TYPE_SW,CoverFlowLike); @@ -337,6 +350,7 @@ void YACReaderOptionsDialog::setOverlappedStripeConfigSW() settings->setValue(FLOW_TYPE_SW,StripOverlapped); } +#ifndef NO_OPENGL void YACReaderOptionsDialog::setClassicConfig() { settings->setValue(FLOW_TYPE_GL,CoverFlowLike); @@ -381,3 +395,4 @@ void YACReaderOptionsDialog::setRouletteConfig() saveFlowParameters(); } +#endif \ No newline at end of file diff --git a/custom_widgets/yacreader_options_dialog.h b/custom_widgets/yacreader_options_dialog.h index 9b347ae8..8921e661 100644 --- a/custom_widgets/yacreader_options_dialog.h +++ b/custom_widgets/yacreader_options_dialog.h @@ -4,7 +4,9 @@ #include class YACReaderFlowConfigWidget; +#ifndef NO_OPENGL class YACReaderGLFlowConfigWidget; +#endif class QCheckBox; class QPushButton; class QSettings; @@ -15,8 +17,10 @@ class YACReaderOptionsDialog : public QDialog Q_OBJECT protected: YACReaderFlowConfigWidget * sw; + #ifndef NO_OPENGL YACReaderGLFlowConfigWidget * gl; QCheckBox * useGL; + #endif QPushButton * accept; QPushButton * cancel; @@ -32,6 +36,7 @@ public slots: virtual void restoreOptions(QSettings * settings); virtual void saveOptions(); protected slots: +#ifndef NO_OPENGL virtual void savePerformance(int value); virtual void saveUseVSync(int b); virtual void saveUseGL(int b); @@ -52,10 +57,12 @@ protected slots: virtual void setOverlappedStripeConfig(); virtual void setModernConfig(); virtual void setRouletteConfig(); + virtual void saveFlowParameters(); +#endif virtual void setClassicConfigSW(); virtual void setStripeConfigSW(); virtual void setOverlappedStripeConfigSW(); - virtual void saveFlowParameters(); + signals: void optionsChanged();