mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add methods to the flow implementations to add new items dynamically
This commit is contained in:
parent
82aa380bb5
commit
024f6df9de
@ -724,6 +724,24 @@ void YACReaderFlowGL::remove(int item)
|
|||||||
numObjects--;
|
numObjects--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YACReaderFlowGL::add(int item)
|
||||||
|
{
|
||||||
|
float x = 1;
|
||||||
|
float y = 1 * (700.f / 480.0f);
|
||||||
|
QString s = "cover";
|
||||||
|
|
||||||
|
images.insert(item, YACReader3DImage());
|
||||||
|
loaded.insert(item, false);
|
||||||
|
marks.insert(item, Unread);
|
||||||
|
numObjects++;
|
||||||
|
|
||||||
|
for (int i = item + 1; i < numObjects; i++) {
|
||||||
|
images[i].index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert(s.toLocal8Bit().data(), defaultTexture, x, y, item);
|
||||||
|
}
|
||||||
|
|
||||||
/*Info*/
|
/*Info*/
|
||||||
YACReader3DImage YACReaderFlowGL::getCurrentSelected()
|
YACReader3DImage YACReaderFlowGL::getCurrentSelected()
|
||||||
{
|
{
|
||||||
@ -747,6 +765,7 @@ void YACReaderFlowGL::replace(char *name, QOpenGLTexture *texture, float x, floa
|
|||||||
void YACReaderFlowGL::populate(int n)
|
void YACReaderFlowGL::populate(int n)
|
||||||
{
|
{
|
||||||
emit centerIndexChanged(0);
|
emit centerIndexChanged(0);
|
||||||
|
|
||||||
float x = 1;
|
float x = 1;
|
||||||
float y = 1 * (700.f / 480.0f);
|
float y = 1 * (700.f / 480.0f);
|
||||||
int i;
|
int i;
|
||||||
@ -1218,8 +1237,21 @@ void YACReaderComicFlowGL::remove(int item)
|
|||||||
worker->lock();
|
worker->lock();
|
||||||
worker->reset();
|
worker->reset();
|
||||||
YACReaderFlowGL::remove(item);
|
YACReaderFlowGL::remove(item);
|
||||||
if (item >= 0 && item < paths.size())
|
if (item >= 0 && item < paths.size()) {
|
||||||
paths.removeAt(item);
|
paths.removeAt(item);
|
||||||
|
}
|
||||||
|
worker->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderComicFlowGL::add(const QString &path, int index)
|
||||||
|
{
|
||||||
|
worker->lock();
|
||||||
|
worker->reset();
|
||||||
|
|
||||||
|
paths.insert(index, path);
|
||||||
|
|
||||||
|
YACReaderFlowGL::add(index);
|
||||||
|
|
||||||
worker->unlock();
|
worker->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +207,8 @@ public:
|
|||||||
void insert(char *name, QOpenGLTexture *texture, float x, float y, int item = -1);
|
void insert(char *name, QOpenGLTexture *texture, float x, float y, int item = -1);
|
||||||
// removes a item
|
// removes a item
|
||||||
virtual void remove(int item);
|
virtual void remove(int item);
|
||||||
|
// inserts a default texture into `item` and set is as pending to load
|
||||||
|
void add(int item);
|
||||||
// replaces the texture of the item 'item' with Tex
|
// replaces the texture of the item 'item' with Tex
|
||||||
void replace(char *name, QOpenGLTexture *texture, float x, float y, int item);
|
void replace(char *name, QOpenGLTexture *texture, float x, float y, int item);
|
||||||
// create n covers with the default nu
|
// create n covers with the default nu
|
||||||
@ -295,6 +297,7 @@ public:
|
|||||||
void setImagePaths(QStringList paths);
|
void setImagePaths(QStringList paths);
|
||||||
void updateImageData();
|
void updateImageData();
|
||||||
void remove(int item);
|
void remove(int item);
|
||||||
|
void add(const QString &path, int index);
|
||||||
void resortCovers(QList<int> newOrder);
|
void resortCovers(QList<int> newOrder);
|
||||||
friend class ImageLoaderGL;
|
friend class ImageLoaderGL;
|
||||||
|
|
||||||
|
@ -1084,6 +1084,13 @@ void PictureFlow::addSlide(const QPixmap &pixmap)
|
|||||||
addSlide(pixmap.toImage());
|
addSlide(pixmap.toImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PictureFlow::insertSlide(int index)
|
||||||
|
{
|
||||||
|
d->state->slideImages.insert(index, new QImage());
|
||||||
|
d->state->marks.insert(index, YACReader::Unread);
|
||||||
|
triggerRender();
|
||||||
|
}
|
||||||
|
|
||||||
void PictureFlow::removeSlide(int index)
|
void PictureFlow::removeSlide(int index)
|
||||||
{
|
{
|
||||||
int c = d->state->slideImages.count();
|
int c = d->state->slideImages.count();
|
||||||
|
@ -132,6 +132,11 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void addSlide(const QPixmap &pixmap);
|
void addSlide(const QPixmap &pixmap);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Insert and empty slide at index.
|
||||||
|
*/
|
||||||
|
void insertSlide(int index);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Removes an existing slide.
|
Removes an existing slide.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user