mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
3c3523f9b8
commit
8ce471c2f5
2 changed files with 7 additions and 5 deletions
|
@ -111,12 +111,14 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePictureModel::removePicture(const QString &fileUrl)
|
void DivePictureModel::removePicture(const QString &fileUrl, bool last)
|
||||||
{
|
{
|
||||||
dive_remove_picture(fileUrl.toUtf8().data());
|
dive_remove_picture(fileUrl.toUtf8().data());
|
||||||
|
if (last) {
|
||||||
copy_dive(current_dive, &displayed_dive);
|
copy_dive(current_dive, &displayed_dive);
|
||||||
updateDivePictures();
|
updateDivePictures();
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivePictureModel::rowCount(const QModelIndex &parent) const
|
int DivePictureModel::rowCount(const QModelIndex &parent) const
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
virtual void updateDivePictures();
|
virtual void updateDivePictures();
|
||||||
void updateDivePicturesWhenDone(QList<QFuture<void> >);
|
void updateDivePicturesWhenDone(QList<QFuture<void> >);
|
||||||
void removePicture(const QString& fileUrl);
|
void removePicture(const QString& fileUrl, bool last);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DivePictureModel();
|
DivePictureModel();
|
||||||
|
|
Loading…
Reference in a new issue