2013-05-17 08:14:10 -03:00
|
|
|
#ifndef GLOBE_H
|
|
|
|
#define GLOBE_H
|
|
|
|
|
2015-06-05 10:52:52 -03:00
|
|
|
#include <stdint.h>
|
2015-06-09 10:19:52 +02:00
|
|
|
|
|
|
|
#ifndef NO_MARBLE
|
2013-05-17 08:14:10 -03:00
|
|
|
#include <marble/MarbleWidget.h>
|
2013-05-17 16:12:55 -03:00
|
|
|
#include <marble/GeoDataCoordinates.h>
|
|
|
|
|
2013-05-17 14:09:10 -03:00
|
|
|
#include <QHash>
|
2013-05-17 08:14:10 -03:00
|
|
|
|
2014-06-26 14:01:31 -03:00
|
|
|
namespace Marble{
|
|
|
|
class GeoDataDocument;
|
|
|
|
}
|
|
|
|
|
2013-05-17 21:58:49 -03:00
|
|
|
class KMessageWidget;
|
2013-05-17 16:12:55 -03:00
|
|
|
using namespace Marble;
|
|
|
|
struct dive;
|
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
class GlobeGPS : public MarbleWidget {
|
2013-05-17 08:14:10 -03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-05-17 16:12:55 -03:00
|
|
|
using MarbleWidget::centerOn;
|
2015-02-09 16:23:30 -02:00
|
|
|
GlobeGPS(QWidget *parent = 0);
|
2013-05-17 13:28:02 -03:00
|
|
|
void reload();
|
2014-02-27 20:09:57 -08:00
|
|
|
bool eventFilter(QObject *, QEvent *);
|
|
|
|
|
2013-05-17 16:12:55 -03:00
|
|
|
protected:
|
2013-10-17 14:53:12 -07:00
|
|
|
/* reimp */ void resizeEvent(QResizeEvent *event);
|
2014-02-27 20:09:57 -08:00
|
|
|
/* reimp */ void mousePressEvent(QMouseEvent *event);
|
|
|
|
/* reimp */ void contextMenuEvent(QContextMenuEvent *);
|
|
|
|
|
2013-05-17 13:28:02 -03:00
|
|
|
private:
|
2013-05-17 16:12:55 -03:00
|
|
|
GeoDataDocument *loadedDives;
|
2014-02-27 20:09:57 -08:00
|
|
|
KMessageWidget *messageWidget;
|
2013-10-17 14:53:12 -07:00
|
|
|
QTimer *fixZoomTimer;
|
|
|
|
int currentZoomLevel;
|
2014-05-01 14:48:14 -07:00
|
|
|
bool needResetZoom;
|
2013-12-02 15:06:19 -02:00
|
|
|
bool editingDiveLocation;
|
2014-06-11 09:25:55 -07:00
|
|
|
bool doubleClick;
|
2013-05-17 16:12:55 -03:00
|
|
|
|
2015-01-19 17:32:17 +12:00
|
|
|
signals:
|
2015-06-01 22:30:33 -03:00
|
|
|
void coordinatesChanged();
|
2015-01-19 17:32:17 +12:00
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
public
|
|
|
|
slots:
|
2015-05-22 12:15:53 -07:00
|
|
|
void repopulateLabels();
|
2014-02-27 20:09:57 -08:00
|
|
|
void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit);
|
2013-06-05 14:44:12 +09:00
|
|
|
void mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit);
|
2015-07-08 13:45:24 -07:00
|
|
|
void fixZoom(bool now = false);
|
2014-05-01 14:47:52 -03:00
|
|
|
void zoomOutForNoGPS();
|
2014-05-07 14:01:05 -07:00
|
|
|
void prepareForGetDiveCoordinates();
|
2015-06-03 22:53:38 -03:00
|
|
|
void endGetDiveCoordinates();
|
2015-07-16 12:41:04 -07:00
|
|
|
void centerOnDiveSite(struct dive_site *ds);
|
2015-07-16 18:47:57 -03:00
|
|
|
void centerOnIndex(const QModelIndex& idx);
|
2013-05-17 08:14:10 -03:00
|
|
|
};
|
|
|
|
|
2014-03-26 23:08:56 +01:00
|
|
|
#else // NO_MARBLE
|
|
|
|
/* Dummy widget for when we don't have MarbleWidget */
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
class GlobeGPS : public QLabel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
GlobeGPS(QWidget *parent);
|
|
|
|
void reload();
|
|
|
|
void repopulateLabels();
|
2015-06-05 10:52:52 -03:00
|
|
|
void centerOnDiveSite(uint32_t uuid);
|
2015-07-16 18:47:57 -03:00
|
|
|
void centerOnIndex(const QModelIndex& idx);
|
2015-06-09 10:19:52 +02:00
|
|
|
void centerOnCurrentDive();
|
2014-05-22 11:40:22 -07:00
|
|
|
bool eventFilter(QObject *, QEvent *);
|
|
|
|
public
|
|
|
|
slots:
|
2014-05-14 00:32:44 +02:00
|
|
|
void prepareForGetDiveCoordinates();
|
2015-06-04 17:25:06 +03:00
|
|
|
void endGetDiveCoordinates();
|
2014-03-26 23:08:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NO_MARBLE
|
2015-06-10 11:45:34 -07:00
|
|
|
|
|
|
|
extern "C" double getDistance(int lat1, int lon1, int lat2, int lon2);
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // GLOBE_H
|