summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/globe.cpp16
-rw-r--r--qt-ui/globe.h5
-rw-r--r--qt-ui/maintab.cpp12
-rw-r--r--qt-ui/maintab.h2
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/subsurfacewebservices.cpp2
6 files changed, 20 insertions, 19 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index f8bf1828a..1546a8bb5 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -235,25 +235,21 @@ void GlobeGPS::reload()
repopulateLabels();
}
-void GlobeGPS::centerOnCurrentDive()
+void GlobeGPS::centerOnDiveSite(uint32_t uuid)
{
- struct dive_site *ds = get_dive_site_for_dive(current_dive);
- // dive has changed, if we had the 'editingDive', hide it.
- if (messageWidget->isVisible() && (!ds || dive_site_has_gps_location(ds) || amount_selected != 1))
- messageWidget->hide();
-
- editingDiveLocation = false;
- if (!ds)
+ if (uuid == 0)
return;
- qreal longitude = ds->longitude.udeg / 1000000.0;
- qreal latitude = ds->latitude.udeg / 1000000.0;
+ struct dive_site *ds = get_dive_site_by_uuid(uuid);
if (!dive_site_has_gps_location(ds)) {
zoomOutForNoGPS();
return;
}
+ qreal longitude = ds->longitude.udeg / 1000000.0;
+ qreal latitude = ds->latitude.udeg / 1000000.0;
+
// if no zoom is set up, set the zoom as seen from 3km above
// if we come back from a dive without GPS data, reset to the last zoom value
// otherwise check to make sure we aren't still running an animation and then remember
diff --git a/qt-ui/globe.h b/qt-ui/globe.h
index 74bb42bd0..31683dc35 100644
--- a/qt-ui/globe.h
+++ b/qt-ui/globe.h
@@ -2,6 +2,7 @@
#define GLOBE_H
#ifndef NO_MARBLE
+#include <stdint.h>
#include <marble/MarbleWidget.h>
#include <marble/GeoDataCoordinates.h>
@@ -49,7 +50,7 @@ slots:
void zoomOutForNoGPS();
void prepareForGetDiveCoordinates();
void endGetDiveCoordinates();
- void centerOnCurrentDive();
+ void centerOnDiveSite(uint32_t uuid);
};
#else // NO_MARBLE
@@ -62,7 +63,7 @@ public:
GlobeGPS(QWidget *parent);
void reload();
void repopulateLabels();
- void centerOnCurrentDive();
+ void centerOnDiveSite(uint32_t uuid);
bool eventFilter(QObject *, QEvent *);
public
slots:
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ed7597e3c..68034fb62 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -701,7 +701,8 @@ void MainTab::updateDiveInfo(bool clear)
ui.cylinders->view()->hideColumn(CylindersModel::USE);
ui.location->blockSignals(false);
- emit diveSiteChanged();
+
+ emit diveSiteChanged(displayed_dive.dive_site_uuid);
}
void MainTab::addCylinder_clicked()
@@ -997,7 +998,7 @@ void MainTab::rejectChanges()
DivePictureModel::instance()->updateDivePictures();
// the user could have edited the location and then canceled the edit
// let's get the correct location back in view
- MainWindow::instance()->globe()->centerOnCurrentDive();
+ MainWindow::instance()->globe()->centerOnDiveSite(displayed_dive.dive_site_uuid);
MainWindow::instance()->globe()->reload();
// show the profile and dive info
MainWindow::instance()->graphics()->replot();
@@ -1280,9 +1281,12 @@ void MainTab::on_location_currentIndexChanged(int idx)
struct dive_site *ds_from_dive = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
if(ds_from_dive && ui.location->currentText() == ds_from_dive->name)
return;
- displayed_dive.dive_site_uuid = get_dive_site(idx)->uuid;
+ ds_from_dive = get_dive_site(idx);
+ displayed_dive.dive_site_uuid = ds_from_dive->uuid;
+
+
markChangedWidget(ui.location);
- emit diveSiteChanged();
+ emit diveSiteChanged(ds_from_dive->uuid);
}
}
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index b0af3b401..8b5880cb9 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -57,7 +57,7 @@ signals:
void addDiveFinished();
void dateTimeChanged();
void requestDiveSiteAdd();
- void diveSiteChanged();
+ void diveSiteChanged(uint32_t uuid);
public
slots:
void addCylinder_clicked();
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 495c2f6b8..70c4231f0 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -146,7 +146,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(globeGps, SIGNAL(coordinatesChanged()), locationInformation, SLOT(updateGpsCoordinates()));
connect(locationInformation, SIGNAL(startEditDiveSite(uint32_t)), globeGps, SLOT(prepareForGetDiveCoordinates()));
connect(locationInformation, SIGNAL(endEditDiveSite()), globeGps, SLOT(prepareForGetDiveCoordinates()));
- connect(information(), SIGNAL(diveSiteChanged()), globeGps, SLOT(centerOnCurrentDive()));
+ connect(information(), SIGNAL(diveSiteChanged(uint32_t)), globeGps, SLOT(centerOnDiveSite(uint32_t)));
#ifdef NO_PRINTING
plannerDetails->printPlan()->hide();
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 0d2f42a8d..0159977a7 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -347,7 +347,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button)
if (merge_locations_into_dives()) {
mark_divelist_changed(true);
MainWindow::instance()->globe()->repopulateLabels();
- MainWindow::instance()->globe()->centerOnCurrentDive();
+ MainWindow::instance()->globe()->centerOnDiveSite(current_dive->dive_site_uuid);
MainWindow::instance()->information()->updateDiveInfo();
}