mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Dive pictures: Update pictures when thumbnails are ready
Connect the thumbnailer signal to the dive picture model slot. This needs some code-reshuffling in the dive picture model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3967b1fd4d
commit
afe20ce029
3 changed files with 14 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "TabDivePhotos.h"
|
||||
#include "ui_TabDivePhotos.h"
|
||||
#include "core/imagedownloader.h"
|
||||
|
||||
#include <qt-models/divepicturemodel.h>
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ DivePictureModel::DivePictureModel() : rowDDStart(0),
|
|||
zoomLevel(0.0),
|
||||
defaultSize(defaultIconMetrics().sz_pic)
|
||||
{
|
||||
connect(Thumbnailer::instance(), &Thumbnailer::thumbnailChanged,
|
||||
this, &DivePictureModel::updateThumbnail, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void DivePictureModel::updateDivePicturesWhenDone(QList<QFuture<void>> futures)
|
||||
|
@ -160,3 +162,13 @@ int DivePictureModel::rowCount(const QModelIndex &parent) const
|
|||
Q_UNUSED(parent);
|
||||
return pictures.count();
|
||||
}
|
||||
|
||||
void DivePictureModel::updateThumbnail(QString filename, QImage thumbnail)
|
||||
{
|
||||
for (int i = 0; i < pictures.size(); ++i) {
|
||||
if (pictures[i].filename != filename)
|
||||
continue;
|
||||
pictures[i].image = thumbnail;
|
||||
emit dataChanged(createIndex(i, 0), createIndex(i, 1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
int rowDDStart, rowDDEnd;
|
||||
public slots:
|
||||
void setZoomLevel(int level);
|
||||
void updateThumbnail(QString filename, QImage thumbnail);
|
||||
private:
|
||||
DivePictureModel();
|
||||
QList<PictureEntry> pictures;
|
||||
|
|
Loading…
Reference in a new issue