selection: remove current_dive and dc_number access from tabwidgets

An attempt at limitting accesses to the globals current_dive and
dc_number. These globals do not make sense on mobile.

The parent widget of the tab-widgets remembers the currently
displayer dive and dive computer and the individual widgets
access these values from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-17 16:21:17 +02:00 committed by bstoeger
parent 8cd191c271
commit 6f03fc9689
8 changed files with 125 additions and 96 deletions

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "TabDivePhotos.h"
#include "maintab.h"
#include "ui_TabDivePhotos.h"
#include "core/imagedownloader.h"
@ -113,7 +114,7 @@ void TabDivePhotos::recalculateSelectedThumbnails()
void TabDivePhotos::saveSubtitles()
{
if (!current_dive)
if (!parent.currentDive)
return;
if (!ui->photosView->selectionModel()->hasSelection())
return;
@ -131,7 +132,7 @@ void TabDivePhotos::saveSubtitles()
if (!duration)
continue;
struct membufferpp b;
save_subtitles_buffer(&b, current_dive, offset, duration);
save_subtitles_buffer(&b, parent.currentDive, offset, duration);
const char *data = mb_cstring(&b);
subtitlefile.open(QIODevice::WriteOnly);
subtitlefile.write(data, strlen(data));