NO_OPENGL support for Reader

This commit is contained in:
Felix Kauselmann 2015-02-17 11:33:32 +01:00
parent 88239f4f88
commit 33aaf19fe6
7 changed files with 56 additions and 20 deletions

View File

@ -57,7 +57,8 @@ HEADERS += $$PWD/../common/pdf_comic.h
} }
QT += network opengl QT += network widgets core
#opengl
#CONFIG += release #CONFIG += release
CONFIG -= flat CONFIG -= flat
@ -81,7 +82,7 @@ HEADERS += $$PWD/../common/comic.h \
$$PWD/render.h \ $$PWD/render.h \
$$PWD/shortcuts_dialog.h \ $$PWD/shortcuts_dialog.h \
$$PWD/translator.h \ $$PWD/translator.h \
$$PWD/goto_flow_gl.h \ #$$PWD/goto_flow_gl.h \
$$PWD/goto_flow_widget.h \ $$PWD/goto_flow_widget.h \
$$PWD/page_label_widget.h \ $$PWD/page_label_widget.h \
$$PWD/goto_flow_toolbar.h \ $$PWD/goto_flow_toolbar.h \
@ -92,7 +93,7 @@ HEADERS += $$PWD/../common/comic.h \
$$PWD/../common/custom_widgets.h \ $$PWD/../common/custom_widgets.h \
$$PWD/../common/check_new_version.h \ $$PWD/../common/check_new_version.h \
$$PWD/../common/qnaturalsorting.h \ $$PWD/../common/qnaturalsorting.h \
$$PWD/../common/yacreader_flow_gl.h \ #$$PWD/../common/yacreader_flow_gl.h \
$$PWD/../common/yacreader_global.h \ $$PWD/../common/yacreader_global.h \
$$PWD/../common/onstart_flow_selection_dialog.h \ $$PWD/../common/onstart_flow_selection_dialog.h \
$$PWD/../common/comic_db.h \ $$PWD/../common/comic_db.h \
@ -116,7 +117,7 @@ SOURCES += $$PWD/../common/comic.cpp \
$$PWD/render.cpp \ $$PWD/render.cpp \
$$PWD/shortcuts_dialog.cpp \ $$PWD/shortcuts_dialog.cpp \
$$PWD/translator.cpp \ $$PWD/translator.cpp \
$$PWD/goto_flow_gl.cpp \ #$$PWD/goto_flow_gl.cpp \
$$PWD/goto_flow_widget.cpp \ $$PWD/goto_flow_widget.cpp \
$$PWD/page_label_widget.cpp \ $$PWD/page_label_widget.cpp \
$$PWD/goto_flow_toolbar.cpp \ $$PWD/goto_flow_toolbar.cpp \
@ -127,7 +128,7 @@ SOURCES += $$PWD/../common/comic.cpp \
$$PWD/../common/custom_widgets.cpp \ $$PWD/../common/custom_widgets.cpp \
$$PWD/../common/check_new_version.cpp \ $$PWD/../common/check_new_version.cpp \
$$PWD/../common/qnaturalsorting.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/onstart_flow_selection_dialog.cpp \
$$PWD/../common/comic_db.cpp \ $$PWD/../common/comic_db.cpp \
$$PWD/../common/folder.cpp \ $$PWD/../common/folder.cpp \

View File

@ -6,7 +6,7 @@ TARGET = YACReader
DEPENDPATH += . \ DEPENDPATH += . \
release release
DEFINES += NOMINMAX YACREADER DEFINES += NOMINMAX YACREADER NO_OPENGL
unix:!macx{ unix:!macx{
QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -std=c++11

View File

@ -14,7 +14,9 @@
#include "yacreader_spin_slider_widget.h" #include "yacreader_spin_slider_widget.h"
#include "yacreader_flow_config_widget.h" #include "yacreader_flow_config_widget.h"
#ifndef NO_OPENGL
#include "yacreader_gl_flow_config_widget.h" #include "yacreader_gl_flow_config_widget.h"
#endif
OptionsDialog::OptionsDialog(QWidget * parent) OptionsDialog::OptionsDialog(QWidget * parent)
:YACReaderOptionsDialog(parent) :YACReaderOptionsDialog(parent)
@ -116,8 +118,10 @@ OptionsDialog::OptionsDialog(QWidget * parent)
layoutGeneral->addWidget(shortcutsBox); layoutGeneral->addWidget(shortcutsBox);
layoutGeneral->addStretch(); layoutGeneral->addStretch();
layoutFlow->addWidget(sw); layoutFlow->addWidget(sw);
#ifndef NO_OPENGL
layoutFlow->addWidget(gl); layoutFlow->addWidget(gl);
layoutFlow->addWidget(useGL); layoutFlow->addWidget(useGL);
#endif
layoutFlow->addStretch(); layoutFlow->addStretch();
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0); layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0); layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
@ -151,8 +155,9 @@ OptionsDialog::OptionsDialog(QWidget * parent)
setLayout(layout); setLayout(layout);
//disable vSyncCheck //disable vSyncCheck
#ifndef NO_OPENGL
gl->vSyncCheck->hide(); gl->vSyncCheck->hide();
#endif
//restoreOptions(); //load options //restoreOptions(); //load options
//resize(400,0); //resize(400,0);
setModal (true); setModal (true);

View File

@ -3,7 +3,11 @@
#include "configuration.h" #include "configuration.h"
#include "magnifying_glass.h" #include "magnifying_glass.h"
#include "goto_flow.h" #include "goto_flow.h"
#ifndef NO_OPENGL
#include "goto_flow_gl.h" #include "goto_flow_gl.h"
#else
#include <QtWidgets>
#endif
#include "bookmarks_dialog.h" #include "bookmarks_dialog.h"
#include "render.h" #include "render.h"
#include "goto_dialog.h" #include "goto_dialog.h"
@ -67,6 +71,7 @@ shouldOpenPrevious(false)
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat); QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
//CONFIG GOTO_FLOW-------------------------------------------------------- //CONFIG GOTO_FLOW--------------------------------------------------------
#ifndef NO_OPENGL
if(!settings->contains(USE_OPEN_GL)) if(!settings->contains(USE_OPEN_GL))
{ {
settings->setValue(USE_OPEN_GL,2); settings->setValue(USE_OPEN_GL,2);
@ -76,7 +81,9 @@ shouldOpenPrevious(false)
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType()); goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
else else
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
#else
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
#endif
goToFlow->setFocusPolicy(Qt::StrongFocus); goToFlow->setFocusPolicy(Qt::StrongFocus);
goToFlow->hide(); goToFlow->hide();
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos"); showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");

View File

@ -13,7 +13,7 @@ INCLUDEPATH += ../common \
./comic_vine \ ./comic_vine \
./comic_vine/model ./comic_vine/model
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY NO_OPENGL
win32 { win32 {
@ -72,7 +72,8 @@ QMAKE_CXXFLAGS += -std=c++11
#CONFIG += release #CONFIG += release
CONFIG -= flat CONFIG -= flat
QT += sql network opengl script QT += sql network widgets script
#opengl
# Input # Input
HEADERS += comic_flow.h \ HEADERS += comic_flow.h \

View File

@ -1,7 +1,11 @@
#include "yacreader_options_dialog.h" #include "yacreader_options_dialog.h"
#include "yacreader_flow_config_widget.h" #include "yacreader_flow_config_widget.h"
#ifndef NO_OPENGL
#include "yacreader_gl_flow_config_widget.h" #include "yacreader_gl_flow_config_widget.h"
#else
#include "pictureflow.h"
#endif
#include "yacreader_spin_slider_widget.h" #include "yacreader_spin_slider_widget.h"
#include "yacreader_global.h" #include "yacreader_global.h"
@ -11,14 +15,16 @@
#include <QSlider> #include <QSlider>
#include <QSettings> #include <QSettings>
#include <QGroupBox> #include <QGroupBox>
#include <QVBoxLayout>
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
:QDialog(parent) :QDialog(parent)
{ {
sw = new YACReaderFlowConfigWidget(this); sw = new YACReaderFlowConfigWidget(this);
#ifndef NO_OPENGL
gl = new YACReaderGLFlowConfigWidget(this); gl = new YACReaderGLFlowConfigWidget(this);
#endif
accept = new QPushButton(tr("Save")); accept = new QPushButton(tr("Save"));
cancel = new QPushButton(tr("Cancel")); cancel = new QPushButton(tr("Cancel"));
@ -37,15 +43,15 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions())); connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this
connect(cancel,SIGNAL(clicked()),this,SLOT(close())); connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
#ifndef NO_OPENGL
useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)")); useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)"));
connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int))); connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int)));
#endif
//sw CONNECTIONS //sw CONNECTIONS
connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW())); connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW()));
connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW())); connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW()));
connect(sw->radio3,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfigSW())); connect(sw->radio3,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfigSW()));
#ifndef NO_OPENGL
//gl CONNECTIONS //gl CONNECTIONS
connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig())); connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig())); 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(LIGHT_STRENGTH,gl->lightStrength->getValue());
settings->setValue(MAX_ANGLE,gl->maxAngle->getValue()); settings->setValue(MAX_ANGLE,gl->maxAngle->getValue());
} }
#else
}
#endif
void YACReaderOptionsDialog::saveOptions() void YACReaderOptionsDialog::saveOptions()
{ {
@ -129,8 +138,10 @@ void YACReaderOptionsDialog::saveOptions()
close(); close();
} }
#ifndef NO_OPENGL
void YACReaderOptionsDialog::saveUseGL(int b) void YACReaderOptionsDialog::saveUseGL(int b)
{ {
if(Qt::Checked == b) if(Qt::Checked == b)
{ {
sw->setVisible(false); sw->setVisible(false);
@ -144,9 +155,10 @@ void YACReaderOptionsDialog::saveUseGL(int b)
resize(0,0); resize(0,0);
settings->setValue(USE_OPEN_GL,b); settings->setValue(USE_OPEN_GL,b);
} }
#endif
#ifndef NO_OPENGL
void YACReaderOptionsDialog::saveXRotation(int value) void YACReaderOptionsDialog::saveXRotation(int value)
{ {
settings->setValue(FLOW_TYPE_GL,Custom); settings->setValue(FLOW_TYPE_GL,Custom);
@ -203,13 +215,13 @@ void YACReaderOptionsDialog::saveMaxAngle(int value)
settings->setValue(FLOW_TYPE_GL,Custom); settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(MAX_ANGLE,value); settings->setValue(MAX_ANGLE,value);
} }
#endif
void YACReaderOptionsDialog::restoreOptions(QSettings * settings) void YACReaderOptionsDialog::restoreOptions(QSettings * settings)
{ {
this->settings = settings; this->settings = settings;
//FLOW CONFIG //FLOW CONFIG
#ifndef NO_OPENGL
if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked) if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked)
{ {
sw->setVisible(false); sw->setVisible(false);
@ -305,8 +317,9 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings)
} }
//END FLOW CONFIG //END FLOW CONFIG
#endif
} }
#ifndef NO_OPENGL
void YACReaderOptionsDialog::loadConfig() void YACReaderOptionsDialog::loadConfig()
{ {
gl->xRotation->setValue(settings->value(X_ROTATION).toInt()); gl->xRotation->setValue(settings->value(X_ROTATION).toInt());
@ -321,7 +334,7 @@ void YACReaderOptionsDialog::loadConfig()
gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt()); gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt());
gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt()); gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt());
} }
#endif
void YACReaderOptionsDialog::setClassicConfigSW() void YACReaderOptionsDialog::setClassicConfigSW()
{ {
settings->setValue(FLOW_TYPE_SW,CoverFlowLike); settings->setValue(FLOW_TYPE_SW,CoverFlowLike);
@ -337,6 +350,7 @@ void YACReaderOptionsDialog::setOverlappedStripeConfigSW()
settings->setValue(FLOW_TYPE_SW,StripOverlapped); settings->setValue(FLOW_TYPE_SW,StripOverlapped);
} }
#ifndef NO_OPENGL
void YACReaderOptionsDialog::setClassicConfig() void YACReaderOptionsDialog::setClassicConfig()
{ {
settings->setValue(FLOW_TYPE_GL,CoverFlowLike); settings->setValue(FLOW_TYPE_GL,CoverFlowLike);
@ -381,3 +395,4 @@ void YACReaderOptionsDialog::setRouletteConfig()
saveFlowParameters(); saveFlowParameters();
} }
#endif

View File

@ -4,7 +4,9 @@
#include <QDialog> #include <QDialog>
class YACReaderFlowConfigWidget; class YACReaderFlowConfigWidget;
#ifndef NO_OPENGL
class YACReaderGLFlowConfigWidget; class YACReaderGLFlowConfigWidget;
#endif
class QCheckBox; class QCheckBox;
class QPushButton; class QPushButton;
class QSettings; class QSettings;
@ -15,8 +17,10 @@ class YACReaderOptionsDialog : public QDialog
Q_OBJECT Q_OBJECT
protected: protected:
YACReaderFlowConfigWidget * sw; YACReaderFlowConfigWidget * sw;
#ifndef NO_OPENGL
YACReaderGLFlowConfigWidget * gl; YACReaderGLFlowConfigWidget * gl;
QCheckBox * useGL; QCheckBox * useGL;
#endif
QPushButton * accept; QPushButton * accept;
QPushButton * cancel; QPushButton * cancel;
@ -32,6 +36,7 @@ public slots:
virtual void restoreOptions(QSettings * settings); virtual void restoreOptions(QSettings * settings);
virtual void saveOptions(); virtual void saveOptions();
protected slots: protected slots:
#ifndef NO_OPENGL
virtual void savePerformance(int value); virtual void savePerformance(int value);
virtual void saveUseVSync(int b); virtual void saveUseVSync(int b);
virtual void saveUseGL(int b); virtual void saveUseGL(int b);
@ -52,10 +57,12 @@ protected slots:
virtual void setOverlappedStripeConfig(); virtual void setOverlappedStripeConfig();
virtual void setModernConfig(); virtual void setModernConfig();
virtual void setRouletteConfig(); virtual void setRouletteConfig();
virtual void saveFlowParameters();
#endif
virtual void setClassicConfigSW(); virtual void setClassicConfigSW();
virtual void setStripeConfigSW(); virtual void setStripeConfigSW();
virtual void setOverlappedStripeConfigSW(); virtual void setOverlappedStripeConfigSW();
virtual void saveFlowParameters();
signals: signals:
void optionsChanged(); void optionsChanged();