Files
comaps/platform/qt_location_service.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

29 lines
949 B
C++

#pragma once
#include "platform/location_service.hpp"
#include <QGeoPositionInfoSource>
class QtLocationService : public QObject, public location::LocationService
{
Q_OBJECT
QGeoPositionInfoSource *m_positionSource;
// Unfortunately when the source is `geoclue2`
// we would need access to the `Active` D-Bus property
// https://www.freedesktop.org/software/geoclue/docs
// /gdbus-org.freedesktop.GeoClue2.Client.html#gdbus-property-org-freedesktop-GeoClue2-Client.Active
// But `QGeoPositionInfoSource` doesn't expose that so we have to deduce its state.
bool m_clientIsActive = false;
public:
explicit QtLocationService(location::LocationObserver &, std::string const &);
virtual ~QtLocationService() {};
virtual void Start();
virtual void Stop();
public slots:
void OnLocationUpdate(QGeoPositionInfo const &);
void OnErrorOccurred(QGeoPositionInfoSource::Error);
void OnSupportedPositioningMethodsChanged();
};