From 4d0c863d611e19350f5cbb12c3d6f3a141256d6c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 25 Oct 2021 16:18:10 -0700 Subject: [PATCH] cleanup: replace QRegExp with QRegularExpression Qt 6 will drop support for QRegExp. Use QRegularExpression instead. This is a straight forward replacement without any other code changes. Signed-off-by: Dirk Hohndel --- core/divesitehelpers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp index 5a36d63ca..0b4142e05 100644 --- a/core/divesitehelpers.cpp +++ b/core/divesitehelpers.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include /** Performs a REST get request to a service returning a JSON object. */ @@ -87,19 +88,19 @@ taxonomy_data reverseGeoLookup(degrees_t latitude, degrees_t longitude) taxonomy_data taxonomy = { 0, 0 }; // check the oceans API to figure out the body of water - url = geonamesOceanURL.arg(getUiLanguage().section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); + url = geonamesOceanURL.arg(getUiLanguage().section(QRegularExpression("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); obj = doAsyncRESTGetRequest(url, 5000); // 5 secs. timeout QVariantMap oceanName = obj.value("ocean").toVariant().toMap(); if (oceanName["name"].isValid()) taxonomy_set_category(&taxonomy, TC_OCEAN, qPrintable(oceanName["name"].toString()), taxonomy_origin::GEOCODED); // check the findNearbyPlaces API from geonames - that should give us country, state, city - url = geonamesNearbyPlaceNameURL.arg(getUiLanguage().section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); + url = geonamesNearbyPlaceNameURL.arg(getUiLanguage().section(QRegularExpression("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); obj = doAsyncRESTGetRequest(url, 5000); // 5 secs. timeout QVariantList geoNames = obj.value("geonames").toVariant().toList(); if (geoNames.count() == 0) { // check the findNearby API from geonames if the previous search came up empty - that should give us country, state, location - url = geonamesNearbyURL.arg(getUiLanguage().section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); + url = geonamesNearbyURL.arg(getUiLanguage().section(QRegularExpression("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0); obj = doAsyncRESTGetRequest(url, 5000); // 5 secs. timeout geoNames = obj.value("geonames").toVariant().toList(); }