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*/ /*Constructor*/
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) 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; updateCount = 0;
config = p; config = p;
@ -354,6 +354,9 @@ void YACReaderFlowGL::udpatePerspective(int width, int height)
/*Private*/ /*Private*/
void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos) void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos)
{ {
if(flowRightToLeft){
pos = pos * -1;
}
if(pos == 0){ if(pos == 0){
image.current = centerPos; image.current = centerPos;
}else{ }else{
@ -1025,6 +1028,11 @@ void YACReaderFlowGL::render()
//do nothing //do nothing
} }
void YACReaderFlowGL::setFlowRightToLeft(bool b)
{
flowRightToLeft = b;
}
//EVENTOS //EVENTOS
void YACReaderFlowGL::wheelEvent(QWheelEvent * event) void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
{ {
@ -1045,7 +1053,7 @@ void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
void YACReaderFlowGL::keyPressEvent(QKeyEvent *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) if(event->modifiers() == Qt::ControlModifier)
setCurrentIndex((currentSelected-10<0)?0:currentSelected-10); setCurrentIndex((currentSelected-10<0)?0:currentSelected-10);
@ -1055,7 +1063,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
return; 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) if(event->modifiers() == Qt::ControlModifier)
setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10); 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); 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; //int index = currentSelected+1;
//while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX) //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); //setCurrentIndex(index-1);
showNext(); showNext();
} }
else if(posX <=-0.5) else if((posX <=-0.5 && !flowRightToLeft) || (posX >= 0.5 && flowRightToLeft) )
showPrevious(); showPrevious();
} else } else
QGLWidget::mousePressEvent(event); QGLWidget::mousePressEvent(event);
@ -1595,4 +1603,3 @@ QImage ImageLoaderByteArrayGL::result()
{ {
return img; return img;
} }

View File

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