2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Henri Lampela - henri.lampela@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #include "ui/mainwindow.h"
26 SituareEngine::SituareEngine(QMainWindow *parent)
29 m_ui = new MainWindow;
31 m_networkManager = new QNetworkAccessManager;
32 m_situareService = new SituareService(this, m_networkManager);
35 m_facebookAuthenticator = new FacebookAuthentication();
37 connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
38 m_situareService, SLOT(credentialsReady(FacebookCredentials)));
39 connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
40 this, SLOT(loginOk()));
42 connect(m_ui, SIGNAL(requestReverseGeo()), this, SLOT(requestAddress()));
43 connect(m_situareService, SIGNAL(reverseGeoReady(QString)), m_ui, SIGNAL(reverseGeoReady(QString)));
44 connect(m_ui, SIGNAL(statusUpdate(QString,bool)), this, SLOT(requestUpdateLocation(QString,bool)));
45 connect(m_situareService, SIGNAL(error(QString)), this, SLOT(error(QString)));
47 connect(m_situareService, SIGNAL(userDataChanged(User*,QList<User*>&)), m_ui,
48 SIGNAL(userDataChanged(User*,QList<User*>&)));
50 connect(m_ui, SIGNAL(refreshUserData()), this, SLOT(refreshUserData()));
55 SituareEngine::~SituareEngine()
57 qDebug() << __PRETTY_FUNCTION__;
59 delete m_facebookAuthenticator;
62 void SituareEngine::error(const QString &error)
64 qDebug() << __PRETTY_FUNCTION__;
69 void SituareEngine::start()
71 qDebug() << __PRETTY_FUNCTION__;
73 m_facebookAuthenticator->start();
76 void SituareEngine::loginOk()
78 qDebug() << __PRETTY_FUNCTION__;
81 m_facebookAuthenticator->hide();
83 m_situareService->fetchLocations(); // request user locations
86 void SituareEngine::requestAddress()
88 qDebug() << __PRETTY_FUNCTION__;
90 QPointF coordinates(65, 25.5); // this will be get from somewhere, map etc...
91 m_situareService->reverseGeo(coordinates);
94 void SituareEngine::requestUpdateLocation(const QString &status, const bool &publish)
96 qDebug() << __PRETTY_FUNCTION__;
98 QPointF coordinates(65, 25.5); // this will be get from somewhere, map etc...
99 m_situareService->updateLocation(coordinates, status, publish);
102 void SituareEngine::refreshUserData()
104 qDebug() << __PRETTY_FUNCTION__;
106 m_situareService->fetchLocations();