desktop: use current_dive to save subtitles

The old code used displayed_dive. However, virtually all the
displayed data is now derived from current_dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Berthold Stoeger 2020-04-13 19:09:35 +02:00 committed by Dirk Hohndel
parent 3b8b328639
commit 4ca2b8daea

View file

@ -111,6 +111,8 @@ void TabDivePhotos::recalculateSelectedThumbnails()
void TabDivePhotos::saveSubtitles()
{
if (!current_dive)
return;
if (!ui->photosView->selectionModel()->hasSelection())
return;
QModelIndexList indices = ui->photosView->selectionModel()->selectedRows();
@ -127,7 +129,7 @@ void TabDivePhotos::saveSubtitles()
if (!duration)
continue;
struct membuffer b = { 0 };
save_subtitles_buffer(&b, &displayed_dive, offset, duration);
save_subtitles_buffer(&b, current_dive, offset, duration);
char *data = detach_cstring(&b);
subtitlefile.open(QIODevice::WriteOnly);
subtitlefile.write(data, strlen(data));