mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
code cleanup: use explicit zero_location
Again, several different ways to achieve the same thing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
247194e839
commit
70cabb968c
3 changed files with 7 additions and 5 deletions
|
@ -139,6 +139,8 @@ typedef struct pos {
|
|||
degrees_t lat, lon;
|
||||
} location_t;
|
||||
|
||||
static const location_t zero_location = { { 0 }, { 0 }};
|
||||
|
||||
extern void parse_location(const char *, location_t *);
|
||||
|
||||
static inline bool has_location(const location_t *loc)
|
||||
|
|
|
@ -177,7 +177,7 @@ static location_t parseGpsText(const QString &text)
|
|||
double lat, lon;
|
||||
if (parseGpsText(text, &lat, &lon))
|
||||
return create_location(lat, lon);
|
||||
return { {0}, {0} };
|
||||
return zero_location;
|
||||
}
|
||||
|
||||
void LocationInformationWidget::diveSiteDeleted(struct dive_site *ds, int)
|
||||
|
@ -215,7 +215,7 @@ void LocationInformationWidget::initFields(dive_site *ds)
|
|||
DiveFilter::instance()->startFilterDiveSites(QVector<dive_site *>{ ds });
|
||||
filter_model.invalidate();
|
||||
} else {
|
||||
filter_model.set(0, location_t { degrees_t{ 0 }, degrees_t{ 0 } });
|
||||
filter_model.set(0, zero_location);
|
||||
clearLabels();
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ void LocationInformationWidget::reverseGeocode()
|
|||
Command::editDiveSiteTaxonomy(diveSite, taxonomy);
|
||||
}
|
||||
|
||||
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *) : currentLocation({{0}, {0}})
|
||||
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *) : currentLocation(zero_location)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
|
|||
currentLocation = dive_get_gps_location(d);
|
||||
} else {
|
||||
currDs = nullptr;
|
||||
currentLocation = location_t{{0}, {0}};
|
||||
currentLocation = zero_location;
|
||||
}
|
||||
if (!currDs)
|
||||
clear();
|
||||
|
|
|
@ -419,7 +419,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
|||
return w;
|
||||
}
|
||||
|
||||
LocationFilterDelegate::LocationFilterDelegate(QObject *) : currentLocation({0, 0})
|
||||
LocationFilterDelegate::LocationFilterDelegate(QObject *) : currentLocation(zero_location)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue