diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 13 | ||||
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 7 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 7 |
3 files changed, 8 insertions, 19 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index f4da411af..af3fa513f 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -113,13 +113,10 @@ void LocationInformationWidget::updateLabels() ui.diveSiteNotes->setPlainText(diveSite->notes); else ui.diveSiteNotes->clear(); - if (has_location(&diveSite->location)) { - char *coords = printGPSCoords(&diveSite->location); - ui.diveSiteCoordinates->setText(coords); - free(coords); - } else { + if (has_location(&diveSite->location)) + ui.diveSiteCoordinates->setText(printGPSCoords(&diveSite->location)); + else ui.diveSiteCoordinates->clear(); - } ui.locationTags->setText(constructLocationTags(&taxonomy, false)); } @@ -138,10 +135,8 @@ void LocationInformationWidget::updateGpsCoordinates(const location_t &location) { QString oldText = ui.diveSiteCoordinates->text(); - char *coords = printGPSCoords(&location); - ui.diveSiteCoordinates->setText(coords); + ui.diveSiteCoordinates->setText(printGPSCoords(&location)); enableLocationButtons(has_location(&location)); - free(coords); if (oldText != ui.diveSiteCoordinates->text()) markChangedWidget(ui.diveSiteCoordinates); } diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index c6405a433..fd6bb2e47 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -483,11 +483,8 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem bottomText += QString(ds->taxonomy.category[idx].value); } - if (bottomText.isEmpty()) { - char *gpsCoords = printGPSCoords(&ds->location); - bottomText = QString(gpsCoords); - free(gpsCoords); - } + if (bottomText.isEmpty()) + bottomText = printGPSCoords(&ds->location); if (dive_site_has_gps_location(ds) && currentDiveSiteHasGPS) { // so we are showing a completion and both the current dive site and the completion diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index a2ff15368..98b8904c2 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -410,11 +410,8 @@ void MainTab::updateDiveInfo(bool clear) ui.location->setCurrentDiveSite(ds); ui.locationTags->setText(constructLocationTags(&ds->taxonomy, true)); - if (ui.locationTags->text().isEmpty() && has_location(&ds->location)) { - char *coords = printGPSCoords(&ds->location); - ui.locationTags->setText(coords); - free(coords); - } + if (ui.locationTags->text().isEmpty() && has_location(&ds->location)) + ui.locationTags->setText(printGPSCoords(&ds->location)); } else { ui.location->clear(); ui.locationTags->clear(); |