Reading status added

sending comic info to yacreaderlibrary on openNext/openPrevious
This commit is contained in:
Luis Ángel San Martín
2013-07-21 23:18:50 +02:00
parent 020219a3a4
commit 79fe9a3f2d
19 changed files with 196 additions and 121 deletions

View File

@ -192,7 +192,7 @@ public:
PictureFlow::ReflectionEffect reflectionEffect;
QVector<QImage*> slideImages;
QVector<bool> marks;
QVector<YACReaderComicReadStatus> marks;
bool showMarks;
QImage mark;
@ -1076,7 +1076,7 @@ void PictureFlow::addSlide(const QImage& image)
d->state->slideImages.resize(c+1);
d->state->slideImages[c] = new QImage(image);
d->state->marks.resize(c+1);
d->state->marks[c] = false;
d->state->marks[c] = YACReaderComicReadStatus::Unread;
triggerRender();
}
@ -1345,10 +1345,10 @@ void PictureFlow::setMarkImage(const QImage & m)
d->state->mark = m;
}
void PictureFlow::markSlide(int index)
void PictureFlow::markSlide(int index, YACReaderComicReadStatus readStatus)
{
if(index<d->state->marks.size())
d->state->marks[index] = true;
d->state->marks[index] = readStatus;
}
void PictureFlow::updateMarks()
@ -1361,10 +1361,10 @@ void PictureFlow::updateMarks()
void PictureFlow::unmarkSlide(int index)
{
if(index<d->state->marks.size())
d->state->marks[index] = false;
d->state->marks[index] = YACReaderComicReadStatus::Unread;
}
void PictureFlow::setMarks(const QVector<bool> & m)
void PictureFlow::setMarks(const QVector<YACReaderComicReadStatus> & m)
{
d->state->marks = m;
updateMarks();
@ -1376,7 +1376,7 @@ void PictureFlow::setShowMarks(bool enable)
updateMarks();
}
QVector<bool> PictureFlow::getMarks()
QVector<YACReaderComicReadStatus > PictureFlow::getMarks()
{
return d->state->marks;
}

View File

@ -189,17 +189,17 @@ public slots:
void setMarkImage(const QImage & mark);
void markSlide(int index);
void markSlide(int index, YACReaderComicReadStatus readStatus = Read);
void updateMarks();
void unmarkSlide(int index);
void setMarks(const QVector<bool> & marks);
void setMarks(const QVector<YACReaderComicReadStatus> & marks);
void setShowMarks(bool enable);
QVector<bool> getMarks();
QVector<YACReaderComicReadStatus> getMarks();
signals:
@ -218,7 +218,6 @@ private slots:
private:
PictureFlowPrivate* d;
QImage mark;
QVector<bool> marks;
int framesSkip;
};

View File

@ -280,7 +280,7 @@ void YACReaderFlowGL::initializeGL()
defaultTexture = bindTexture(QImage(":/images/defaultCover.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
markTexture = bindTexture(QImage(":/images/readRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
readingTexture = bindTexture(QImage(":/images/readingRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
if(lazyPopulateObjects!=-1)
populate(lazyPopulateObjects);
@ -454,10 +454,13 @@ void YACReaderFlowGL::drawCover(CFImage *CF)
glEnd();
glDisable(GL_TEXTURE_2D);
if(showMarks && loaded[CF->index] && marks[CF->index])
if(showMarks && loaded[CF->index] && marks[CF->index] != Unread)
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, markTexture);
if(marks[CF->index] == Read)
glBindTexture(GL_TEXTURE_2D, markTexture);
else
glBindTexture(GL_TEXTURE_2D, readingTexture);
glBegin(GL_QUADS);
//esquina inferior izquierda
@ -866,7 +869,7 @@ void YACReaderFlowGL::setShowMarks(bool value)
{
showMarks = value;
}
void YACReaderFlowGL::setMarks(QVector<bool> marks)
void YACReaderFlowGL::setMarks(QVector<YACReaderComicReadStatus> marks)
{
this->marks = marks;
}
@ -876,13 +879,13 @@ void YACReaderFlowGL::setMarkImage(QImage & image)
//deleteTexture(markTexture);
//markTexture = bindTexture(image,GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
}
void YACReaderFlowGL::markSlide(int index)
void YACReaderFlowGL::markSlide(int index, YACReaderComicReadStatus status)
{
marks[index] = true;
marks[index] = status;
}
void YACReaderFlowGL::unmarkSlide(int index)
{
marks[index] = false;
marks[index] = YACReaderComicReadStatus::Unread;
}
void YACReaderFlowGL::setSlideSize(QSize size)
{

View File

@ -127,6 +127,7 @@ protected:
GLuint defaultTexture;
GLuint markTexture;
GLuint readingTexture;
void initializeGL();
void paintGL();
void timerEvent(QTimerEvent *);
@ -136,7 +137,7 @@ protected:
int lazyPopulateObjects;
bool showMarks;
QVector<bool> loaded;
QVector<bool> marks;
QVector<YACReaderComicReadStatus> marks;
QList<QString> paths;
CFImage * cfImages;
bool hasBeenInitialized;
@ -247,9 +248,9 @@ public:
//interface with yacreaderlibrary, compatibility
void setShowMarks(bool value);
void setMarks(QVector<bool> marks);
void setMarks(QVector<YACReaderComicReadStatus> marks);
void setMarkImage(QImage & image);
void markSlide(int index);
void markSlide(int index, YACReaderComicReadStatus status);
void unmarkSlide(int index);
void setSlideSize(QSize size);
void clear();

View File

@ -67,5 +67,12 @@
SendComicInfo,
};
enum YACReaderComicReadStatus
{
Unread = 0,
Read = 1,
Opened = 2
};
#endif