#include "map/mapengine.h"
#include "situareservice/situareservice.h"
#include "ui/mainwindow.h"
+#include "mce.h"
#include <cmath>
#include "engine.h"
+
const QString SETTINGS_GPS_ENABLED = "GPS_ENABLED"; ///< GPS setting
const QString SETTINGS_AUTO_CENTERING_ENABLED = "AUTO_CENTERING_ENABLED";///< Auto centering setting
const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
m_autoCenteringEnabled(false),
m_automaticUpdateFirstStart(true),
m_userMoved(false),
+ m_automaticUpdateScreenOff(false),
m_automaticUpdateIntervalTimer(0),
m_lastUpdatedGPSPosition(QPointF())
{
m_gps->setMode(GPSPosition::Default);
initializeGpsAndAutocentering();
+
+ m_mce = new MCE(this);
+ connect(m_mce, SIGNAL(displayOn(bool)), this, SLOT(displayOn(bool)));
}
SituareEngine::~SituareEngine()
requestUpdateLocation();
m_userMoved = false;
}
+
+ if (!m_mce->isDisplayOn())
+ m_gps->requestUpdate();
}
void SituareEngine::changeAutoCenteringSetting(bool enabled)
m_ui->buildInformationBox(tr("Auto centering disabled"));
}
+void SituareEngine::displayOn(bool on)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_displayOn = on;
+
+ if (m_autoCenteringEnabled)
+ enableAutoCentering(on);
+}
+
void SituareEngine::enableAutoCentering(bool enabled)
{
qDebug() << __PRETTY_FUNCTION__;
m_lastUpdatedGPSPosition = position;
m_userMoved = true;
}
+
+ if (m_automaticUpdateGPSRequest) {
+ m_
+ }
}
void SituareEngine::setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy)
class MapEngine;
class SituareService;
class User;
+class MCE;
class QTimer;
void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs = 0);
/**
+ * @brief Slot for display on.
+ *
+ * @param on true if on, false otherwise
+ */
+ void displayOn(bool on);
+
+ /**
* @brief Sets zoom level to default when first GPS location is received if autocentering
* is enabled.
*
private:
bool m_autoCenteringEnabled; ///< Auto centering flag
bool m_automaticUpdateFirstStart; ///< Automatic location update first start flag
+ bool m_automaticUpdateScreenOff; ///< Flag for automatic location update when screen is off
+ bool m_screenOn; ///< Flag for device screen on
bool m_userMoved; ///< Flag for user moving
+
FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
GPSPosition *m_gps; ///< Instance of the gps position
MainWindow *m_ui; ///< Instance of the MainWindow UI
MapEngine *m_mapEngine; ///< MapEngine
SituareService *m_situareService; ///< Instance of the situare server communication service
+ MCE *m_mce; ///< Instance of the MCE
QTimer *m_automaticUpdateIntervalTimer; ///< Automatic update interval timer
QPointF m_lastUpdatedGPSPosition; ///< Last updated GPS position
--- /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 "mce.h"
+
+#if defined(Q_WS_MAEMO_5) & defined(ARMEL)
+#include "mceprivate.h"
+#else
+#include "mceprivatestub.h"
+#endif
+
+MCE::MCE(QObject *parent)
+ : QObject(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_mcePrivate = new MCEPrivate(this);
+}
+
+bool MCE::isDisplayOn()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_mcePrivate->isDisplayOn();
+}
--- /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 MCE_H
+#define MCE_H
+
+#include <QObject>
+
+class MCEPrivate;
+
+class MCE : public QObject
+{
+ Q_OBJECT
+
+public:
+ friend class MCEPrivate;
+
+ MCE(QObject *parent = 0);
+
+public:
+ bool isDisplayOn();
+
+signals:
+ void displayOn(bool on);
+
+private:
+ MCEPrivate *m_mcePrivate;
+};
+
+#endif // MCE_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 <QString>
+#include <QDebug>
+
+#include <mce/dbus-names.h>
+#include <mce/mode-names.h>
+
+#include "mce.h"
+#include "mceprivate.h"
+
+const int DISPLAY_STATE_INDEX = 0;
+
+static QDBusConnection dBusConnection = QDBusConnection::systemBus();
+
+MCEPrivate::MCEPrivate(QObject *parent)
+ : QObject(parent),
+ m_displayOn(true)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_parent = static_cast<MCE*>(parent);
+
+ m_dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
+ MCE_REQUEST_IF, dBusConnection, this);
+
+ dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
+ MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &)));
+
+ m_dBusInterface->call(MCE_DISPLAY_STATUS_GET);
+}
+
+bool MCEPrivate::isDisplayOn()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_displayOn;
+}
+
+void MCEPrivate::displayStateChanged(const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QString content = message.arguments().at(DISPLAY_STATE_INDEX).toString();
+
+ if (!content.isEmpty()) {
+ if (content == MCE_DISPLAY_ON_STRING)
+ emit m_parent->displayOn(true);
+ else if (content == MCE_DISPLAY_OFF_STRING)
+ emit m_parent->displayOn(false);
+ }
+}
--- /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 MCEPRIVATE_H
+#define MCEPRIVATE_H
+
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+
+class MCE;
+
+class MCEPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ MCEPrivate(QObject *parent);
+
+public:
+ bool isDisplayOn();
+
+private slots:
+ void displayStateChanged(const QDBusMessage &message);
+
+private:
+ QDBusInterface *m_dBusInterface; ///< D-Bus interface
+ MCE *m_parent; ///< Parent object
+ bool m_displayOn; ///< Flag for display on/off
+};
+
+#endif // MCEPRIVATE_H
ui/zoombutton.cpp \
ui/zoombuttonpanel.cpp \
user/user.cpp \
- ui/fullscreenbutton.cpp
+ ui/fullscreenbutton.cpp \
+ mce.cpp
HEADERS += common.h \
engine/engine.h \
facebookservice/facebookauthentication.h \
ui/zoombutton.h \
ui/zoombuttonpanel.h \
user/user.h \
- ui/fullscreenbutton.h
+ ui/fullscreenbutton.h \
+ mce.h
QT += network \
webkit
-DEFINES += QT_NO_DEBUG_OUTPUT
+
+#DEFINES += QT_NO_DEBUG_OUTPUT
simulator {
SOURCES += network/networkhandlerprivatestub.cpp \
armel {
DEFINES += ARMEL
INCLUDEPATH += /usr/include/glib-2.0 /usr/lib/glib-2.0/include
- SOURCES += network/networkhandlerprivate.cpp
- HEADERS += network/networkhandlerprivate.h
+ SOURCES += network/networkhandlerprivate.cpp \
+ mceprivate.cpp
+ HEADERS += network/networkhandlerprivate.h \
+ mceprivate.h
QT += dbus
CONFIG += icd2 qdbus
SOURCES += gps/gpspositionprivateliblocation.cpp \
gps/geopositioninfo.h \
gps/geocoordinate.h
CONFIG += link_pkgconfig
- PKGCONFIG += glib-2.0 liblocation
+ PKGCONFIG += glib-2.0 liblocation mce
LIBS += -llocation
} else {
SOURCES += gps/gpspositionprivatestub.cpp \
- network/networkhandlerprivatestub.cpp
+ network/networkhandlerprivatestub.cpp \
+ mceprivatestub.cpp
HEADERS += gps/gpspositionprivatestub.h \
- network/networkhandlerprivatestub.h
+ network/networkhandlerprivatestub.h \
+ mceprivatestub.h
}
QT += maemo5