2013-05-17 11:14:10 +00:00
|
|
|
#include "globe.h"
|
2014-03-26 22:08:56 +00:00
|
|
|
#ifndef NO_MARBLE
|
2013-05-18 00:58:49 +00:00
|
|
|
#include "kmessagewidget.h"
|
2013-06-05 06:41:52 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
2014-05-01 17:47:52 +00:00
|
|
|
#include "dive.h"
|
|
|
|
#include "divelist.h"
|
|
|
|
#include "helpers.h"
|
|
|
|
#include "display.h"
|
2013-05-17 16:28:02 +00:00
|
|
|
|
|
|
|
#include <QDebug>
|
2013-10-17 21:53:12 +00:00
|
|
|
#include <QTimer>
|
2013-05-17 16:28:02 +00:00
|
|
|
|
2013-05-17 11:14:10 +00:00
|
|
|
#include <marble/AbstractFloatItem.h>
|
2013-05-17 16:28:02 +00:00
|
|
|
#include <marble/GeoDataPlacemark.h>
|
|
|
|
#include <marble/GeoDataDocument.h>
|
|
|
|
#include <marble/MarbleModel.h>
|
2013-05-25 15:28:35 +00:00
|
|
|
#include <marble/MarbleDirs.h>
|
2013-05-29 19:59:38 +00:00
|
|
|
#include <marble/MapThemeManager.h>
|
2013-06-05 02:46:57 +00:00
|
|
|
#include <marble/GeoDataLineString.h>
|
2013-05-18 16:44:54 +00:00
|
|
|
#if INCOMPLETE_MARBLE
|
|
|
|
#include "marble/GeoDataTreeModel.h"
|
|
|
|
#else
|
2013-05-17 16:28:02 +00:00
|
|
|
#include <marble/GeoDataTreeModel.h>
|
2013-05-18 16:44:54 +00:00
|
|
|
#endif
|
2013-05-17 19:12:55 +00:00
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QMessageBox>
|
2013-05-17 11:14:10 +00:00
|
|
|
|
2014-05-04 18:35:34 +00:00
|
|
|
// as of Marble 4.10 (which has MARBLE_VERSION 0x001000) zoomView is
|
|
|
|
// deprecated and has been replaced by setZoom with the same function signature
|
|
|
|
#if MARBLE_VERSION < 0x001000
|
|
|
|
#define setZoom zoomView
|
|
|
|
#endif
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
|
2014-02-09 18:41:47 +00:00
|
|
|
loadedDives(0),
|
|
|
|
messageWidget(new KMessageWidget(this)),
|
|
|
|
fixZoomTimer(new QTimer(this)),
|
|
|
|
currentZoomLevel(0),
|
2014-05-01 21:48:14 +00:00
|
|
|
needResetZoom(false),
|
2014-02-09 18:41:47 +00:00
|
|
|
editingDiveLocation(false)
|
2013-05-17 11:14:10 +00:00
|
|
|
{
|
2013-05-29 19:59:38 +00:00
|
|
|
// check if Google Sat Maps are installed
|
|
|
|
// if not, check if they are in a known location
|
|
|
|
MapThemeManager mtm;
|
|
|
|
QStringList list = mtm.mapThemeIds();
|
2014-02-28 04:09:57 +00:00
|
|
|
QString subsurfaceDataPath;
|
2013-05-29 19:59:38 +00:00
|
|
|
QDir marble;
|
2013-12-26 14:02:58 +00:00
|
|
|
if (!list.contains("earth/googlesat/googlesat.dgml")) {
|
2013-05-30 21:26:08 +00:00
|
|
|
subsurfaceDataPath = getSubsurfaceDataPath("marbledata");
|
2013-11-29 19:46:41 +00:00
|
|
|
if (subsurfaceDataPath != "") {
|
2013-05-30 21:26:08 +00:00
|
|
|
MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
|
2013-11-29 19:46:41 +00:00
|
|
|
} else {
|
|
|
|
subsurfaceDataPath = getSubsurfaceDataPath("data");
|
|
|
|
if (subsurfaceDataPath != "")
|
|
|
|
MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
|
|
|
|
}
|
2013-05-30 07:08:11 +00:00
|
|
|
}
|
2013-05-24 19:15:49 +00:00
|
|
|
messageWidget->setCloseButtonVisible(false);
|
|
|
|
messageWidget->setHidden(true);
|
2013-05-18 01:52:04 +00:00
|
|
|
|
2013-05-24 14:07:59 +00:00
|
|
|
setMapThemeId("earth/googlesat/googlesat.dgml");
|
2013-05-18 01:52:04 +00:00
|
|
|
//setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
|
2013-05-23 04:25:05 +00:00
|
|
|
setProjection(Marble::Spherical);
|
2013-05-17 11:14:10 +00:00
|
|
|
|
2013-05-17 17:09:10 +00:00
|
|
|
setAnimationsEnabled(true);
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_FOREACH(AbstractFloatItem * i, floatItems()) {
|
2013-11-22 02:33:44 +00:00
|
|
|
i->setVisible(false);
|
|
|
|
}
|
|
|
|
|
2013-05-23 04:25:05 +00:00
|
|
|
setShowClouds(false);
|
|
|
|
setShowBorders(false);
|
|
|
|
setShowPlaces(true);
|
|
|
|
setShowCrosshairs(false);
|
|
|
|
setShowGrid(false);
|
2013-05-17 11:14:10 +00:00
|
|
|
setShowOverviewMap(false);
|
2013-05-18 01:52:04 +00:00
|
|
|
setShowScaleBar(true);
|
2013-05-24 19:21:16 +00:00
|
|
|
setShowCompass(false);
|
2013-09-26 21:14:09 +00:00
|
|
|
connect(this, SIGNAL(mouseClickGeoPosition(qreal, qreal, GeoDataCoordinates::Unit)),
|
2014-02-28 04:09:57 +00:00
|
|
|
this, SLOT(mouseClicked(qreal, qreal, GeoDataCoordinates::Unit)));
|
2013-09-26 21:14:09 +00:00
|
|
|
|
|
|
|
setMinimumHeight(0);
|
|
|
|
setMinimumWidth(0);
|
2013-10-17 21:53:12 +00:00
|
|
|
connect(fixZoomTimer, SIGNAL(timeout()), this, SLOT(fixZoom()));
|
|
|
|
fixZoomTimer->setSingleShot(true);
|
2013-11-22 02:22:57 +00:00
|
|
|
installEventFilter(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev)
|
|
|
|
{
|
|
|
|
// This disables Zooming when a double click occours on the scene.
|
2013-12-02 17:06:19 +00:00
|
|
|
if (ev->type() == QEvent::MouseButtonDblClick && !editingDiveLocation)
|
2013-11-22 02:22:57 +00:00
|
|
|
return true;
|
|
|
|
// This disables the Marble's Context Menu
|
|
|
|
// we need to move this to our 'contextMenuEvent'
|
|
|
|
// if we plan to do a different one in the future.
|
2014-01-16 04:50:56 +00:00
|
|
|
if (ev->type() == QEvent::ContextMenu) {
|
2014-02-28 04:09:57 +00:00
|
|
|
contextMenuEvent(static_cast<QContextMenuEvent *>(ev));
|
2013-11-22 02:22:57 +00:00
|
|
|
return true;
|
2013-12-02 17:06:19 +00:00
|
|
|
}
|
2014-01-16 04:50:56 +00:00
|
|
|
if (ev->type() == QEvent::MouseButtonPress) {
|
2014-02-28 04:09:57 +00:00
|
|
|
QMouseEvent *e = static_cast<QMouseEvent *>(ev);
|
|
|
|
if (e->button() == Qt::RightButton)
|
2013-11-22 02:22:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-02-28 04:09:57 +00:00
|
|
|
return QObject::eventFilter(obj, ev);
|
2013-12-02 17:06:19 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
void GlobeGPS::contextMenuEvent(QContextMenuEvent *ev)
|
2013-12-02 17:06:19 +00:00
|
|
|
{
|
|
|
|
QMenu m;
|
|
|
|
QAction *a = m.addAction(tr("Edit Selected Dive Locations"), this, SLOT(prepareForGetDiveCoordinates()));
|
2014-02-28 04:09:57 +00:00
|
|
|
a->setData(QVariant::fromValue<void *>(&m));
|
2013-12-02 17:06:19 +00:00
|
|
|
m.exec(ev->globalPos());
|
2013-06-05 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
|
|
|
|
{
|
2013-11-10 21:23:18 +00:00
|
|
|
// don't mess with the selection while the user is editing a dive
|
2014-05-01 16:45:43 +00:00
|
|
|
if (MainWindow::instance()->information()->isEditing() || messageWidget->isVisible())
|
2013-11-10 21:23:18 +00:00
|
|
|
return;
|
|
|
|
|
2013-06-05 05:44:12 +00:00
|
|
|
GeoDataCoordinates here(lon, lat, unit);
|
2013-06-05 06:41:52 +00:00
|
|
|
long lon_udeg = rint(1000000 * here.longitude(GeoDataCoordinates::Degree));
|
|
|
|
long lat_udeg = rint(1000000 * here.latitude(GeoDataCoordinates::Degree));
|
|
|
|
|
|
|
|
// distance() is in km above the map.
|
|
|
|
// We're going to use that to decide how
|
|
|
|
// approximate the dives have to be.
|
|
|
|
//
|
|
|
|
// Totally arbitrarily I say that 1km
|
|
|
|
// distance means that we can resolve
|
|
|
|
// to about 100m. Which in turn is about
|
|
|
|
// 1000 udeg.
|
|
|
|
//
|
|
|
|
// Trigonometry is hard, but sin x == x
|
|
|
|
// for small x, so let's just do this as
|
|
|
|
// a linear thing.
|
|
|
|
long resolve = rint(distance() * 1000);
|
|
|
|
|
|
|
|
int idx;
|
|
|
|
struct dive *dive;
|
2013-12-03 17:29:40 +00:00
|
|
|
bool clear = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
|
2013-12-02 19:15:40 +00:00
|
|
|
QList<int> selectedDiveIds;
|
2013-06-05 06:41:52 +00:00
|
|
|
for_each_dive(idx, dive) {
|
|
|
|
long lat_diff, lon_diff;
|
|
|
|
if (!dive_has_gps_location(dive))
|
|
|
|
continue;
|
|
|
|
lat_diff = labs(dive->latitude.udeg - lat_udeg);
|
|
|
|
lon_diff = labs(dive->longitude.udeg - lon_udeg);
|
|
|
|
if (lat_diff > 180000000)
|
|
|
|
lat_diff = 360000000 - lat_diff;
|
|
|
|
if (lon_diff > 180000000)
|
|
|
|
lon_diff = 180000000 - lon_diff;
|
|
|
|
if (lat_diff > resolve || lon_diff > resolve)
|
|
|
|
continue;
|
|
|
|
|
2013-12-02 19:15:40 +00:00
|
|
|
selectedDiveIds.push_back(idx);
|
2013-06-05 06:41:52 +00:00
|
|
|
}
|
2014-01-16 04:50:56 +00:00
|
|
|
if (selectedDiveIds.empty())
|
2013-12-03 17:29:40 +00:00
|
|
|
return;
|
2014-03-04 05:24:52 +00:00
|
|
|
if (clear)
|
2014-02-12 14:22:54 +00:00
|
|
|
MainWindow::instance()->dive_list()->unselectDives();
|
|
|
|
MainWindow::instance()->dive_list()->selectDives(selectedDiveIds);
|
2013-05-17 11:14:10 +00:00
|
|
|
}
|
2013-05-17 16:28:02 +00:00
|
|
|
|
2013-11-19 12:23:59 +00:00
|
|
|
void GlobeGPS::repopulateLabels()
|
2013-05-17 16:28:02 +00:00
|
|
|
{
|
2013-05-23 04:25:05 +00:00
|
|
|
if (loadedDives) {
|
2013-05-17 16:28:02 +00:00
|
|
|
model()->treeModel()->removeDocument(loadedDives);
|
|
|
|
delete loadedDives;
|
|
|
|
}
|
|
|
|
loadedDives = new GeoDataDocument;
|
2013-06-05 02:46:57 +00:00
|
|
|
QMap<QString, GeoDataPlacemark *> locationMap;
|
2013-05-17 16:28:02 +00:00
|
|
|
|
|
|
|
int idx = 0;
|
|
|
|
struct dive *dive;
|
|
|
|
for_each_dive(idx, dive) {
|
|
|
|
if (dive_has_gps_location(dive)) {
|
2013-05-23 04:25:05 +00:00
|
|
|
GeoDataPlacemark *place = new GeoDataPlacemark(dive->location);
|
2014-02-28 04:09:57 +00:00
|
|
|
place->setCoordinate(dive->longitude.udeg / 1000000.0, dive->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree);
|
2013-06-05 02:46:57 +00:00
|
|
|
// don't add dive locations twice, unless they are at least 50m apart
|
|
|
|
if (locationMap[QString(dive->location)]) {
|
2013-06-08 05:02:00 +00:00
|
|
|
GeoDataCoordinates existingLocation = locationMap[QString(dive->location)]->coordinate();
|
2013-06-05 02:46:57 +00:00
|
|
|
GeoDataLineString segment = GeoDataLineString();
|
|
|
|
segment.append(existingLocation);
|
2013-06-08 05:02:00 +00:00
|
|
|
GeoDataCoordinates newLocation = place->coordinate();
|
2013-06-05 02:46:57 +00:00
|
|
|
segment.append(newLocation);
|
|
|
|
double dist = segment.length(6371);
|
|
|
|
// the dist is scaled to the radius given - so with 6371km as radius
|
|
|
|
// 50m turns into 0.05 as threashold
|
|
|
|
if (dist < 0.05)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
locationMap[QString(dive->location)] = place;
|
2013-05-23 04:25:05 +00:00
|
|
|
loadedDives->append(place);
|
2013-05-17 16:28:02 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-23 04:25:05 +00:00
|
|
|
model()->treeModel()->addDocument(loadedDives);
|
2013-05-17 16:28:02 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 12:23:59 +00:00
|
|
|
void GlobeGPS::reload()
|
|
|
|
{
|
2013-12-02 17:06:19 +00:00
|
|
|
editingDiveLocation = false;
|
2013-11-29 21:11:17 +00:00
|
|
|
if (messageWidget->isVisible())
|
2013-12-03 23:25:20 +00:00
|
|
|
messageWidget->hide();
|
2013-11-19 12:23:59 +00:00
|
|
|
repopulateLabels();
|
|
|
|
}
|
|
|
|
|
2014-05-07 20:58:07 +00:00
|
|
|
void GlobeGPS::centerOnCurrentDive()
|
2013-05-17 16:28:02 +00:00
|
|
|
{
|
2014-05-07 20:58:07 +00:00
|
|
|
struct dive *dive = current_dive;
|
2013-05-18 00:58:49 +00:00
|
|
|
// dive has changed, if we had the 'editingDive', hide it.
|
2014-05-01 17:47:52 +00:00
|
|
|
if (messageWidget->isVisible()
|
|
|
|
&& (!dive || dive_has_gps_location(dive) || amount_selected != 1 ))
|
2013-12-03 23:25:20 +00:00
|
|
|
messageWidget->hide();
|
2014-05-01 17:47:52 +00:00
|
|
|
|
|
|
|
editingDiveLocation = false;
|
2013-05-31 12:05:33 +00:00
|
|
|
if (!dive)
|
|
|
|
return;
|
2014-05-01 17:47:52 +00:00
|
|
|
|
2013-05-17 19:12:55 +00:00
|
|
|
qreal longitude = dive->longitude.udeg / 1000000.0;
|
|
|
|
qreal latitude = dive->latitude.udeg / 1000000.0;
|
|
|
|
|
2014-05-01 17:47:52 +00:00
|
|
|
if ((!dive_has_gps_location(dive) || MainWindow::instance()->information()->isEditing())
|
|
|
|
&& amount_selected == 1) {
|
2014-05-07 21:01:05 +00:00
|
|
|
prepareForGetDiveCoordinates();
|
2014-05-01 17:47:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dive_has_gps_location(dive)) {
|
|
|
|
zoomOutForNoGPS();
|
2013-05-17 19:12:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-27 17:27:14 +00:00
|
|
|
|
2014-05-01 21:48:14 +00:00
|
|
|
// if no zoom is set up, set the zoom as seen from 3km above
|
|
|
|
// if we come back from a dive without GPS data, reset to the last zoom value
|
|
|
|
// otherwise check to make sure we aren't still running an animation and then remember
|
|
|
|
// the current zoom level
|
|
|
|
if (!zoom()) {
|
|
|
|
currentZoomLevel = zoomFromDistance(3);
|
|
|
|
fixZoom();
|
|
|
|
} else if (needResetZoom) {
|
|
|
|
needResetZoom = false;
|
|
|
|
fixZoom();
|
|
|
|
} else if (!fixZoomTimer->isActive())
|
2014-02-28 04:09:57 +00:00
|
|
|
currentZoomLevel = zoom();
|
2013-10-17 21:53:12 +00:00
|
|
|
// From the marble source code, the maximum time of
|
|
|
|
// 'spin and fit' is 2 seconds, so wait a bit them zoom again.
|
|
|
|
fixZoomTimer->start(2100);
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
centerOn(longitude, latitude, true);
|
2013-05-17 19:12:55 +00:00
|
|
|
}
|
|
|
|
|
2013-10-17 21:53:12 +00:00
|
|
|
void GlobeGPS::fixZoom()
|
|
|
|
{
|
2014-05-01 21:48:14 +00:00
|
|
|
setZoom(currentZoomLevel, Marble::Linear);
|
2013-10-17 21:53:12 +00:00
|
|
|
}
|
|
|
|
|
2014-05-01 17:47:52 +00:00
|
|
|
void GlobeGPS::zoomOutForNoGPS()
|
|
|
|
{
|
|
|
|
// this is called if the dive has no GPS location.
|
|
|
|
// zoom out quite a bit to show the globe and remember that the next time
|
|
|
|
// we show a dive with GPS location we need to zoom in again
|
|
|
|
if(fixZoomTimer->isActive())
|
|
|
|
fixZoomTimer->stop();
|
|
|
|
setZoom(1200, Marble::Automatic);
|
|
|
|
if (!needResetZoom) {
|
|
|
|
needResetZoom = true;
|
|
|
|
currentZoomLevel = zoom();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-07 21:01:05 +00:00
|
|
|
void GlobeGPS::prepareForGetDiveCoordinates()
|
2013-05-17 19:12:55 +00:00
|
|
|
{
|
2013-05-22 14:28:25 +00:00
|
|
|
if (!messageWidget->isVisible()) {
|
|
|
|
messageWidget->setMessageType(KMessageWidget::Warning);
|
2013-12-03 23:25:20 +00:00
|
|
|
messageWidget->setText(QObject::tr("Move the map and double-click to set the dive location"));
|
2013-05-22 14:28:25 +00:00
|
|
|
messageWidget->setWordWrap(true);
|
|
|
|
messageWidget->animatedShow();
|
2013-12-02 17:06:19 +00:00
|
|
|
editingDiveLocation = true;
|
2014-05-07 21:01:05 +00:00
|
|
|
if (!dive_has_gps_location(current_dive))
|
2014-05-01 17:47:52 +00:00
|
|
|
zoomOutForNoGPS();
|
2013-05-22 14:28:25 +00:00
|
|
|
}
|
2013-11-19 12:12:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-17 19:12:55 +00:00
|
|
|
void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
|
|
|
|
{
|
2013-12-03 23:25:20 +00:00
|
|
|
messageWidget->hide();
|
|
|
|
|
2014-02-12 14:22:54 +00:00
|
|
|
if (MainWindow::instance()->dive_list()->selectionModel()->selection().isEmpty())
|
2013-12-02 17:06:19 +00:00
|
|
|
return;
|
|
|
|
|
2013-05-17 19:12:55 +00:00
|
|
|
// convert to degrees if in radian.
|
2013-05-23 04:25:05 +00:00
|
|
|
if (unit == GeoDataCoordinates::Radian) {
|
2013-05-17 19:12:55 +00:00
|
|
|
lon = lon * 180 / M_PI;
|
|
|
|
lat = lat * 180 / M_PI;
|
|
|
|
}
|
|
|
|
|
2014-05-02 04:21:59 +00:00
|
|
|
// right now we try to only ever do this with one dive selected,
|
|
|
|
// but we keep the code here that changes the coordinates for each selected dive
|
2013-11-17 20:17:41 +00:00
|
|
|
int i;
|
2014-02-28 04:09:57 +00:00
|
|
|
struct dive *dive;
|
2014-01-16 04:50:56 +00:00
|
|
|
for_each_dive(i, dive) {
|
|
|
|
if (!dive->selected)
|
2013-11-17 20:17:41 +00:00
|
|
|
continue;
|
|
|
|
dive->latitude.udeg = lrint(lat * 1000000.0);
|
|
|
|
dive->longitude.udeg = lrint(lon * 1000000.0);
|
|
|
|
}
|
2013-05-17 19:12:55 +00:00
|
|
|
centerOn(lon, lat, true);
|
2013-12-02 17:06:19 +00:00
|
|
|
editingDiveLocation = false;
|
2014-01-15 08:30:42 +00:00
|
|
|
mark_divelist_changed(true);
|
2014-02-12 14:22:54 +00:00
|
|
|
MainWindow::instance()->refreshDisplay();
|
2013-05-17 16:28:02 +00:00
|
|
|
}
|
2013-05-17 19:12:55 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
void GlobeGPS::mousePressEvent(QMouseEvent *event)
|
2013-05-17 19:12:55 +00:00
|
|
|
{
|
2014-05-02 04:21:59 +00:00
|
|
|
if (event->type() != QEvent::MouseButtonDblClick)
|
|
|
|
return;
|
|
|
|
|
2013-05-17 19:12:55 +00:00
|
|
|
qreal lat, lon;
|
2013-12-02 17:06:19 +00:00
|
|
|
bool clickOnGlobe = geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree);
|
|
|
|
|
2013-11-19 12:12:31 +00:00
|
|
|
// there could be two scenarios that got us here; let's check if we are editing a dive
|
2014-02-12 14:22:54 +00:00
|
|
|
if (MainWindow::instance()->information()->isEditing() && clickOnGlobe) {
|
|
|
|
MainWindow::instance()->information()->updateCoordinatesText(lat, lon);
|
2013-11-19 12:23:59 +00:00
|
|
|
repopulateLabels();
|
2013-12-02 17:06:19 +00:00
|
|
|
} else if (clickOnGlobe) {
|
2013-05-24 23:06:51 +00:00
|
|
|
changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree);
|
2013-05-17 19:12:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
void GlobeGPS::resizeEvent(QResizeEvent *event)
|
2013-05-18 00:58:49 +00:00
|
|
|
{
|
2014-02-28 04:09:57 +00:00
|
|
|
int size = event->size().width();
|
2013-05-24 19:15:49 +00:00
|
|
|
MarbleWidget::resizeEvent(event);
|
|
|
|
if (size > 600)
|
|
|
|
messageWidget->setGeometry((size - 600) / 2, 5, 600, 0);
|
|
|
|
else
|
|
|
|
messageWidget->setGeometry(5, 5, size - 10, 0);
|
|
|
|
messageWidget->setMaximumHeight(500);
|
|
|
|
}
|
2014-03-26 22:08:56 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
GlobeGPS::GlobeGPS(QWidget* parent) { setText("MARBLE DISABLED AT BUILD TIME"); }
|
|
|
|
void GlobeGPS::repopulateLabels() {}
|
|
|
|
void GlobeGPS::centerOn(dive* dive) {}
|
|
|
|
bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) {}
|
2014-05-08 20:13:53 +00:00
|
|
|
void GlobeGPS::prepareForGetDiveCoordinates(struct dive *dive) {}
|
2014-03-26 22:08:56 +00:00
|
|
|
void GlobeGPS::reload() {}
|
|
|
|
#endif
|