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;
|
degrees_t lat, lon;
|
||||||
} location_t;
|
} location_t;
|
||||||
|
|
||||||
|
static const location_t zero_location = { { 0 }, { 0 }};
|
||||||
|
|
||||||
extern void parse_location(const char *, location_t *);
|
extern void parse_location(const char *, location_t *);
|
||||||
|
|
||||||
static inline bool has_location(const location_t *loc)
|
static inline bool has_location(const location_t *loc)
|
||||||
|
|
|
@ -177,7 +177,7 @@ static location_t parseGpsText(const QString &text)
|
||||||
double lat, lon;
|
double lat, lon;
|
||||||
if (parseGpsText(text, &lat, &lon))
|
if (parseGpsText(text, &lat, &lon))
|
||||||
return create_location(lat, lon);
|
return create_location(lat, lon);
|
||||||
return { {0}, {0} };
|
return zero_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationInformationWidget::diveSiteDeleted(struct dive_site *ds, int)
|
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 });
|
DiveFilter::instance()->startFilterDiveSites(QVector<dive_site *>{ ds });
|
||||||
filter_model.invalidate();
|
filter_model.invalidate();
|
||||||
} else {
|
} else {
|
||||||
filter_model.set(0, location_t { degrees_t{ 0 }, degrees_t{ 0 } });
|
filter_model.set(0, zero_location);
|
||||||
clearLabels();
|
clearLabels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ void LocationInformationWidget::reverseGeocode()
|
||||||
Command::editDiveSiteTaxonomy(diveSite, taxonomy);
|
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);
|
currentLocation = dive_get_gps_location(d);
|
||||||
} else {
|
} else {
|
||||||
currDs = nullptr;
|
currDs = nullptr;
|
||||||
currentLocation = location_t{{0}, {0}};
|
currentLocation = zero_location;
|
||||||
}
|
}
|
||||||
if (!currDs)
|
if (!currDs)
|
||||||
clear();
|
clear();
|
||||||
|
|
|
@ -419,7 +419,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationFilterDelegate::LocationFilterDelegate(QObject *) : currentLocation({0, 0})
|
LocationFilterDelegate::LocationFilterDelegate(QObject *) : currentLocation(zero_location)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue