aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-22 12:15:53 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-22 12:29:39 -0700
commitd4b5854f82522b1920bbfbe9e094bfa4f0bb516f (patch)
tree7735a4b9cf0821a33aad4d0c236e44b015a1e820
parentb342730ec958a6127cfef4e5459cfea96477ac42 (diff)
downloadsubsurface-d4b5854f82522b1920bbfbe9e094bfa4f0bb516f.tar.gz
Location management: reflect changes to the coordinates on the map
This is a bit aggressive as it changes the globe with every single character that's entered, but it's better than what we had before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/globe.cpp1
-rw-r--r--qt-ui/globe.h2
-rw-r--r--qt-ui/locationinformation.cpp4
-rw-r--r--qt-ui/locationinformation.h1
-rw-r--r--qt-ui/mainwindow.cpp1
5 files changed, 8 insertions, 1 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index ea0c0f231..5c4bbde6a 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -231,6 +231,7 @@ void GlobeGPS::repopulateLabels()
}
}
model()->treeModel()->addDocument(loadedDives);
+ centerOn(displayed_dive_site.longitude.udeg / 1000000.0, displayed_dive_site.latitude.udeg / 1000000.0, true);
}
void GlobeGPS::reload()
diff --git a/qt-ui/globe.h b/qt-ui/globe.h
index 4f9d7c611..5cdaa1c18 100644
--- a/qt-ui/globe.h
+++ b/qt-ui/globe.h
@@ -21,7 +21,6 @@ public:
using MarbleWidget::centerOn;
GlobeGPS(QWidget *parent = 0);
void reload();
- void repopulateLabels();
void centerOnCurrentDive();
bool eventFilter(QObject *, QEvent *);
@@ -44,6 +43,7 @@ signals:
public
slots:
+ void repopulateLabels();
void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit);
void mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit);
void fixZoom();
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index d20a6efc6..73c8767e8 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -3,6 +3,7 @@
#include "mainwindow.h"
#include "divelistview.h"
#include "qthelper.h"
+#include "globe.h"
#include <QDebug>
#include <QShowEvent>
@@ -146,6 +147,7 @@ void LocationInformationWidget::acceptChanges()
mark_divelist_changed(true);
resetState();
emit informationManagementEnded();
+ emit coordinatesChanged();
}
void LocationInformationWidget::rejectChanges()
@@ -160,6 +162,7 @@ void LocationInformationWidget::rejectChanges()
}
resetState();
emit informationManagementEnded();
+ emit coordinatesChanged();
}
void LocationInformationWidget::showEvent(QShowEvent *ev)
@@ -217,6 +220,7 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString
displayed_dive_site.latitude.udeg = latitude * 1000000;
displayed_dive_site.longitude.udeg = longitude * 1000000;
markChangedWidget(ui.diveSiteCoordinates);
+ emit coordinatesChanged();
}
}
}
diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h
index 82105c333..41f626b3f 100644
--- a/qt-ui/locationinformation.h
+++ b/qt-ui/locationinformation.h
@@ -39,6 +39,7 @@ public slots:
void on_diveSiteNotes_textChanged();
signals:
void informationManagementEnded();
+ void coordinatesChanged();
private:
struct dive_site *currentDs;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1557e0fcc..1e3a89dbc 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -133,6 +133,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(mainTab, SIGNAL(requestDiveSiteEdit(uint32_t)), this, SLOT(enableDiveSiteEdit(uint32_t)));
connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
connect(locationInformation, SIGNAL(informationManagementEnded()), information(), SLOT(showLocation()));
+ connect(locationInformation, SIGNAL(coordinatesChanged()), globe(), SLOT(repopulateLabels()));
#ifdef NO_PRINTING
plannerDetails->printPlan()->hide();