diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index 2ebc92e0a..92c289051 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -3,6 +3,8 @@ #include #include "mapwidget.h" +#include "core/dive.h" +#include "core/divesite.h" MapWidget *MapWidget::m_instance = NULL; @@ -14,6 +16,17 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent) m_rootItem = qobject_cast(rootObject()); } +void MapWidget::centerOnDiveSite(struct dive_site *ds) +{ + if (!dive_site_has_gps_location(ds)) + return; + + qreal longitude = ds->longitude.udeg / 1000000.0; + qreal latitude = ds->latitude.udeg / 1000000.0; + + qDebug() << longitude << latitude; +} + MapWidget::~MapWidget() { m_instance = NULL; diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h index c1d55ae91..d2aefb687 100644 --- a/desktop-widgets/mapwidget.h +++ b/desktop-widgets/mapwidget.h @@ -3,17 +3,25 @@ #include +#include "core/divesite.h" + class QResizeEvent; class QQuickItem; +struct dive_site; class MapWidget : public QQuickWidget { + Q_OBJECT + public: MapWidget(QWidget *parent = NULL); ~MapWidget(); static MapWidget *instance(); +public slots: + void centerOnDiveSite(struct dive_site *); + private: static MapWidget *m_instance; QQuickItem *m_rootItem;