mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: split uiLanguage() in two functions
The uiLanguage() function was used for two purposes: to initialize the language related preferences and to read the current language. To make things more easy to follow, split this function in two: one for initializing, one for getting the current language. Moreover, don't return the current locale in an out-parameter as there is already a function to do that [getLocale()]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2dca7d0ce5
commit
eb55ffde16
8 changed files with 19 additions and 20 deletions
|
@ -39,7 +39,7 @@ void reverseGeoLookup(degrees_t latitude, degrees_t longitude, taxonomy_data *ta
|
|||
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
|
||||
|
||||
// first check the findNearbyPlaces API from geonames - that should give us country, state, city
|
||||
request.setUrl(geonamesURL.arg(uiLanguage(NULL).section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0));
|
||||
request.setUrl(geonamesURL.arg(getUiLanguage().section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0));
|
||||
|
||||
// By using a std::unique_ptr<>, we can exit from the function at any point
|
||||
// and the reply will be freed. Likewise, when overwriting the pointer with
|
||||
|
@ -119,7 +119,7 @@ void reverseGeoLookup(degrees_t latitude, degrees_t longitude, taxonomy_data *ta
|
|||
reply->abort();
|
||||
}
|
||||
// next check the oceans API to figure out the body of water
|
||||
request.setUrl(geonamesOceanURL.arg(uiLanguage(NULL).section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0));
|
||||
request.setUrl(geonamesOceanURL.arg(getUiLanguage().section(QRegExp("[-_ ]"), 0, 0)).arg(latitude.udeg / 1000000.0).arg(longitude.udeg / 1000000.0));
|
||||
reply.reset(rgl.get(request)); // Note: frees old reply.
|
||||
QObject::connect(&*reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
timer.start(5000); // 5 secs. timeout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue