Trigger reverse geo lookup by pressing the button

This may not be the best UI, but for now it works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-01 12:37:50 -07:00
parent baf68868f5
commit d966fd2606
2 changed files with 10 additions and 1 deletions

View file

@ -59,6 +59,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
closeMessage(); closeMessage();
connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit())); connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit()));
connect(ui.geocodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
QAction *action = new QAction(tr("Apply changes"), this); QAction *action = new QAction(tr("Apply changes"), this);
connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
@ -496,7 +497,7 @@ void MainTab::updateDiveInfo(bool clear)
if (!clear) { if (!clear) {
struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
qDebug() << "showing dive site uuid" << ds->uuid << ds; ui.geocodeButton->setVisible(ds && dive_site_has_gps_location(ds));
if (ds) { if (ds) {
// construct the location tags // construct the location tags
QString locationTag; QString locationTag;
@ -1550,3 +1551,10 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
weightModel->changed = true; weightModel->changed = true;
} }
} }
void MainTab::reverseGeocode()
{
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
geoLookup->lookup(&displayed_dive_site);
MainWindow::instance()->information()->updateDiveInfo();
}

View file

@ -97,6 +97,7 @@ slots:
void disableGeoLookupEdition(); void disableGeoLookupEdition();
void setCurrentLocationIndex(); void setCurrentLocationIndex();
void showDiveSiteSimpleEdit(); void showDiveSiteSimpleEdit();
void reverseGeocode();
private: private:
Ui::MainTab ui; Ui::MainTab ui;
WeightModel *weightModel; WeightModel *weightModel;