exifitem.cpp 953 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "exifitem.h"
  2. #include "exifhandler.h"
  3. #include <QDesktopServices>
  4. ExifItem::ExifItem(QDeclarativeItem *parent) :
  5. QDeclarativeItem(parent)
  6. {
  7. m_exifHandler = new ExifHandler(this);
  8. connect(m_exifHandler,SIGNAL(gpsPosition(int,qreal,qreal)),this,SLOT(gpsPositionReady(int,qreal,qreal)));
  9. }
  10. void ExifItem::gpsPositionReady(int error , qreal longitude, qreal latitude)
  11. {
  12. m_gpsError = error;
  13. emit gpsErrorChanged();
  14. m_latitude = latitude;
  15. m_longitude = longitude;
  16. emit positionChanged();
  17. launchMaps(m_latitude,m_longitude);
  18. }
  19. void ExifItem::getGpsPointer(QUrl filename)
  20. {
  21. m_gpsError = 0;
  22. m_latitude = 0;
  23. m_longitude = 0;
  24. m_exifHandler->getImageGps(filename.toLocalFile());
  25. }
  26. void ExifItem::launchMaps(qreal latitude, qreal longitude)
  27. {
  28. QDesktopServices::openUrl(QUrl("http://m.ovi.me/?c=" + QString::number(latitude) + "," + QString::number(longitude)));
  29. }