summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-13 18:52:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-07 08:56:48 -0700
commit5febb534b8dc4f603bc8e83a4583ebedfe417246 (patch)
treee577cd3b74614f0ca2f28f5d5757c363e2d57968 /desktop-widgets
parent7a443423bc633d8ea085879f9ad675cb134cc93c (diff)
downloadsubsurface-5febb534b8dc4f603bc8e83a4583ebedfe417246.tar.gz
DiveComponentSelection: use current_dive instead of displayed_dive
This should have been converted a long time ago. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/simplewidgets.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 423f4b68f..b6244c826 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -440,7 +440,7 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
void DiveComponentSelection::buttonClicked(QAbstractButton *button)
{
- if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
+ if (current_dive && ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
COMPONENT_FROM_UI(divesite);
COMPONENT_FROM_UI(divemaster);
COMPONENT_FROM_UI(buddy);
@@ -451,28 +451,28 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
COMPONENT_FROM_UI(tags);
COMPONENT_FROM_UI(cylinders);
COMPONENT_FROM_UI(weights);
- selective_copy_dive(&displayed_dive, targetDive, *what, true);
+ selective_copy_dive(current_dive, targetDive, *what, true);
QClipboard *clipboard = QApplication::clipboard();
QTextStream text;
QString cliptext;
text.setString(&cliptext);
- if (what->divesite && displayed_dive.dive_site)
- text << tr("Dive site: ") << displayed_dive.dive_site->name << "\n";
+ if (what->divesite && current_dive->dive_site)
+ text << tr("Dive site: ") << current_dive->dive_site->name << "\n";
if (what->divemaster)
- text << tr("Dive master: ") << displayed_dive.divemaster << "\n";
+ text << tr("Dive master: ") << current_dive->divemaster << "\n";
if (what->buddy)
- text << tr("Buddy: ") << displayed_dive.buddy << "\n";
+ text << tr("Buddy: ") << current_dive->buddy << "\n";
if (what->rating)
- text << tr("Rating: ") + QString("*").repeated(displayed_dive.rating) << "\n";
+ text << tr("Rating: ") + QString("*").repeated(current_dive->rating) << "\n";
if (what->visibility)
- text << tr("Visibility: ") + QString("*").repeated(displayed_dive.visibility) << "\n";
+ text << tr("Visibility: ") + QString("*").repeated(current_dive->visibility) << "\n";
if (what->notes)
- text << tr("Notes:\n") << displayed_dive.notes << "\n";
+ text << tr("Notes:\n") << current_dive->notes << "\n";
if (what->suit)
- text << tr("Suit: ") << displayed_dive.suit << "\n";
+ text << tr("Suit: ") << current_dive->suit << "\n";
if (what-> tags) {
text << tr("Tags: ");
- tag_entry *entry = displayed_dive.tag_list;
+ tag_entry *entry = current_dive->tag_list;
while (entry) {
text << entry->tag->name << " ";
entry = entry->next;
@@ -482,16 +482,16 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
if (what->cylinders) {
int cyl;
text << tr("Cylinders:\n");
- for (cyl = 0; cyl < displayed_dive.cylinders.nr; cyl++) {
- if (is_cylinder_used(&displayed_dive, cyl))
- text << get_cylinder(&displayed_dive, cyl)->type.description << " " << gasname(get_cylinder(&displayed_dive, cyl)->gasmix) << "\n";
+ for (cyl = 0; cyl < current_dive->cylinders.nr; cyl++) {
+ if (is_cylinder_used(current_dive, cyl))
+ text << get_cylinder(current_dive, cyl)->type.description << " " << gasname(get_cylinder(current_dive, cyl)->gasmix) << "\n";
}
}
if (what->weights) {
int w;
text << tr("Weights:\n");
- for (w = 0; w < displayed_dive.weightsystems.nr; w++) {
- weightsystem_t ws = displayed_dive.weightsystems.weightsystems[w];
+ for (w = 0; w < current_dive->weightsystems.nr; w++) {
+ weightsystem_t ws = current_dive->weightsystems.weightsystems[w];
text << ws.description << ws.weight.grams / 1000 << "kg\n";
}
}