Loockup -> Lookup

Signed-off-by: Paul-Erik Törrönen <poltsi@777-team.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Paul-Erik Törrönen 2015-05-16 00:27:08 +03:00 committed by Dirk Hohndel
parent 00b1469658
commit cfa5403192
6 changed files with 24 additions and 24 deletions

View file

@ -17,25 +17,25 @@
#include <QUrlQuery>
#include <QEventLoop>
struct GeoLoockupInfo {
struct GeoLookupInfo {
degrees_t lat;
degrees_t lon;
uint32_t uuid;
};
QVector<GeoLoockupInfo> geo_loockup_data;
QVector<GeoLookupInfo> geo_lookup_data;
ReverseGeoLoockupThread* ReverseGeoLoockupThread::instance() {
static ReverseGeoLoockupThread* self = new ReverseGeoLoockupThread();
ReverseGeoLookupThread* ReverseGeoLookupThread::instance() {
static ReverseGeoLookupThread* self = new ReverseGeoLookupThread();
return self;
}
ReverseGeoLoockupThread::ReverseGeoLoockupThread(QObject *obj) : QThread(obj)
ReverseGeoLookupThread::ReverseGeoLookupThread(QObject *obj) : QThread(obj)
{
}
void ReverseGeoLoockupThread::run() {
if (geo_loockup_data.isEmpty())
void ReverseGeoLookupThread::run() {
if (geo_lookup_data.isEmpty())
return;
QNetworkRequest request;
@ -44,7 +44,7 @@ void ReverseGeoLoockupThread::run() {
request.setRawHeader("User-Agent", getUserAgent().toUtf8());
QEventLoop loop;
QString apiCall("http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&accept-language=%1&lat=%2&lon=%3");
Q_FOREACH (const GeoLoockupInfo& info, geo_loockup_data ) {
Q_FOREACH (const GeoLookupInfo& info, geo_lookup_data ) {
request.setUrl(apiCall.arg(uiLanguage(NULL)).arg(info.lat.udeg / 1000000.0).arg(info.lon.udeg / 1000000.0));
QNetworkReply *reply = rgl->get(request);
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
@ -66,11 +66,11 @@ void ReverseGeoLoockupThread::run() {
rgl->deleteLater();
}
extern "C" void add_geo_information_for_loockup(degrees_t latitude, degrees_t longitude, uint32_t uuid) {
GeoLoockupInfo info;
extern "C" void add_geo_information_for_lookup(degrees_t latitude, degrees_t longitude, uint32_t uuid) {
GeoLookupInfo info;
info.lat = latitude;
info.lon = longitude;
info.uuid = uuid;
geo_loockup_data.append(info);
geo_lookup_data.append(info);
}

View file

@ -4,14 +4,14 @@
#include "units.h"
#include <QThread>
class ReverseGeoLoockupThread : public QThread {
class ReverseGeoLookupThread : public QThread {
Q_OBJECT
public:
static ReverseGeoLoockupThread *instance();
static ReverseGeoLookupThread *instance();
void run() Q_DECL_OVERRIDE;
private:
ReverseGeoLoockupThread(QObject *parent = 0);
ReverseGeoLookupThread(QObject *parent = 0);
};
#endif // DIVESITEHELPERS_H

View file

@ -1167,7 +1167,7 @@ static void gps_location(char *buffer, struct dive_site *ds)
/* this is in qthelper.cpp, so including the .h file is a pain */
extern const char *printGPSCoords(int lat, int lon);
extern void add_geo_information_for_loockup(degrees_t latitude, degrees_t longitude, uint32_t uuid);
extern void add_geo_information_for_lookup(degrees_t latitude, degrees_t longitude, uint32_t uuid);
static void gps_in_dive(char *buffer, struct dive *dive)
{
@ -1206,7 +1206,7 @@ static void gps_in_dive(char *buffer, struct dive *dive)
}
}
if (ds && (!ds->notes || strstr(ds->notes, "countrytag:") == NULL))
add_geo_information_for_loockup(latitude, longitude, dive->dive_site_uuid);
add_geo_information_for_lookup(latitude, longitude, dive->dive_site_uuid);
}
static void add_dive_site(char *buffer, struct dive *dive)

View file

@ -209,13 +209,13 @@ MainTab::~MainTab()
}
}
void MainTab::enableGeoLoockupEdition()
void MainTab::enableGeoLookupEdition()
{
ui.waitingSpinner->stop();
ui.manageDiveSite->show();
}
void MainTab::disableGeoLoockupEdition()
void MainTab::disableGeoLookupEdition()
{
ui.waitingSpinner->start();
ui.manageDiveSite->hide();

View file

@ -94,8 +94,8 @@ slots:
void removeSelectedPhotos();
void prepareDiveSiteEdit();
void showLocation();
void enableGeoLoockupEdition();
void disableGeoLoockupEdition();
void enableGeoLookupEdition();
void disableGeoLookupEdition();
private:
Ui::MainTab ui;

View file

@ -202,9 +202,9 @@ MainWindow::MainWindow() : QMainWindow(),
undoRedoActions.append(redoAction);
ui.menu_Edit->addActions(undoRedoActions);
ReverseGeoLoockupThread *geoLoockup = ReverseGeoLoockupThread::instance();
connect(geoLoockup, SIGNAL(started()),information(), SLOT(disableGeoLoockupEdition()));
connect(geoLoockup, SIGNAL(finished()), information(), SLOT(enableGeoLoockupEdition()));
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition()));
connect(geoLookup, SIGNAL(finished()), information(), SLOT(enableGeoLookupEdition()));
}
MainWindow::~MainWindow()
@ -1460,7 +1460,7 @@ void MainWindow::loadFiles(const QStringList fileNames)
// searches for geo lookup information in a thread so it doesn`t
// freezes the ui.
ReverseGeoLoockupThread::instance()->start();
ReverseGeoLookupThread::instance()->start();
refreshDisplay();
ui.actionAutoGroup->setChecked(autogroup);