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>
33 #include "../facebookservice/facebookauthentication.h" // not final
34 #include "../facebookservice/facebookcredentials.h" // not final
37 * @brief SituareService class for communicating with Situare server
39 * @author Henri Lampela
40 * @class SituareService situareservice.h "situareservice/situareservice.h"
42 class SituareService : public QObject
49 * @brief Default constructor
51 * @param parent instance of parent
52 * @param manager instance of QNetworkAccessManager
54 SituareService(QObject *parent = 0, QNetworkAccessManager *manager = 0);
63 * @brief Updates location to the Situare server
65 * @param coordinates current cordinates
66 * @param status message
67 * @param publish publish location on Facebook wall (true/false)
69 void updateLocation(QPointF coordinates, QString status, bool publish);
72 * @brief Translates coordinates to street address via Situare server
74 * @param coordinates coordinates to be translated
76 void reverseGeo(QPointF coordinates);
81 * @brief Forms a http url
83 * @param baseUrl Server url
84 * @param phpScript Server script
85 * @param urlParameters optional parameters for url
86 * @return QUrl formed url
88 QUrl formUrl(const QString baseUrl, const QString phpScript, QString urlParameters = 0);
91 * @brief Forms url parameters
93 * @param coordinates current coordinates
94 * @param status optional status message
95 * @param publish optional publish location on Facebook wall (true/false)
98 QString formUrlParameters(QPointF coordinates, QString status = 0, QString publish = 0);
101 * @brief Sends http request
103 * @param url destination
104 * @param cookieType type of the cookie
105 * @param cookie http cookie
107 void sendRequest(QUrl url, const QString cookieType, QString cookie);
112 * @brief Signals error
114 * @param error error message
116 void error(const QString &error);
121 * @brief Public slot, which indicates when http request has been completed
123 * @param reply storage for http reply
125 void requestFinished(QNetworkReply *reply);
129 * @brief Public slot, which indicates when facebook credentials are ready
132 void credentialsReady();
136 FacebookCredentials credentials; ///< FacebookCredentials
137 QList<QNetworkReply *> currentRequests; ///< List of current http requests
138 FacebookAuthentication facebookAuthentication; ///< Pointer to FacebookAuthentication
139 QNetworkAccessManager *networkManager; ///< Pointer to QNetworkAccessManager
142 #endif // SITUARESERVICE_H