#include "engine.h"
#include "ui/mainwindow.h"
+#include "gps/gpspositioninterface.h"
+
+#ifdef Q_WS_MAEMO_5
#include "gps/gpsposition.h"
+#else
+#include "gps/gpspositionmockup.h"
+#endif
SituareEngine::SituareEngine(QMainWindow *parent)
: QObject(parent)
m_facebookAuthenticator = new FacebookAuthentication();
+#ifdef Q_WS_MAEMO_5
m_gps = new GPSPosition(this);
+#else
+ m_gps = new GPSPositionMockup(this);
+#endif
connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
m_situareService, SLOT(credentialsReady(FacebookCredentials)));
#include "situareservice/situareservice.h"
#include "ui/mainwindow.h"
-class GPSPosition;
+class GPSPositionInterface;
/**
* @brief Engine class for Situare Application
******************************************************************************/
private:
FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
- GPSPosition *m_gps; ///< Instance of the gps position
+ GPSPositionInterface *m_gps; ///< Instance of the gps position
MainWindow *m_ui; ///< Instance of the MainWindow UI
SituareService *m_situareService; ///< Instance of the situare server communication service
};
#include <QDebug>
#include "gpsposition.h"
+#include "gpspositioninterface.h"
GPSPosition::GPSPosition(QObject *parent)
- : QObject(parent),
+ : GPSPositionInterface(parent),
m_running(false),
m_updateInterval(DEFAULT_UPDATE_INTERVAL)
{
#include <QGeoPositionInfoSource>
#include <QPointF>
+#include "gpspositioninterface.h"
+
QTM_USE_NAMESPACE
/**
*
* @class GPSPosition engine.h "gps/gpsposition.h"
*/
-class GPSPosition : public QObject
+class GPSPosition : public GPSPositionInterface
{
Q_OBJECT
*/
void updateTimeout();
-/******************************************************************************
-* SIGNALS
-******************************************************************************/
-signals:
- /**
- * @brief Signal for position information.
- *
- * @param latLonCoordinate latitude and longitude values
- */
- void position(QPointF latLonCoordinate);
-
- /**
- * @brief Signal for timeout.
- */
- void timeout();
-
- /**
- * @brief Signal for error.
- *
- * @param message error message
- */
- void error(const QString &message);
-
private:
QGeoPositionInfoSource *m_gpsSource; ///< GPS position info source
bool m_running; ///< GPS is running
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include "gpspositioninterface.h"
+
+GPSPositionInterface::GPSPositionInterface(QObject *parent)
+ : QObject(parent)
+{
+}
+
+GPSPositionInterface::~GPSPositionInterface()
+{
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef GPSPOSITIONINTERFACE_H
+#define GPSPOSITIONINTERFACE_H
+
+#include <QObject>
+#include <QPointF>
+
+class GPSPositionInterface : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ GPSPositionInterface(QObject *parent = 0);
+
+ virtual ~GPSPositionInterface();
+
+ /**
+ * @brief Checks if GPS is running.
+ *
+ * @return true if GPS running, false otherwise
+ */
+ virtual bool isRunning() = 0;
+
+ /**
+ * @brief Set GPS update interval
+ *
+ * @return interval interval in milliseconds
+ */
+ virtual void setUpdateInterval(int interval) = 0;
+
+ /**
+ * @brief Start GPS.
+ */
+ virtual void start() = 0;
+
+ /**
+ * @brief Stop GPS.
+ */
+ virtual void stop() = 0;
+
+private slots:
+ /**
+ * @brief Slot for GPS update request.
+ */
+ virtual void update() = 0;
+
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
+ /**
+ * @brief Signal for position information.
+ *
+ * @param latLonCoordinate latitude and longitude values
+ */
+ void position(QPointF latLonCoordinate);
+
+ /**
+ * @brief Signal for timeout.
+ */
+ void timeout();
+
+ /**
+ * @brief Signal for error.
+ *
+ * @param message error message
+ */
+ void error(const QString &message);
+};
+
+#endif // GPSPOSITIONINTERFACE_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+
+#include "gpspositionmockup.h"
+
+GPSPositionMockup::GPSPositionMockup(QObject *parent)
+ : GPSPositionInterface(parent)
+{
+}
+
+GPSPositionMockup::~GPSPositionMockup()
+{
+}
+
+bool GPSPositionMockup::isRunning()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return false;
+}
+
+void GPSPositionMockup::setUpdateInterval(int interval)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(interval);
+}
+
+void GPSPositionMockup::start()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+void GPSPositionMockup::stop()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+void GPSPositionMockup::update()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef GPSPOSITIONMOCKUP_H
+#define GPSPOSITIONMOCKUP_H
+
+#include "gpspositioninterface.h"
+
+class GPSPositionMockup : public GPSPositionInterface
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor creates GPS source.
+ *
+ * @param parent QObject
+ */
+ GPSPositionMockup(QObject *parent = 0);
+
+ /**
+ * @brief Destructor stops GPS.
+ */
+ ~GPSPositionMockup();
+
+/******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+public:
+ /**
+ * @brief Checks if GPS is running.
+ *
+ * @return true if GPS running, false otherwise
+ */
+ bool isRunning();
+
+ /**
+ * @brief Set GPS update interval
+ *
+ * @return interval interval in milliseconds
+ */
+ void setUpdateInterval(int interval);
+
+ /**
+ * @brief Start GPS.
+ */
+ void start();
+
+ /**
+ * @brief Stop GPS.
+ */
+ void stop();
+
+private slots:
+ void update();
+};
+
+#endif // GPSPOSITIONMOCKUP_H
#include "mapengine.h"
#include "maptile.h"
-#include "gps/gpsposition.h"
-
MapEngine::MapEngine(QObject *parent)
: QObject(parent)
, m_centerTile(QPoint(UNDEFINED, UNDEFINED))
ui/panelsliderbar.cpp \
map/friendgroupitem.cpp \
map/frienditemshandler.cpp \
- gps/gpsposition.cpp
+ gps/gpspositioninterface.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
map/mapengine.h \
ui/panelsliderbar.h \
map/friendgroupitem.h \
map/frienditemshandler.h \
- gps/gpsposition.h
+ gps/gpspositioninterface.h
QT += network \
webkit
-CONFIG += mobility
-
-MOBILITY = location
-
DEFINES += QT_NO_DEBUG_OUTPUT
!maemo5 {
+ SOURCES += gps/gpspositionmockup.cpp
+ HEADERS += gps/gpspositionmockup.h
message(QJson built in)
message(Make sure you have QJson development headers installed)
message(install headers with: sudo apt-get install libqjson-dev)
+
}
maemo5 {
+ SOURCES += gps/gpsposition.cpp
+ HEADERS += gps/gpsposition.h
QT += maemo5
+ CONFIG += mobility
+ MOBILITY = location
message(QJson built in)
message(Make sure you have QJson development headers installed)
message(add: deb http://repository.maemo.org/extras-devel fremantle free non-free)
message(to scratchbox's sources.list in /etc/apt)
message(run: apt-get update)
message(install headers with: apt-get install libqjson-dev)
+ message(QtMobility)
+ message(Make sure you have QtMobility development headers installed)
+ message(install headers with: apt-get install libqtm-dev)
}
# -----------------------------------------------------------------
qDebug() << __PRETTY_FUNCTION__;
#ifdef Q_WS_MAEMO_5
- QMaemo5InformationBox::information(this, message,
- QMaemo5InformationBox::DefaultTimeout);
-#endif // Q_WS_MAEMO_5
+ QMaemo5InformationBox::information(this, message, QMaemo5InformationBox::DefaultTimeout);
+#else
+ Q_UNUSED(message);
+#endif
}