UI restructure: always display pictures for displayed dive

The only time this is ever wrong is in print mode, so let's never show
pictures in print mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-07-02 13:58:06 -07:00
parent 635a7ab771
commit ce47683de8
3 changed files with 8 additions and 6 deletions

View file

@ -32,7 +32,7 @@ SPixmap scaleImages(const QString &s)
return ret;
}
void DivePictureModel::updateDivePictures(int divenr)
void DivePictureModel::updateDivePictures()
{
if (numberOfPictures != 0) {
beginRemoveRows(QModelIndex(), 0, numberOfPictures - 1);
@ -40,15 +40,14 @@ void DivePictureModel::updateDivePictures(int divenr)
endRemoveRows();
}
struct dive *d = get_dive(divenr);
numberOfPictures = dive_get_picture_count(d);
if (!d || numberOfPictures == 0) {
numberOfPictures = dive_get_picture_count(&displayed_dive);
if (numberOfPictures == 0) {
return;
}
stringPixmapCache.clear();
QStringList pictures;
FOR_EACH_PICTURE (d) {
FOR_EACH_PICTURE (&displayed_dive) {
stringPixmapCache[QString(picture->filename)].picture = picture;
pictures.push_back(QString(picture->filename));
}