aboutsummaryrefslogtreecommitdiffstats
path: root/core/gpslocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/gpslocation.cpp')
-rw-r--r--core/gpslocation.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index fd598683f..1da12fe5b 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -15,17 +15,12 @@
#include <QApplication>
#include <QTimer>
-GpsLocation *GpsLocation::m_Instance = NULL;
-
-GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) :
- QObject(parent),
+GpsLocation::GpsLocation() :
m_GpsSource(0),
+ showMessageCB(0),
waitingForPosition(false),
haveSource(UNKNOWN)
{
- Q_ASSERT_X(m_Instance == NULL, "GpsLocation", "GpsLocation recreated");
- m_Instance = this;
- showMessageCB = showMsgCB;
// create a QSettings object that's separate from the main application settings
geoSettings = new QSettings(QSettings::NativeFormat, QSettings::UserScope,
QStringLiteral("org.subsurfacedivelog"), QStringLiteral("subsurfacelocation"), this);
@@ -39,19 +34,17 @@ GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) :
GpsLocation *GpsLocation::instance()
{
- Q_ASSERT(m_Instance != NULL);
-
- return m_Instance;
+ static GpsLocation self;
+ return &self;
}
-bool GpsLocation::hasInstance()
+GpsLocation::~GpsLocation()
{
- return m_Instance != NULL;
}
-GpsLocation::~GpsLocation()
+void GpsLocation::setLogCallBack(void (*showMsgCB)(const char *))
{
- m_Instance = NULL;
+ showMessageCB = showMsgCB;
}
void GpsLocation::setGpsTimeThreshold(int seconds)