mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Revert the singleton PR
It turns out that this isn't working the way it was intended to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
400b218f76
commit
9ae7040a91
15 changed files with 118 additions and 89 deletions
|
@ -15,12 +15,16 @@
|
|||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
|
||||
GpsLocation *GpsLocation::m_Instance = NULL;
|
||||
|
||||
GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) :
|
||||
QObject(parent),
|
||||
m_GpsSource(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,
|
||||
|
@ -33,6 +37,23 @@ GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) :
|
|||
connect(qPrefLocationService::instance(), SIGNAL(time_thresholdChanged(int)), this, SLOT(setGpsTimeThreshold(int)));
|
||||
}
|
||||
|
||||
GpsLocation *GpsLocation::instance()
|
||||
{
|
||||
Q_ASSERT(m_Instance != NULL);
|
||||
|
||||
return m_Instance;
|
||||
}
|
||||
|
||||
bool GpsLocation::hasInstance()
|
||||
{
|
||||
return m_Instance != NULL;
|
||||
}
|
||||
|
||||
GpsLocation::~GpsLocation()
|
||||
{
|
||||
m_Instance = NULL;
|
||||
}
|
||||
|
||||
void GpsLocation::setGpsTimeThreshold(int seconds)
|
||||
{
|
||||
if (m_GpsSource) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue