summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-13 10:59:16 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-13 21:41:41 -0400
commit5d3967ce846ed4876abeb43ebe2d919064050ed6 (patch)
tree246ae5a2cc649eff0bd911a072b956a8440167a4
parent954820aa81cb52cfe4442f2c6e81117827e32ccc (diff)
downloadsubsurface-5d3967ce846ed4876abeb43ebe2d919064050ed6.tar.gz
Dive site: un-globalize displayed_dive_site
The global object displayed_dive_site is used a a backing-store by the dive-site-edit widget. All external accesses were removed, therefore make the object local to the widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/dive.c1
-rw-r--r--core/dive.h1
-rw-r--r--desktop-widgets/locationinformation.cpp3
-rw-r--r--desktop-widgets/locationinformation.h2
4 files changed, 4 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c
index d643dec22..f44bfc3c1 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -18,7 +18,6 @@
* it's used in the UI, but it seems to make the most sense to have it
* here */
struct dive displayed_dive;
-struct dive_site displayed_dive_site;
struct tag_entry *g_tag_list = NULL;
diff --git a/core/dive.h b/core/dive.h
index da856cc0f..4f453d722 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -439,7 +439,6 @@ struct dive_table {
extern struct dive_table dive_table, downloadTable;
extern struct dive displayed_dive;
-extern struct dive_site displayed_dive_site;
extern unsigned int dc_number;
extern struct dive *current_dive;
#define current_dc (get_dive_dc(current_dive, dc_number))
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index 3f87454da..30146b5be 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -19,6 +19,7 @@
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
{
+ memset(&displayed_dive_site, 0, sizeof(displayed_dive_site));
ui.setupUi(this);
ui.diveSiteMessage->setCloseButtonVisible(false);
@@ -373,7 +374,7 @@ QVariant DiveLocationModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return new_ds_value[index.row()];
case Qt::ToolTipRole:
- return displayed_dive_site.uuid ?
+ return displayed_dive.dive_site_uuid ?
tr("Create a new dive site, copying relevant information from the current dive.") :
tr("Create a new dive site with this name");
case Qt::DecorationRole:
diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h
index 402c434e1..3e0da4aa6 100644
--- a/desktop-widgets/locationinformation.h
+++ b/desktop-widgets/locationinformation.h
@@ -3,6 +3,7 @@
#define LOCATIONINFORMATION_H
#include "core/units.h"
+#include "core/divesite.h"
#include "ui_locationInformation.h"
#include "qt-models/divelocationmodel.h"
#include <stdint.h>
@@ -50,6 +51,7 @@ private:
bool modified;
QAction *acceptAction, *rejectAction;
GPSLocationInformationModel filter_model;
+ dive_site displayed_dive_site;
};
class DiveLocationFilterProxyModel : public QSortFilterProxyModel {