Context menu for images: change DivePicture model

Altering DivePicture model to allow deleting images
from the QListView without immediate updating of the
list. Updating is determined by an additioanl parameter

Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Guido Lerch 2015-10-20 21:03:53 +02:00 committed by Dirk Hohndel
parent 3c3523f9b8
commit 8ce471c2f5
2 changed files with 7 additions and 5 deletions

View file

@ -111,12 +111,14 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const
return ret;
}
void DivePictureModel::removePicture(const QString &fileUrl)
void DivePictureModel::removePicture(const QString &fileUrl, bool last)
{
dive_remove_picture(fileUrl.toUtf8().data());
copy_dive(current_dive, &displayed_dive);
updateDivePictures();
mark_divelist_changed(true);
if (last) {
copy_dive(current_dive, &displayed_dive);
updateDivePictures();
mark_divelist_changed(true);
}
}
int DivePictureModel::rowCount(const QModelIndex &parent) const

View file

@ -33,7 +33,7 @@ public:
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual void updateDivePictures();
void updateDivePicturesWhenDone(QList<QFuture<void> >);
void removePicture(const QString& fileUrl);
void removePicture(const QString& fileUrl, bool last);
protected:
DivePictureModel();