mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-18 00:26:15 +00:00
Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the globe coordinates correctly - but this is not always the case: you can be inserting a new dive site and it isn't yet inside of the dive until the user presses accept. So always pass the uuid of the dive site that we want to display. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
218ad95d7d
commit
6b81fb49d0
6 changed files with 20 additions and 19 deletions
|
@ -235,25 +235,21 @@ void GlobeGPS::reload()
|
||||||
repopulateLabels();
|
repopulateLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobeGPS::centerOnCurrentDive()
|
void GlobeGPS::centerOnDiveSite(uint32_t uuid)
|
||||||
{
|
{
|
||||||
struct dive_site *ds = get_dive_site_for_dive(current_dive);
|
if (uuid == 0)
|
||||||
// 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)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qreal longitude = ds->longitude.udeg / 1000000.0;
|
struct dive_site *ds = get_dive_site_by_uuid(uuid);
|
||||||
qreal latitude = ds->latitude.udeg / 1000000.0;
|
|
||||||
|
|
||||||
if (!dive_site_has_gps_location(ds)) {
|
if (!dive_site_has_gps_location(ds)) {
|
||||||
zoomOutForNoGPS();
|
zoomOutForNoGPS();
|
||||||
return;
|
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 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
|
// 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
|
// otherwise check to make sure we aren't still running an animation and then remember
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define GLOBE_H
|
#define GLOBE_H
|
||||||
#ifndef NO_MARBLE
|
#ifndef NO_MARBLE
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <marble/MarbleWidget.h>
|
#include <marble/MarbleWidget.h>
|
||||||
#include <marble/GeoDataCoordinates.h>
|
#include <marble/GeoDataCoordinates.h>
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ slots:
|
||||||
void zoomOutForNoGPS();
|
void zoomOutForNoGPS();
|
||||||
void prepareForGetDiveCoordinates();
|
void prepareForGetDiveCoordinates();
|
||||||
void endGetDiveCoordinates();
|
void endGetDiveCoordinates();
|
||||||
void centerOnCurrentDive();
|
void centerOnDiveSite(uint32_t uuid);
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // NO_MARBLE
|
#else // NO_MARBLE
|
||||||
|
@ -62,7 +63,7 @@ public:
|
||||||
GlobeGPS(QWidget *parent);
|
GlobeGPS(QWidget *parent);
|
||||||
void reload();
|
void reload();
|
||||||
void repopulateLabels();
|
void repopulateLabels();
|
||||||
void centerOnCurrentDive();
|
void centerOnDiveSite(uint32_t uuid);
|
||||||
bool eventFilter(QObject *, QEvent *);
|
bool eventFilter(QObject *, QEvent *);
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
|
|
|
@ -701,7 +701,8 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
ui.cylinders->view()->hideColumn(CylindersModel::USE);
|
ui.cylinders->view()->hideColumn(CylindersModel::USE);
|
||||||
|
|
||||||
ui.location->blockSignals(false);
|
ui.location->blockSignals(false);
|
||||||
emit diveSiteChanged();
|
|
||||||
|
emit diveSiteChanged(displayed_dive.dive_site_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::addCylinder_clicked()
|
void MainTab::addCylinder_clicked()
|
||||||
|
@ -997,7 +998,7 @@ void MainTab::rejectChanges()
|
||||||
DivePictureModel::instance()->updateDivePictures();
|
DivePictureModel::instance()->updateDivePictures();
|
||||||
// the user could have edited the location and then canceled the edit
|
// the user could have edited the location and then canceled the edit
|
||||||
// let's get the correct location back in view
|
// 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();
|
MainWindow::instance()->globe()->reload();
|
||||||
// show the profile and dive info
|
// show the profile and dive info
|
||||||
MainWindow::instance()->graphics()->replot();
|
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);
|
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)
|
if(ds_from_dive && ui.location->currentText() == ds_from_dive->name)
|
||||||
return;
|
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);
|
markChangedWidget(ui.location);
|
||||||
emit diveSiteChanged();
|
emit diveSiteChanged(ds_from_dive->uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ signals:
|
||||||
void addDiveFinished();
|
void addDiveFinished();
|
||||||
void dateTimeChanged();
|
void dateTimeChanged();
|
||||||
void requestDiveSiteAdd();
|
void requestDiveSiteAdd();
|
||||||
void diveSiteChanged();
|
void diveSiteChanged(uint32_t uuid);
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
void addCylinder_clicked();
|
void addCylinder_clicked();
|
||||||
|
|
|
@ -146,7 +146,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(globeGps, SIGNAL(coordinatesChanged()), locationInformation, SLOT(updateGpsCoordinates()));
|
connect(globeGps, SIGNAL(coordinatesChanged()), locationInformation, SLOT(updateGpsCoordinates()));
|
||||||
connect(locationInformation, SIGNAL(startEditDiveSite(uint32_t)), globeGps, SLOT(prepareForGetDiveCoordinates()));
|
connect(locationInformation, SIGNAL(startEditDiveSite(uint32_t)), globeGps, SLOT(prepareForGetDiveCoordinates()));
|
||||||
connect(locationInformation, SIGNAL(endEditDiveSite()), 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
|
#ifdef NO_PRINTING
|
||||||
plannerDetails->printPlan()->hide();
|
plannerDetails->printPlan()->hide();
|
||||||
|
|
|
@ -347,7 +347,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button)
|
||||||
if (merge_locations_into_dives()) {
|
if (merge_locations_into_dives()) {
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
MainWindow::instance()->globe()->repopulateLabels();
|
MainWindow::instance()->globe()->repopulateLabels();
|
||||||
MainWindow::instance()->globe()->centerOnCurrentDive();
|
MainWindow::instance()->globe()->centerOnDiveSite(current_dive->dive_site_uuid);
|
||||||
MainWindow::instance()->information()->updateDiveInfo();
|
MainWindow::instance()->information()->updateDiveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue