2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef SITUARESERVICE_H
24 #define SITUARESERVICE_H
28 #include <QNetworkAccessManager>
29 #include <QNetworkRequest>
30 #include <QNetworkReply>
32 #include "../facebookservice/facebookauthentication.h"
33 #include "../facebookservice/facebookcredentials.h"
36 * @brief SituareService class for communicating with Situare server
38 * @author Henri Lampela
39 * @class SituareService situareservice.h "situareservice/situareservice.h"
41 class SituareService : public QObject
48 * @brief Default constructor
50 * @param parent instance of parent
51 * @param manager instance of QNetworkAccessManager
53 SituareService(QObject *parent = 0, QNetworkAccessManager *manager = 0);
62 * @brief Updates location to the Situare server
64 * @param coordinates current cordinates
65 * @param status message
66 * @param publish publish location on Facebook wall (true/false)
68 void updateLocation(const QPointF &coordinates, const QString &status, const bool &publish);
71 * @brief Translates coordinates to street address via Situare server
73 * @param coordinates coordinates to be translated
75 void reverseGeo(const QPointF &coordinates);
80 * @brief Public slot, which indicates when http request has been completed
82 * @param reply storage for http reply
84 void requestFinished(QNetworkReply *reply);
88 * @brief Public slot, which indicates when facebook credentials are ready
91 void credentialsReady();
96 * @brief Forms a http url
98 * @param baseUrl Server url
99 * @param phpScript Server script
100 * @param urlParameters optional parameters for url
101 * @return QUrl formed url
103 QUrl formUrl(const QString &baseUrl, const QString &phpScript, QString urlParameters = 0);
106 * @brief Forms url parameters
108 * @param coordinates current coordinates
109 * @param status optional status message
110 * @param publish optional publish location on Facebook wall (true/false)
113 QString formUrlParameters(const QPointF &coordinates, QString status = 0, QString publish = 0);
116 * @brief Sends http request
118 * @param url destination
119 * @param cookieType type of the cookie
120 * @param cookie http cookie
122 void sendRequest(const QUrl &url, const QString &cookieType, const QString &cookie);
127 * @brief Signals error
129 * @param error error message
131 void error(const QString &error);
135 FacebookCredentials m_credentials; ///< handle for FacebookCredentials
136 QList<QNetworkReply *> m_currentRequests; ///< List of current http requests
137 FacebookAuthentication m_facebookAuthentication; ///< Pointer to FacebookAuthentication
138 QNetworkAccessManager *m_networkManager; ///< Pointer to QNetworkAccessManager
141 #endif // SITUARESERVICE_H