SituareService class for communicating with Situare server. More...
#include "situareservice/situareservice.h"
Public Slots | |
void | clearUserData () |
Public slot, to clear user data. | |
void | credentialsReady (const FacebookCredentials &credentials) |
Public slot, which indicates when facebook credentials are ready. | |
void | requestFinished (QNetworkReply *reply) |
Public slot, which indicates when http request has been completed. | |
Signals | |
void | error (const QString &error) |
Signals error. | |
void | fetchImage (const QUrl &url) |
Signal for image fetching. | |
void | reverseGeoReady (const QString &address) |
Signals when address data is retrieved. | |
void | updateWasSuccessful () |
Signals when updateLocation request finished successfully. | |
void | userDataChanged (User *user, QList< User * > &friendList) |
Signals when user data is retrieved. | |
Public Member Functions | |
SituareService (QObject *parent=0) | |
Default constructor. | |
~SituareService () | |
Destructor. | |
void | fetchLocations () |
Retrieves location user and friends information from Situare server. | |
void | reverseGeo (const QPointF &coordinates) |
Translates coordinates to street address via Situare server. | |
void | updateLocation (const QPointF &coordinates, const QString &status, const bool &publish) |
Updates location to the Situare server. | |
Private Slots | |
void | imageReceived (const QUrl &url, const QPixmap &image) |
Slot for received images. | |
Private Member Functions | |
void | addProfileImages () |
Requests ImageFetcher if user/friend has a profile image uses members: m_user and m_friendsList. | |
QString | formCookie (const QString &apiKeyValue, QString expiresValue, QString userValue, QString sessionKeyValue, QString sessionSecretValue, const QString &signatureValue, const QString &localeValue) |
Forms a http cookie. | |
QUrl | formUrl (const QString &baseUrl, const QString &phpScript, QString urlParameters=QString()) |
Forms a http url. | |
QString | formUrlParameters (const QPointF &coordinates, QString status=QString(), QString publish=QString()) |
Forms url parameters. | |
void | parseUserData (const QByteArray &jsonReply) |
Parses user and friend data from JSON string. | |
void | sendRequest (const QUrl &url, const QString &cookieType, const QString &cookie) |
Sends http request. | |
Private Attributes | |
int | m_nbrOfImages |
Indicates number of friends whose images has been downloaded. | |
int | m_visited |
Indicates number of friends with images. | |
bool | m_defaultImage |
Indicates if some of the friends/user doesn't have a image. | |
QList< QNetworkReply * > | m_currentRequests |
List of current http requests. | |
QList< User * > | m_friendsList |
List of friends(User). | |
NetworkAccessManager * | m_networkManager |
Pointer to QNetworkAccessManager. | |
FacebookCredentials | m_credentials |
handle for FacebookCredentials | |
ImageFetcher * | m_imageFetcher |
Instance of the image fetcher. | |
User * | m_user |
Pointer to User. |
SituareService class for communicating with Situare server.
SituareService::SituareService | ( | QObject * | parent = 0 |
) |
Default constructor.
parent | instance of parent |
void SituareService::credentialsReady | ( | const FacebookCredentials & | credentials | ) | [slot] |
Public slot, which indicates when facebook credentials are ready.
credentials | New credentials |
void SituareService::error | ( | const QString & | error | ) | [signal] |
Signals error.
error | error message |
void SituareService::fetchImage | ( | const QUrl & | url | ) | [signal] |
Signal for image fetching.
url | Image url |
QString SituareService::formCookie | ( | const QString & | apiKeyValue, | |
QString | expiresValue, | |||
QString | userValue, | |||
QString | sessionKeyValue, | |||
QString | sessionSecretValue, | |||
const QString & | signatureValue, | |||
const QString & | localeValue | |||
) | [private] |
Forms a http cookie.
apiKeyValue | application key | |
expiresValue | session expire date&time from Facebook | |
userValue | user id from Facebook | |
sessionKeyValue | session key from Facebook | |
sessionSecretValue | session secret from Facebook | |
signatureValue | md5 generated signature | |
localeValue | used locale |
QUrl SituareService::formUrl | ( | const QString & | baseUrl, | |
const QString & | phpScript, | |||
QString | urlParameters = QString() | |||
) | [private] |
Forms a http url.
baseUrl | Server url | |
phpScript | Server script | |
urlParameters | optional parameters for url |
QString SituareService::formUrlParameters | ( | const QPointF & | coordinates, | |
QString | status = QString() , |
|||
QString | publish = QString() | |||
) | [private] |
Forms url parameters.
coordinates | current coordinates | |
status | optional status message | |
publish | optional publish location on Facebook wall (true/false) |
void SituareService::imageReceived | ( | const QUrl & | url, | |
const QPixmap & | image | |||
) | [private, slot] |
Slot for received images.
url | Image url | |
image | Received image |
void SituareService::parseUserData | ( | const QByteArray & | jsonReply | ) | [private] |
Parses user and friend data from JSON string.
jsonReply | JSON string |
void SituareService::requestFinished | ( | QNetworkReply * | reply | ) | [slot] |
Public slot, which indicates when http request has been completed.
reply | storage for http reply |
void SituareService::reverseGeo | ( | const QPointF & | coordinates | ) |
Translates coordinates to street address via Situare server.
coordinates | coordinates to be translated |
void SituareService::reverseGeoReady | ( | const QString & | address | ) | [signal] |
Signals when address data is retrieved.
address | Street address |
void SituareService::sendRequest | ( | const QUrl & | url, | |
const QString & | cookieType, | |||
const QString & | cookie | |||
) | [private] |
Sends http request.
url | destination | |
cookieType | type of the cookie | |
cookie | http cookie |
void SituareService::updateLocation | ( | const QPointF & | coordinates, | |
const QString & | status, | |||
const bool & | publish | |||
) |
Updates location to the Situare server.
coordinates | current cordinates | |
status | message | |
publish | publish location on Facebook wall (true/false) |
Signals when user data is retrieved.
user | instance of user | |
friendList | list of friends |