diff --git a/YACReaderLibrary/comic_flow.cpp b/YACReaderLibrary/comic_flow.cpp index 7c013a7e..a3f9117b 100644 --- a/YACReaderLibrary/comic_flow.cpp +++ b/YACReaderLibrary/comic_flow.cpp @@ -126,6 +126,16 @@ void ComicFlow::wheelEvent(QWheelEvent * event) event->accept(); } +void ComicFlow::removeSlide(int cover) +{ + imageFiles.removeAt(cover); + if(imagesLoaded[cover]) + numImagesLoaded--; + imagesLoaded.remove(cover); + imagesSetted.remove(cover); + + YACReaderFlow::removeSlide(cover); +} //----------------------------------------------------------------------------- //ImageLoader //----------------------------------------------------------------------------- diff --git a/YACReaderLibrary/comic_flow.h b/YACReaderLibrary/comic_flow.h index 6332af38..71ac28de 100644 --- a/YACReaderLibrary/comic_flow.h +++ b/YACReaderLibrary/comic_flow.h @@ -23,6 +23,7 @@ public: void setImagePaths(const QStringList& paths); //bool eventFilter(QObject *target, QEvent *event); void keyPressEvent(QKeyEvent* event); + void removeSlide(int cover); private slots: void preload(); diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp index 73bd10bc..700f9533 100644 --- a/YACReaderLibrary/comic_flow_widget.cpp +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -127,6 +127,11 @@ void ComicFlowWidgetSW::updateConfig(QSettings * settings) } } +void ComicFlowWidgetSW::remove(int cover) +{ + flow->removeSlide(cover); +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -313,6 +318,11 @@ void ComicFlowWidgetGL::updateConfig(QSettings * settings) } +void ComicFlowWidgetGL::remove(int cover) +{ + flow->remove(cover); +} + //void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);} //void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);} //void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);} diff --git a/YACReaderLibrary/comic_flow_widget.h b/YACReaderLibrary/comic_flow_widget.h index f9689bb6..09b2b6e7 100644 --- a/YACReaderLibrary/comic_flow_widget.h +++ b/YACReaderLibrary/comic_flow_widget.h @@ -30,6 +30,7 @@ public slots: virtual void setFlowType(FlowType flowType) = 0; virtual void render() = 0; virtual void updateConfig(QSettings * settings) = 0; + virtual void remove(int cover) = 0; signals: void centerIndexChanged(int); void selected(unsigned int); @@ -59,6 +60,7 @@ public: void setFlowType(FlowType flowType); void render(); void updateConfig(QSettings * settings); + void remove(int cover); protected: void keyPressEvent(QKeyEvent* event); void paintEvent(QPaintEvent *event); @@ -92,6 +94,7 @@ public: void setFlowType(FlowType flowType); void render(); void updateConfig(QSettings * settings); + void remove(int cover); //public slots: // void setCF_RX(int value); // //the Y Rotation of the Coverflow diff --git a/common/pictureflow.cpp b/common/pictureflow.cpp index a03c0b54..b6fa23a5 100644 --- a/common/pictureflow.cpp +++ b/common/pictureflow.cpp @@ -1085,6 +1085,18 @@ void PictureFlow::addSlide(const QPixmap& pixmap) addSlide(pixmap.toImage()); } +void PictureFlow::removeSlide(int index) +{ + int c = d->state->slideImages.count(); + if (index >= 0 && index < c) + { + d->state->slideImages.remove(index); + d->state->marks.remove(index); + //TODO remove loaded flags + triggerRender(); + } +} + void PictureFlow::setSlide(int index, const QImage& image) { if((index >= 0) && (index < slideCount())) diff --git a/common/pictureflow.h b/common/pictureflow.h index 709d1ab9..50c39b2c 100644 --- a/common/pictureflow.h +++ b/common/pictureflow.h @@ -130,6 +130,11 @@ public slots: */ void addSlide(const QPixmap& pixmap); + /*! + Removes an existing slide. + */ + void removeSlide(int index); + /*! Sets an image for specified slide. If the slide already exists, it will be replaced. diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index 449b6bf6..87e3378b 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -674,6 +674,10 @@ void YACReaderFlowGL::remove(int item) } numObjects--; cfImages = (CFImage*)realloc(cfImages,numObjects*sizeof(CFImage)); + + loaded.remove(item); + marks.remove(item); + paths.removeAt(item); } /*Info*/