mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed wrong cover being loaded after deleting a comic
This commit is contained in:
parent
6624b0d483
commit
72f4fbd658
@ -129,6 +129,10 @@ void ComicFlow::wheelEvent(QWheelEvent * event)
|
|||||||
|
|
||||||
void ComicFlow::removeSlide(int cover)
|
void ComicFlow::removeSlide(int cover)
|
||||||
{
|
{
|
||||||
|
worker->lock();
|
||||||
|
|
||||||
|
worker->reset();
|
||||||
|
|
||||||
imageFiles.removeAt(cover);
|
imageFiles.removeAt(cover);
|
||||||
if(imagesLoaded[cover])
|
if(imagesLoaded[cover])
|
||||||
numImagesLoaded--;
|
numImagesLoaded--;
|
||||||
@ -136,6 +140,9 @@ void ComicFlow::removeSlide(int cover)
|
|||||||
imagesSetted.remove(cover);
|
imagesSetted.remove(cover);
|
||||||
|
|
||||||
YACReaderFlow::removeSlide(cover);
|
YACReaderFlow::removeSlide(cover);
|
||||||
|
worker->unlock();
|
||||||
|
|
||||||
|
preload();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//ImageLoader
|
//ImageLoader
|
||||||
@ -188,6 +195,16 @@ void ImageLoader::generate(int index, const QString& fileName, QSize size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageLoader::lock()
|
||||||
|
{
|
||||||
|
mutex.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageLoader::unlock()
|
||||||
|
{
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void ImageLoader::run()
|
void ImageLoader::run()
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
@ -218,4 +235,4 @@ void ImageLoader::run()
|
|||||||
QImage ImageLoader::result()
|
QImage ImageLoader::result()
|
||||||
{
|
{
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
void generate(int index, const QString& fileName, QSize size);
|
void generate(int index, const QString& fileName, QSize size);
|
||||||
void reset(){idx = -1;};
|
void reset(){idx = -1;};
|
||||||
int index() const { return idx; };
|
int index() const { return idx; };
|
||||||
|
void lock();
|
||||||
|
void unlock();
|
||||||
QImage result();
|
QImage result();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -691,11 +691,15 @@ CFImage YACReaderFlowGL::getCurrentSelected()
|
|||||||
void YACReaderFlowGL::replace(char *name, GLuint Tex, float x, float y,int item)
|
void YACReaderFlowGL::replace(char *name, GLuint Tex, float x, float y,int item)
|
||||||
{
|
{
|
||||||
Q_UNUSED(name)
|
Q_UNUSED(name)
|
||||||
cfImages[item].img = Tex;
|
if(cfImages[item].index == item)
|
||||||
cfImages[item].width = x;
|
{
|
||||||
cfImages[item].height = y;
|
cfImages[item].img = Tex;
|
||||||
//strcpy(cfImages[item].name,name);
|
cfImages[item].width = x;
|
||||||
loaded[item]=true;
|
cfImages[item].height = y;
|
||||||
|
loaded[item]=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
loaded[item]=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderFlowGL::populate(int n)
|
void YACReaderFlowGL::populate(int n)
|
||||||
@ -1081,7 +1085,7 @@ void YACReaderComicFlowGL::updateImageData()
|
|||||||
CFImages[idx].height = y;
|
CFImages[idx].height = y;
|
||||||
CFImages[idx].img = worker->resultTexture;
|
CFImages[idx].img = worker->resultTexture;
|
||||||
strcpy(CFImages[idx].name,"cover");*/
|
strcpy(CFImages[idx].name,"cover");*/
|
||||||
loaded[idx] = true;
|
//loaded[idx] = true;
|
||||||
//numImagesLoaded++;
|
//numImagesLoaded++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,6 +1138,14 @@ void YACReaderComicFlowGL::updateImageData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YACReaderComicFlowGL::remove(int item)
|
||||||
|
{
|
||||||
|
worker->lock();
|
||||||
|
worker->reset();
|
||||||
|
YACReaderFlowGL::remove(item);
|
||||||
|
worker->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
YACReaderPageFlowGL::YACReaderPageFlowGL(QWidget *parent,struct Preset p )
|
YACReaderPageFlowGL::YACReaderPageFlowGL(QWidget *parent,struct Preset p )
|
||||||
:YACReaderFlowGL(parent,p)
|
:YACReaderFlowGL(parent,p)
|
||||||
@ -1312,6 +1324,16 @@ void ImageLoaderGL::generate(int index, const QString& fileName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageLoaderGL::lock()
|
||||||
|
{
|
||||||
|
mutex.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageLoaderGL::unlock()
|
||||||
|
{
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void ImageLoaderGL::run()
|
void ImageLoaderGL::run()
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -196,7 +196,7 @@ public:
|
|||||||
//otherwise a new entry is set
|
//otherwise a new entry is set
|
||||||
void insert(char *name, GLuint Tex, float x, float y,int item = -1);
|
void insert(char *name, GLuint Tex, float x, float y,int item = -1);
|
||||||
//removes a item
|
//removes a item
|
||||||
void remove(int item);
|
virtual void remove(int item);
|
||||||
//replaces the texture of the item 'item' with Tex
|
//replaces the texture of the item 'item' with Tex
|
||||||
void replace(char *name, GLuint Tex, float x, float y,int item);
|
void replace(char *name, GLuint Tex, float x, float y,int item);
|
||||||
//create n covers with the default nu
|
//create n covers with the default nu
|
||||||
@ -292,6 +292,7 @@ public:
|
|||||||
YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
||||||
void setImagePaths(QStringList paths);
|
void setImagePaths(QStringList paths);
|
||||||
void updateImageData();
|
void updateImageData();
|
||||||
|
void remove(int item);
|
||||||
friend class ImageLoaderGL;
|
friend class ImageLoaderGL;
|
||||||
private:
|
private:
|
||||||
ImageLoaderGL * worker;
|
ImageLoaderGL * worker;
|
||||||
@ -323,6 +324,8 @@ public:
|
|||||||
void generate(int index, const QString& fileName);
|
void generate(int index, const QString& fileName);
|
||||||
void reset(){idx = -1;fileName="";};
|
void reset(){idx = -1;fileName="";};
|
||||||
int index() const { return idx; };
|
int index() const { return idx; };
|
||||||
|
void lock();
|
||||||
|
void unlock();
|
||||||
QImage result();
|
QImage result();
|
||||||
YACReaderFlowGL * flow;
|
YACReaderFlowGL * flow;
|
||||||
GLuint resultTexture;
|
GLuint resultTexture;
|
||||||
@ -389,4 +392,4 @@ private:
|
|||||||
//
|
//
|
||||||
//};
|
//};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user