From 076f86202aab51529d99f73427a1a834a0ef5d34 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 16 Jul 2015 12:41:04 -0700 Subject: [PATCH] Change API signature to act on dive_site, not uuid This way in the future we can pass in a pointer to a dive site that isn't linked in our dive site list yet (i.e., while we are editing). Signed-off-by: Dirk Hohndel --- qt-ui/globe.cpp | 4 +--- qt-ui/globe.h | 2 +- qt-ui/maintab.cpp | 4 ++-- qt-ui/maintab.h | 2 +- qt-ui/mainwindow.cpp | 2 +- qt-ui/modeldelegates.cpp | 2 +- qt-ui/subsurfacewebservices.cpp | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 244edf672..e74e4d107 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -242,10 +242,8 @@ void GlobeGPS::reload() repopulateLabels(); } -void GlobeGPS::centerOnDiveSite(uint32_t uuid) +void GlobeGPS::centerOnDiveSite(struct dive_site *ds) { - struct dive_site *ds = get_dive_site_by_uuid(uuid); - if (!dive_site_has_gps_location(ds)) { zoomOutForNoGPS(); return; diff --git a/qt-ui/globe.h b/qt-ui/globe.h index 6a255a7bd..5b34b052d 100644 --- a/qt-ui/globe.h +++ b/qt-ui/globe.h @@ -51,7 +51,7 @@ slots: void zoomOutForNoGPS(); void prepareForGetDiveCoordinates(); void endGetDiveCoordinates(); - void centerOnDiveSite(uint32_t uuid); + void centerOnDiveSite(struct dive_site *ds); }; #else // NO_MARBLE diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 9b40d31fd..4920fab4b 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -759,7 +759,7 @@ void MainTab::updateDiveInfo(bool clear) ui.cylinders->view()->hideColumn(CylindersModel::USE); qDebug() << "Set the current dive site:" << displayed_dive.dive_site_uuid; - emit diveSiteChanged(displayed_dive.dive_site_uuid); + emit diveSiteChanged(get_dive_site_by_uuid(displayed_dive.dive_site_uuid)); } void MainTab::addCylinder_clicked() @@ -1195,7 +1195,7 @@ void MainTab::rejectChanges() // the user could have edited the location and then canceled the edit // let's get the correct location back in view #ifndef NO_MARBLE - MainWindow::instance()->globe()->centerOnDiveSite(displayed_dive.dive_site_uuid); + MainWindow::instance()->globe()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid)); MainWindow::instance()->globe()->reload(); #endif // show the profile and dive info diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index f70cfe542..be38ecf61 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -58,7 +58,7 @@ public: signals: void addDiveFinished(); void dateTimeChanged(); - void diveSiteChanged(uint32_t uuid); + void diveSiteChanged(struct dive_site * ds); public slots: void addCylinder_clicked(); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 4861ad60f..d67187149 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -138,7 +138,7 @@ MainWindow::MainWindow() : QMainWindow(), connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled())); connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan())); #ifndef NO_MARBLE - connect(information(), SIGNAL(diveSiteChanged(uint32_t)), globeGps, SLOT(centerOnDiveSite(uint32_t))); + connect(information(), SIGNAL(diveSiteChanged(struct dive_site *)), globeGps, SLOT(centerOnDiveSite(struct dive_site *))); #endif wtu = new WindowTitleUpdate(); connect(WindowTitleUpdate::instance(), SIGNAL(updateTitle()), this, SLOT(setAutomaticTitle())); diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index a3978ce54..7089289aa 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -533,7 +533,7 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem #ifndef NO_MARBLE if ((option.state & QStyle::State_HasFocus) && dive_site_has_gps_location(ds)) { qDebug() << "center on" << ds->name; - MainWindow::instance()->globe()->centerOnDiveSite(ds->uuid); + MainWindow::instance()->globe()->centerOnDiveSite(ds); } #endif diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index cfd255b0e..fd9f2fad1 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -419,7 +419,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button) // we can update the globe if (changed) { MainWindow::instance()->globe()->repopulateLabels(); - MainWindow::instance()->globe()->centerOnDiveSite(current_dive->dive_site_uuid); + MainWindow::instance()->globe()->centerOnDiveSite(get_dive_site_by_uuid(current_dive->dive_site_uuid)); } #endif