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)
|
||||
{
|
||||
worker->lock();
|
||||
|
||||
worker->reset();
|
||||
|
||||
imageFiles.removeAt(cover);
|
||||
if(imagesLoaded[cover])
|
||||
numImagesLoaded--;
|
||||
@ -136,6 +140,9 @@ void ComicFlow::removeSlide(int cover)
|
||||
imagesSetted.remove(cover);
|
||||
|
||||
YACReaderFlow::removeSlide(cover);
|
||||
worker->unlock();
|
||||
|
||||
preload();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//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()
|
||||
{
|
||||
for(;;)
|
||||
@ -218,4 +235,4 @@ void ImageLoader::run()
|
||||
QImage ImageLoader::result()
|
||||
{
|
||||
return img;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
void generate(int index, const QString& fileName, QSize size);
|
||||
void reset(){idx = -1;};
|
||||
int index() const { return idx; };
|
||||
void lock();
|
||||
void unlock();
|
||||
QImage result();
|
||||
|
||||
protected:
|
||||
|
@ -691,11 +691,15 @@ CFImage YACReaderFlowGL::getCurrentSelected()
|
||||
void YACReaderFlowGL::replace(char *name, GLuint Tex, float x, float y,int item)
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
cfImages[item].img = Tex;
|
||||
cfImages[item].width = x;
|
||||
cfImages[item].height = y;
|
||||
//strcpy(cfImages[item].name,name);
|
||||
loaded[item]=true;
|
||||
if(cfImages[item].index == item)
|
||||
{
|
||||
cfImages[item].img = Tex;
|
||||
cfImages[item].width = x;
|
||||
cfImages[item].height = y;
|
||||
loaded[item]=true;
|
||||
}
|
||||
else
|
||||
loaded[item]=false;
|
||||
}
|
||||
|
||||
void YACReaderFlowGL::populate(int n)
|
||||
@ -1081,7 +1085,7 @@ void YACReaderComicFlowGL::updateImageData()
|
||||
CFImages[idx].height = y;
|
||||
CFImages[idx].img = worker->resultTexture;
|
||||
strcpy(CFImages[idx].name,"cover");*/
|
||||
loaded[idx] = true;
|
||||
//loaded[idx] = true;
|
||||
//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 )
|
||||
: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()
|
||||
{
|
||||
for(;;)
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
//otherwise a new entry is set
|
||||
void insert(char *name, GLuint Tex, float x, float y,int item = -1);
|
||||
//removes a item
|
||||
void remove(int item);
|
||||
virtual void remove(int item);
|
||||
//replaces the texture of the item 'item' with Tex
|
||||
void replace(char *name, GLuint Tex, float x, float y,int item);
|
||||
//create n covers with the default nu
|
||||
@ -292,6 +292,7 @@ public:
|
||||
YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
||||
void setImagePaths(QStringList paths);
|
||||
void updateImageData();
|
||||
void remove(int item);
|
||||
friend class ImageLoaderGL;
|
||||
private:
|
||||
ImageLoaderGL * worker;
|
||||
@ -323,6 +324,8 @@ public:
|
||||
void generate(int index, const QString& fileName);
|
||||
void reset(){idx = -1;fileName="";};
|
||||
int index() const { return idx; };
|
||||
void lock();
|
||||
void unlock();
|
||||
QImage result();
|
||||
YACReaderFlowGL * flow;
|
||||
GLuint resultTexture;
|
||||
@ -389,4 +392,4 @@ private:
|
||||
//
|
||||
//};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user