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 -= 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 \

View File

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

View File

@ -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);

View File

@ -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 <QtWidgets>
#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");

View File

@ -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 \

View File

@ -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 <QSlider>
#include <QSettings>
#include <QGroupBox>
#include <QVBoxLayout>
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

View File

@ -4,7 +4,9 @@
#include <QDialog>
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();