mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 10:50: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--;
|
||||
}
|
||||
|
||||
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*/
|
||||
YACReader3DImage YACReaderFlowGL::getCurrentSelected()
|
||||
{
|
||||
@ -747,6 +765,7 @@ void YACReaderFlowGL::replace(char *name, QOpenGLTexture *texture, float x, floa
|
||||
void YACReaderFlowGL::populate(int n)
|
||||
{
|
||||
emit centerIndexChanged(0);
|
||||
|
||||
float x = 1;
|
||||
float y = 1 * (700.f / 480.0f);
|
||||
int i;
|
||||
@ -1218,8 +1237,21 @@ void YACReaderComicFlowGL::remove(int item)
|
||||
worker->lock();
|
||||
worker->reset();
|
||||
YACReaderFlowGL::remove(item);
|
||||
if (item >= 0 && item < paths.size())
|
||||
if (item >= 0 && item < paths.size()) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,8 @@ public:
|
||||
void insert(char *name, QOpenGLTexture *texture, float x, float y, int item = -1);
|
||||
// removes a 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
|
||||
void replace(char *name, QOpenGLTexture *texture, float x, float y, int item);
|
||||
// create n covers with the default nu
|
||||
@ -295,6 +297,7 @@ public:
|
||||
void setImagePaths(QStringList paths);
|
||||
void updateImageData();
|
||||
void remove(int item);
|
||||
void add(const QString &path, int index);
|
||||
void resortCovers(QList<int> newOrder);
|
||||
friend class ImageLoaderGL;
|
||||
|
||||
|
@ -1084,6 +1084,13 @@ void PictureFlow::addSlide(const QPixmap &pixmap)
|
||||
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)
|
||||
{
|
||||
int c = d->state->slideImages.count();
|
||||
|
@ -133,7 +133,12 @@ public slots:
|
||||
void addSlide(const QPixmap &pixmap);
|
||||
|
||||
/*!
|
||||
Removes an existing slide.
|
||||
Insert and empty slide at index.
|
||||
*/
|
||||
void insertSlide(int index);
|
||||
|
||||
/*!
|
||||
Removes an existing slide.
|
||||
*/
|
||||
void removeSlide(int index);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user