USA.
*/
+ #include <cmath>
+
#include <QMessageBox>
#include <QNetworkReply>
+ #ifdef Q_WS_MAEMO_5
+ #include "application.h"
+ #endif
+
#include "common.h"
#include "facebookservice/facebookauthentication.h"
#include "gps/gpsposition.h"
#include "map/mapengine.h"
+ #include "routing/routingservice.h"
+ #include "mce.h"
+ #include "network/networkaccessmanager.h"
#include "situareservice/situareservice.h"
#include "ui/mainwindow.h"
- #include "network/networkaccessmanager.h"
- #include "mce.h"
- #include <cmath>
#include "engine.h"
const qreal USER_MOVEMENT_MINIMUM_LATITUDE_DIFFERENCE = 0.001;///< Min value for user move longitude
const int MIN_UPDATE_INTERVAL_MSECS = 5*60*1000;
- SituareEngine::SituareEngine(QMainWindow *parent)
- : QObject(parent),
- // m_autoCenteringEnabled(false),
+ SituareEngine::SituareEngine()
+ : m_autoCenteringEnabled(false),
m_automaticUpdateFirstStart(true),
m_automaticUpdateRequest(false),
m_userMoved(false),
m_automaticUpdateIntervalTimer(0),
- m_lastUpdatedGPSPosition(QPointF())
+ m_lastUpdatedGPSPosition(GeoCoordinate())
{
qDebug() << __PRETTY_FUNCTION__;
+
m_ui = new MainWindow;
m_ui->updateItemVisibility();
- m_networkAccessManager = NetworkAccessManager::instance();
+ #ifdef Q_WS_MAEMO_5
+ m_app = static_cast<Application *>(qApp);
+ m_app->registerWindow(m_ui->winId());
+
+ connect(m_app, SIGNAL(topmostChanged(bool)),
+ this, SLOT(enablePowerSave(bool)));
+ #endif
+
+ m_networkAccessManager = new NetworkAccessManager(this);
// build MapEngine
m_mapEngine = new MapEngine(this);
// build FacebookAuthenticator
m_facebookAuthenticator = new FacebookAuthentication(this);
+ // build routing service
+ m_routingService = new RoutingService(this); // create this when needed, not in constructor!
+ connect(m_routingService, SIGNAL(routeParsed(Route&)),
+ m_mapEngine, SLOT(setRoute(Route&)));
+
// connect signals
signalsFromMapEngine();
signalsFromGPS();
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
+ connect(this, SIGNAL(friendImageReady(User*)),
+ m_ui, SIGNAL(friendImageReady(User*)));
+
+ connect(this, SIGNAL(friendImageReady(User*)),
+ m_mapEngine, SIGNAL(friendImageReady(User*)));
+
m_automaticUpdateIntervalTimer = new QTimer(this);
connect(m_automaticUpdateIntervalTimer, SIGNAL(timeout()),
this, SLOT(startAutomaticUpdate()));
initializeGpsAndAutocentering();
m_mce = new MCE(this);
- connect(m_mce, SIGNAL(displayStateChanged(bool)), this, SLOT(displayStateChanged(bool)));
+ connect(m_mce, SIGNAL(displayOff(bool)), this, SLOT(enablePowerSave(bool)));
+
+ /// @todo for testing, remove after real route start and end points are available
+ //m_routingService->requestRoute(QPointF(65.010193,25.509859), QPointF(65.015152, 25.46645));
}
SituareEngine::~SituareEngine()
QSettings settings(DIRECTORY_NAME, FILE_NAME);
settings.setValue(SETTINGS_GPS_ENABLED, m_gps->isRunning());
- settings.setValue(SETTINGS_AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
+// settings.setValue(SETTINGS_AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
}
-void SituareEngine::changeAutoCenteringSetting(bool enabled)
-{
- qDebug() << __PRETTY_FUNCTION__;
+//void SituareEngine::changeAutoCenteringSetting(bool enabled)
+//{
+// qDebug() << __PRETTY_FUNCTION__;
- m_autoCenteringEnabled = enabled;
- enableAutoCentering(enabled);
-}
+// m_autoCenteringEnabled = enabled;
+// enableAutoCentering(enabled);
+//}
-void SituareEngine::disableAutoCentering()
-{
- qDebug() << __PRETTY_FUNCTION__;
+//void SituareEngine::disableAutoCentering()
+//{
+// qDebug() << __PRETTY_FUNCTION__;
- changeAutoCenteringSetting(false);
- m_ui->buildInformationBox(tr("Auto centering disabled"));
-}
+// changeAutoCenteringSetting(false);
+// m_ui->buildInformationBox(tr("Auto centering disabled"));
+//}
- void SituareEngine::displayStateChanged(bool enabled)
- {
- qDebug() << __PRETTY_FUNCTION__;
-
- m_gps->enablePowerSave(!enabled);
-
- // if (m_autoCenteringEnabled)
- // enableAutoCentering(enabled);
- }
-
-void SituareEngine::enableAutoCentering(bool enabled)
-{
- qDebug() << __PRETTY_FUNCTION__;
+//void SituareEngine::enableAutoCentering(bool enabled)
+//{
+// qDebug() << __PRETTY_FUNCTION__;
- m_ui->setAutoCenteringButtonEnabled(enabled);
- m_mapEngine->setAutoCentering(enabled);
+// m_ui->setAutoCenteringButtonEnabled(enabled);
+// m_mapEngine->setAutoCentering(enabled);
- if (enabled)
- m_gps->requestLastPosition();
-}
+// if (enabled)
+// m_gps->requestLastPosition();
+//}
void SituareEngine::enableGPS(bool enabled)
{
if (enabled && !m_gps->isRunning()) {
m_gps->start();
- enableAutoCentering(m_autoCenteringEnabled);
+// enableAutoCentering(m_autoCenteringEnabled);
m_gps->requestLastPosition();
if(m_ui->loginState())
}
else if (!enabled && m_gps->isRunning()) {
m_gps->stop();
- enableAutoCentering(false);
+// enableAutoCentering(false);
enableAutomaticLocationUpdate(false);
}
}
else
m_automaticUpdateIntervalTimer->setInterval(updateIntervalMsecs);
- connect(m_gps, SIGNAL(position(QPointF,qreal)),
- this, SLOT(requestAutomaticUpdateIfMoved(QPointF)));
+ connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
+ this, SLOT(requestAutomaticUpdateIfMoved(GeoCoordinate)));
m_automaticUpdateIntervalTimer->start();
} else {
- disconnect(m_gps, SIGNAL(position(QPointF,qreal)),
- this, SLOT(requestAutomaticUpdateIfMoved(QPointF)));
+ disconnect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
+ this, SLOT(requestAutomaticUpdateIfMoved(GeoCoordinate)));
m_automaticUpdateIntervalTimer->stop();
}
}
}
+ void SituareEngine::enablePowerSave(bool enabled)
+ {
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_gps->enablePowerSave(enabled);
+
+ if(m_autoCenteringEnabled)
+ m_mapEngine->setAutoCentering(!enabled);
+ }
+
void SituareEngine::error(const int context, const int error)
{
qDebug() << __PRETTY_FUNCTION__;
m_ui->setUsername(m_facebookAuthenticator->loadUsername());
}
+ void SituareEngine::imageReady(User *user)
+ {
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(user->type())
+ emit userLocationReady(user);
+ else
+ emit friendImageReady(user);
+ }
+
void SituareEngine::initializeGpsAndAutocentering()
{
qDebug() << __PRETTY_FUNCTION__;
QSettings settings(DIRECTORY_NAME, FILE_NAME);
QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
- QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
+// QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
if (m_gps->isInitialized()) {
if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
- connect(m_gps, SIGNAL(position(QPointF,qreal)),
- this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+ connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
+ this, SLOT(setFirstStartZoomLevel()));
- changeAutoCenteringSetting(true);
+// changeAutoCenteringSetting(true);
enableGPS(true);
m_ui->buildInformationBox(tr("GPS enabled"));
m_ui->buildInformationBox(tr("Auto centering enabled"));
} else { // Normal start
- changeAutoCenteringSetting(autoCenteringEnabled.toBool());
+// changeAutoCenteringSetting(autoCenteringEnabled.toBool());
enableGPS(gpsEnabled.toBool());
if (gpsEnabled.toBool())
m_ui->buildInformationBox(tr("GPS enabled"));
- if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
+ if (gpsEnabled.toBool()) /*&& autoCenteringEnabled.toBool())*/
m_ui->buildInformationBox(tr("Auto centering enabled"));
}
} else {
}
}
- void SituareEngine::requestAutomaticUpdateIfMoved(QPointF position)
+ void SituareEngine::requestAutomaticUpdateIfMoved(GeoCoordinate position)
{
qDebug() << __PRETTY_FUNCTION__;
- if ((fabs(m_lastUpdatedGPSPosition.x() - position.x()) >
+ if ((fabs(m_lastUpdatedGPSPosition.longitude() - position.longitude()) >
USER_MOVEMENT_MINIMUM_LONGITUDE_DIFFERENCE) ||
- (fabs(m_lastUpdatedGPSPosition.y() - position.y()) >
+ (fabs(m_lastUpdatedGPSPosition.latitude() - position.latitude()) >
USER_MOVEMENT_MINIMUM_LATITUDE_DIFFERENCE)) {
m_lastUpdatedGPSPosition = position;
}
}
- void SituareEngine::setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy)
+ void SituareEngine::setFirstStartZoomLevel()
{
qDebug() << __PRETTY_FUNCTION__;
- Q_UNUSED(latLonCoordinate);
- Q_UNUSED(accuracy);
+ if (m_autoCenteringEnabled) // autocentering is disabled when map is scrolled
+ m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
- // if (m_autoCenteringEnabled) // autocentering is disabled when map is scrolled
- // m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
-
- disconnect(m_gps, SIGNAL(position(QPointF,qreal)),
- this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+ disconnect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
+ this, SLOT(setFirstStartZoomLevel()));
}
void SituareEngine::signalsFromFacebookAuthenticator()
{
qDebug() << __PRETTY_FUNCTION__;
- connect(m_gps, SIGNAL(position(QPointF,qreal)),
- m_mapEngine, SLOT(gpsPositionUpdate(QPointF,qreal)));
+ connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
+ m_mapEngine, SLOT(gpsPositionUpdate(GeoCoordinate, qreal)));
connect(m_gps, SIGNAL(timeout()),
m_ui, SLOT(gpsTimeout()));
m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
// signals from map view
- connect(m_ui, SIGNAL(mapViewScrolled(QPoint)),
- m_mapEngine, SLOT(setCenterPosition(QPoint)));
+ connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate)),
+ m_mapEngine, SLOT(setCenterPosition(SceneCoordinate)));
connect(m_ui, SIGNAL(mapViewResized(QSize)),
m_mapEngine, SLOT(viewResized(QSize)));
m_mapEngine, SLOT(zoomOut()));
// signals from menu buttons
- connect(m_ui, SIGNAL(autoCenteringTriggered(bool)),
- this, SLOT(changeAutoCenteringSetting(bool)));
+// connect(m_ui, SIGNAL(autoCenteringTriggered(bool)),
+// this, SLOT(changeAutoCenteringSetting(bool)));
connect(m_ui, SIGNAL(gpsTriggered(bool)),
this, SLOT(enableGPS(bool)));
connect(m_ui, SIGNAL(refreshUserData()),
this, SLOT(refreshUserData()));
- connect(m_ui, SIGNAL(findUser(QPointF)),
- m_mapEngine, SLOT(centerToCoordinates(QPointF)));
+ connect(m_ui, SIGNAL(findUser(GeoCoordinate)),
+ m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
// signals from friend list tab
- connect(m_ui, SIGNAL(findFriend(QPointF)),
- m_mapEngine, SLOT(centerToCoordinates(QPointF)));
+ connect(m_ui, SIGNAL(findFriend(GeoCoordinate)),
+ m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
}
void SituareEngine::signalsFromMapEngine()
connect(m_mapEngine, SIGNAL(error(int, int)),
this, SLOT(error(int, int)));
- connect(m_mapEngine, SIGNAL(locationChanged(QPoint)),
- m_ui, SIGNAL(centerToSceneCoordinates(QPoint)));
+ connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate)),
+ m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate)));
connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
m_ui, SIGNAL(zoomLevelChanged(int)));
- connect(m_mapEngine, SIGNAL(mapScrolledManually()),
- this, SLOT(disableAutoCentering()));
+// connect(m_mapEngine, SIGNAL(mapScrolledManually()),
+// this, SLOT(disableAutoCentering()));
connect(m_mapEngine, SIGNAL(maxZoomLevelReached()),
m_ui, SIGNAL(maxZoomLevelReached()));
connect(m_situareService, SIGNAL(error(int, int)),
this, SLOT(error(int, int)));
+ connect(m_situareService, SIGNAL(imageReady(User*)),
+ this, SLOT(imageReady(User*)));
+
connect(m_situareService, SIGNAL(reverseGeoReady(QString)),
m_ui, SIGNAL(reverseGeoReady(QString)));
#include <QObject>
#include <QTime>
- #include <QPointF>
- class QMainWindow;
+ #include "coordinates/geocoordinate.h"
+ #ifdef Q_WS_MAEMO_5
+ class Application;
+ #endif
class FacebookAuthentication;
class FacebookCredentials;
class GPSPosition;
class MainWindow;
class MapEngine;
class NetworkAccessManager;
+ class RoutingService;
class SituareService;
class User;
class MCE;
/**
* @brief Constructor
*
- * @param parent
*/
- SituareEngine(QMainWindow *parent = 0);
+ SituareEngine();
/**
* @brief Destructor
*
* @param enabled true if enabled, false otherwise
*/
- void changeAutoCenteringSetting(bool enabled);
+// void changeAutoCenteringSetting(bool enabled);
/**
* @brief Slot for disabling automatic centering when map is scrolled manually
*/
- void disableAutoCentering();
+// void disableAutoCentering();
/**
- * @brief Slot for display state changed.
- *
- * @param enabled true if enabled, false otherwise
- */
- void displayStateChanged(bool enabled);
-
- /**
* @brief Slot for auto centering enabling.
*
* Calls gps to send last known position
*
* @param enabled true if auto centering was enabled, false otherwise
*/
- void enableAutoCentering(bool enabled);
+// void enableAutoCentering(bool enabled);
/**
* @brief Slot for gps enabling.
void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs = 0);
/**
+ * @brief Slot for enabling power saving.
+ *
+ * @param enabled true if enabled, false otherwise
+ */
+ void enablePowerSave(bool enabled);
+
+ /**
+ * @brief Slot to intercept signal when user's/friend's image is downloaded
+ *
+ * @param user Instance of user/friend
+ */
+ void imageReady(User *user);
+
+ /**
* @brief Requests automatic update.
*
* Makes automatic location update request if user has moved enough.
*
* @param position geo coordinates
*/
- void requestAutomaticUpdateIfMoved(QPointF position);
+ void requestAutomaticUpdateIfMoved(GeoCoordinate position);
/**
* @brief Sets zoom level to default when first GPS location is received if autocentering
* is enabled.
- *
- * @param latLonCoordinate own location
- * @param accuracy accuracy of GPS location
*/
- void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
+ void setFirstStartZoomLevel();
/**
* @brief Automatic update interval timer timeout.
void friendsLocationsReady(QList<User *> &friendList);
/**
+ * @brief Signals when friend's image is ready
+ *
+ * @param user Instance of friend
+ */
+ void friendImageReady(User *user);
+
+ /**
* @brief Signals when new user data is ready
*
* @param user Instance of User
* DATA MEMBERS
******************************************************************************/
private:
- bool m_autoCenteringEnabled; ///< Auto centering flag
+// bool m_autoCenteringEnabled; ///< Auto centering flag
bool m_automaticUpdateFirstStart; ///< Automatic location update first start flag
bool m_automaticUpdateRequest; ///< Flag for automatic update request
bool m_userMoved; ///< Flag for user move
-
+ #ifdef Q_WS_MAEMO_5
+ Application *m_app; ///< Pointer to Application
+ #endif
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
NetworkAccessManager *m_networkAccessManager; ///< NetworkAccessManager
+ RoutingService *m_routingService; ///< Instance of the routing service
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
+ GeoCoordinate m_lastUpdatedGPSPosition; ///< Last updated GPS position
+
};
#endif // ENGINE_H
../languages.qrc
TRANSLATIONS += ../res/languages/situare_fi.ts
SOURCES += main.cpp \
+ application.cpp \
engine/engine.cpp \
facebookservice/facebookauthentication.cpp \
facebookservice/facebookcredentials.cpp \
ui/avatarimage.cpp \
ui/friendlistitem.cpp \
ui/friendlistpanel.cpp \
- ui/friendlistview.cpp \
ui/imagebutton.cpp \
ui/logindialog.cpp \
ui/mainwindow.cpp \
user/user.cpp \
ui/fullscreenbutton.cpp \
engine/mce.cpp \
- ui/indicatorbutton.cpp
- HEADERS += common.h \
++ ui/indicatorbutton.cpp \
+ routing/routingservice.cpp \
+ routing/routesegment.cpp \
+ routing/route.cpp \
+ map/maprouteitem.cpp \
+ coordinates/scenecoordinate.cpp \
+ coordinates/geocoordinate.cpp \
+ ui/listview.cpp \
+ ui/listitem.cpp \
+ ui/listitemdelegate.cpp \
+ ui/friendlistitemdelegate.cpp
+ HEADERS += application.h \
+ common.h \
engine/engine.h \
facebookservice/facebookauthentication.h \
facebookservice/facebookcommon.h \
ui/avatarimage.h \
ui/friendlistitem.h \
ui/friendlistpanel.h \
- ui/friendlistview.h \
ui/imagebutton.h \
ui/logindialog.h \
ui/mainwindow.h \
user/user.h \
ui/fullscreenbutton.h \
engine/mce.h \
- ui/indicatorbutton.h
++ ui/indicatorbutton.h \
+ routing/routingservice.h \
+ routing/routingcommon.h \
+ routing/routesegment.h \
+ routing/route.h \
+ map/maprouteitem.h \
+ map/osm.h \
+ coordinates/scenecoordinate.h \
+ coordinates/geocoordinate.h \
+ ui/listview.h \
+ ui/listitem.h \
+ ui/listitemdelegate.h \
+ ui/friendlistitemdelegate.h \
+ ui/listcommon.h
QT += network \
webkit
CONFIG += icd2 qdbus
SOURCES += gps/gpspositionprivateliblocation.cpp \
gps/liblocationwrapper.cpp \
- gps/geopositioninfo.cpp \
- gps/geocoordinate.cpp
+ gps/geopositioninfo.cpp
HEADERS += gps/gpspositionprivateliblocation.h \
gps/liblocationwrapper.h \
- gps/geopositioninfo.h \
- gps/geocoordinate.h
+ gps/geopositioninfo.h
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 liblocation mce
LIBS += -llocation
#include "common.h"
#include "friendlistpanel.h"
#include "fullscreenbutton.h"
+#include "indicatorbutton.h"
#include "logindialog.h"
#include "mapscale.h"
#include "settingsdialog.h"
m_refresh(false),
m_progressIndicatorCount(0),
m_ownLocationCrosshair(0),
- m_email(),
+ m_email(),
m_password(),
m_fullScreenButton(0),
+ m_indicatorButton(0),
m_webView(0),
m_mapScale(0),
m_cookieJar(0)
m_osmLicense->stackUnder(m_zoomButtonPanel);
}
m_ownLocationCrosshair->stackUnder(m_osmLicense);
- m_mapScale->stackUnder(m_ownLocationCrosshair);
+ m_indicatorButton->stackUnder(m_ownLocationCrosshair);
+ m_mapScale->stackUnder(m_indicatorButton);
m_mapView->stackUnder(m_mapScale);
+
grabZoomKeys(true);
// Set default screen size
connect(m_mapView, SIGNAL(viewResized(QSize)),
m_friendsListPanelSidebar, SLOT(resizeSideBar(QSize)));
- connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
- this, SIGNAL(findFriend(QPointF)));
+ connect(m_friendsListPanel, SIGNAL(findFriend(GeoCoordinate)),
+ this, SIGNAL(findFriend(GeoCoordinate)));
+
+ connect(this, SIGNAL(friendImageReady(User*)),
+ m_friendsListPanel, SLOT(friendImageReady(User*)));
}
+void MainWindow::buildIndicatorButton()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_indicatorButton = new IndicatorButton(this);
+
+ connect(m_indicatorButton, SIGNAL(triggered(bool)),
+ this, SIGNAL(autoCenteringTriggered(bool)));
+
+}
+
void MainWindow::buildInformationBox(const QString &message, bool modal)
{
qDebug() << __PRETTY_FUNCTION__;
buildOsmLicense();
buildManualLocationCrosshair();
buildFullScreenButton();
+ buildIndicatorButton();
buildMapScale();
- connect(m_mapView, SIGNAL(viewScrolled(QPoint)),
- this, SIGNAL(mapViewScrolled(QPoint)));
+ connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate)),
+ this, SIGNAL(mapViewScrolled(SceneCoordinate)));
- connect(this, SIGNAL(centerToSceneCoordinates(QPoint)),
- m_mapView, SLOT(centerToSceneCoordinates(QPoint)));
+ connect(this, SIGNAL(centerToSceneCoordinates(SceneCoordinate)),
+ m_mapView, SLOT(centerToSceneCoordinates(SceneCoordinate)));
connect(m_mapView, SIGNAL(viewResized(QSize)),
this, SIGNAL(mapViewResized(QSize)));
connect(m_mapView, SIGNAL(viewResized(QSize)),
m_userPanelSidebar, SLOT(resizeSideBar(QSize)));
- connect(m_userPanel, SIGNAL(findUser(QPointF)),
- this, SIGNAL(findUser(QPointF)));
+ connect(m_userPanel, SIGNAL(findUser(GeoCoordinate)),
+ this, SIGNAL(findUser(GeoCoordinate)));
connect(m_userPanel, SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
this, SIGNAL(gpsTriggered(bool)));
// automatic centering
- m_autoCenteringAct = new QAction(tr("Auto centering"), this);
- m_autoCenteringAct->setCheckable(true);
- connect(m_autoCenteringAct, SIGNAL(triggered(bool)),
- this, SIGNAL(autoCenteringTriggered(bool)));
+// m_autoCenteringAct = new QAction(tr("Auto centering"), this);
+// m_autoCenteringAct->setCheckable(true);
+// connect(m_autoCenteringAct, SIGNAL(triggered(bool)),
+// this, SIGNAL(autoCenteringTriggered(bool)));
// build the actual menu
m_viewMenu = menuBar()->addMenu(tr("Main"));
m_viewMenu->addAction(m_loginAct);
m_viewMenu->addAction(m_toSettingsAct);
m_viewMenu->addAction(m_gpsToggleAct);
- m_viewMenu->addAction(m_autoCenteringAct);
+// m_viewMenu->addAction(m_autoCenteringAct);
m_viewMenu->setObjectName(tr("Menu"));
}
}
}
+void MainWindow::drawIndicatorButton(const QSize &size)
+{
+ qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
+
+ const int LEFT_SCALE_MARGIN = 10;
+ const int BOTTOM_SCALE_MARGIN = 80;
+
+ if(m_indicatorButton) {
+ if(m_loggedIn) {
+ m_indicatorButton->move(PANEL_PEEK_AMOUNT + LEFT_SCALE_MARGIN,
+ size.height() - m_mapScale->size().height() - BOTTOM_SCALE_MARGIN);
+
+ } else {
+ m_indicatorButton->move(PANEL_PEEK_AMOUNT + LEFT_SCALE_MARGIN,
+ size.height() - m_mapScale->size().height() - BOTTOM_SCALE_MARGIN);
+ }
+ }
+}
+
void MainWindow::drawMapScale(const QSize &size)
{
const int LEFT_SCALE_MARGIN = 10;
buildWebView();
loadCookies();
-
+
QStringList urlParts;
urlParts.append(FACEBOOK_LOGINBASE);
urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
settings.setValue(COOKIES, list);
}
-void MainWindow::setAutoCenteringButtonEnabled(bool enabled)
-{
- qDebug() << __PRETTY_FUNCTION__;
+//void MainWindow::setAutoCenteringButtonEnabled(bool enabled)
+//{
+// qDebug() << __PRETTY_FUNCTION__;
- m_autoCenteringAct->setChecked(enabled);
-}
+// m_autoCenteringAct->setChecked(enabled);
+//}
void MainWindow::setGPSButtonEnabled(bool enabled)
{
setOwnLocationCrosshairVisibility(!enabled);
- m_autoCenteringAct->setVisible(enabled);
+// m_autoCenteringAct->setVisible(enabled);
+}
+
+void MainWindow::setIndicatorButtonEnabled(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_indicatorButton->setChecked(enabled);
+
+ connect(m_autoCenteringAct, SIGNAL(triggered(bool)),
+ this, SIGNAL(autoCenteringTriggered(bool)));
}
void MainWindow::setMapViewScene(QGraphicsScene *scene)
qDebug() << __PRETTY_FUNCTION__;
drawFullScreenButton(m_viewPortSize);
+ drawIndicatorButton(m_viewPortSize);
if(m_loggedIn) {
if(!m_friendsListPanel->isVisible()) {
m_friendsListPanel->show();
m_friendsListPanelSidebar->show();
+ m_indicatorButton->show();
}
if(!m_userPanel->isVisible()) {
}
}
+//void MainWindow::showIndicatorButton(bool gps, bool autoCentering)
+//{
+// qDebug() << __PRETTY_FUNCTION__;
+
+//}
+
void MainWindow::startLoginProcess()
{
qDebug() << __PRETTY_FUNCTION__;
void MainWindow::updateItemVisibility()
{
qDebug() << __PRETTY_FUNCTION__;
-
- if(m_loggedIn) {
+
+ if(m_loggedIn) {
if(!m_gpsToggleAct->isChecked())
setOwnLocationCrosshairVisibility(true);
const QString MainWindow::username()
{
qDebug() << __PRETTY_FUNCTION__;
-
+
return m_email;
}
class QGraphicsScene;
class QLabel;
- class QWebView;
+ class QMessageBox;
class QNetworkReply;
+ class QToolButton;
+ class QWebView;
class FacebookAuthentication;
class FullScreenButton;
class FriendListPanel;
+class IndicatorButton;
+ class GeoCoordinate;
class MapScale;
class MapScene;
class MapView;
+ class SettingsDialog;
+ class SceneCoordinate;
class SituareService;
class User;
class UserInfoPanel;
class ZoomButtonPanel;
- class SettingsDialog;
- class QToolButton;
- class QMessageBox;
+
/**
* @brief Main Window Class
*
* @param enabled true if shoud be enabled, false otherwise
*/
- void setAutoCenteringButtonEnabled(bool enabled);
+// void setAutoCenteringButtonEnabled(bool enabled);
/**
* @brief Enable / disable GPS button.
void setGPSButtonEnabled(bool enabled);
/**
+ * @brief Enable / disable direction indicator button.
+ *
+ * @param enabled true if shoud be enabled, false otherwise
+ */
+ void setIndicatorButtonEnabled(bool enabled);
+
+ /**
* @brief Set scene for MapView
*
* @param scene Scene to be set
const QString username();
public slots:
+
+ /**
+ * @brief Build direction indicator button and connect slots
+ */
+ void buildIndicatorButton();
+
/**
* @brief Builds information box with message.
*
void drawFullScreenButton(const QSize &size);
/**
+ * @brief Slot for drawing the direction indicator button
+ *
+ * @param size Size of the screen
+ */
+ void drawIndicatorButton(const QSize &size);
+
+
+ /**
* @brief Slot for drawing the map distance scale
*
* @param size Size of the screen
*
* @param enabled True if automatic centering is enabled, otherwise false
*/
- void autoCenteringTriggered(bool enabled);
+// void autoCenteringTriggered(bool enabled);
/**
* @brief Signal that indicates when user has cancelled login process
/**
* @brief View should be centered to new location
*
- * @param sceneCoordinate Scene coordinates of the new center point
+ * @param coordinate Scene coordinates of the new center point
*/
- void centerToSceneCoordinates(QPoint sceneCoordinate);
+ void centerToSceneCoordinates(const SceneCoordinate &coordinate);
/**
* @brief Signal for enabling automatic location update.
*
* @param coordinates user geo coordinates
*/
- void findUser(const QPointF &coordinates);
+ void findUser(const GeoCoordinate &coordinates);
+
+ /**
+ * @brief Signals when friend's profile image is ready
+ *
+ * @param user Friend
+ */
+ void friendImageReady(User *user);
/**
* @brief GPS setting changed
*
* @param coordinates friend's geo coordinates
*/
- void findFriend(const QPointF &coordinates);
+ void findFriend(const GeoCoordinate &coordinates);
/**
* @brief Signal for friend location ready.
/**
* @brief Forwarding signal from MapView to MapEngine
*
- * @param sceneCoordinate
+ * @param coordinate
*/
- void mapViewScrolled(QPoint sceneCoordinate);
+ void mapViewScrolled(const SceneCoordinate &coordinate);
/**
* @brief Forwarding signal from MapEngine to MapView
QString m_password; ///< Placeholder for password
FullScreenButton *m_fullScreenButton; ///< Instance of the fullscreen toggle button
+ IndicatorButton * m_indicatorButton; ///< Instance of direction indicator button
QWebView *m_webView; ///< Shows facebook login page
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
*
* @param coordinates user geo coordinates
*/
- void findUser(const QPointF &coordinates);
+ void findUser(const GeoCoordinate &coordinates);
/**
* @brief Signal that used to inform user that his message/location update tp Situare server