Fix build for Qt 5.3

This commit is contained in:
Felix Kauselmann 2017-11-05 17:56:39 +01:00
parent 237cb02638
commit a0e3046be7
2 changed files with 92 additions and 80 deletions

View File

@ -200,7 +200,7 @@ struct Preset pressetYACReaderFlowDownConfig = {
};
/*Constructor*/
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p)
:QGLWidget(QGLFormat(QGL::SampleBuffers), parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false)
:QGLWidget(QGLFormat(QGL::SampleBuffers), parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false),flowRightToLeft(false)
{
updateCount = 0;
config = p;
@ -354,6 +354,9 @@ void YACReaderFlowGL::udpatePerspective(int width, int height)
/*Private*/
void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos)
{
if(flowRightToLeft){
pos = pos * -1;
}
if(pos == 0){
image.current = centerPos;
}else{
@ -1025,6 +1028,11 @@ void YACReaderFlowGL::render()
//do nothing
}
void YACReaderFlowGL::setFlowRightToLeft(bool b)
{
flowRightToLeft = b;
}
//EVENTOS
void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
{
@ -1045,7 +1053,7 @@ void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
{
if(event->key() == Qt::Key_Left)
if((event->key() == Qt::Key_Left && !flowRightToLeft) || (event->key() == Qt::Key_Right && flowRightToLeft))
{
if(event->modifiers() == Qt::ControlModifier)
setCurrentIndex((currentSelected-10<0)?0:currentSelected-10);
@ -1055,7 +1063,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
return;
}
if(event->key() == Qt::Key_Right)
if((event->key() == Qt::Key_Right && !flowRightToLeft) || (event->key() == Qt::Key_Left && flowRightToLeft))
{
if(event->modifiers() == Qt::ControlModifier)
setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10);
@ -1098,7 +1106,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
if(posX >= 0.5)
if((posX >= 0.5 && !flowRightToLeft) || (posX <=-0.5 && flowRightToLeft))
{
//int index = currentSelected+1;
//while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX)
@ -1106,7 +1114,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
//setCurrentIndex(index-1);
showNext();
}
else if(posX <=-0.5)
else if((posX <=-0.5 && !flowRightToLeft) || (posX >= 0.5 && flowRightToLeft) )
showPrevious();
} else
QGLWidget::mousePressEvent(event);
@ -1595,4 +1603,3 @@ QImage ImageLoaderByteArrayGL::result()
{
return img;
}

View File

@ -143,6 +143,9 @@ protected:
QVector<YACReader3DImage> images;
bool hasBeenInitialized;
// sets flow direction right-to-left (manga mode)
bool flowRightToLeft;
Performance performance;
bool bUseVSync;
@ -248,6 +251,8 @@ public:
void useVSync(bool b);
void setFlowRightToLeft(bool b);
virtual void updateImageData() = 0;
void reset();