Copyright (C) 2010 Ixonos Plc. Authors:
Henri Lampela - henri.lampela@ixonos.com
+ Jussi Laitinen - jussi.laitinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
public:
/**
+ * Unit test class
+ */
+ friend class TestSituareService;
+
+ /**
* @brief Default constructor
*
* @param parent instance of parent
*/
- SituareService(QObject *parent = 0);
+ SituareService(NetworkAccessManager *networkManager, ImageFetcher *imageFetcher,
+ QObject *parent = 0);
/**
* @brief Destructor
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
-
/**
* @brief Retrieves people with similart interest (same tags).
*
void fetchLocations();
/**
- * @brief Retrieves messages sent to user.
- */
- void fetchMessages();
-
- /**
* @brief Translates coordinates to street address via Situare server
*
* @param coordinates coordinates to be translated
void updateTags(const QString &userId, const QStringList &tags);
public slots:
+ /**
+ * @brief Retrieves messages sent to user.
+ */
+ void fetchMessages();
/**
* @brief Public slot, to clear user data
*/
void requestFinished(QNetworkReply *reply);
-private:
+ /**
+ * @brief Sends a message to a person.
+ *
+ * @param receiverId Facebook user ID
+ * @param message message text
+ */
+ void sendMessage(const QString &receiverId, const QString &message);
+private:
/**
* @brief Requests ImageFetcher if user/friend has a profile image
* uses members: m_user and m_friendsList
*
* @param imageUrlList list of image urls
*/
- void addProfileImages(const QList<QUrl> &imageUrlList);
+ void addProfileImages(const QHash<QString, QUrl> &imageUrlList);
/**
* @brief Forms a http cookie
QStringList getTags(const QString &userId);
/**
+ * @brief Parses interesting people data from JSON string
+ *
+ * @param jsonReply JSON string
+ */
+ void parseInterestingPeopleData(const QByteArray &jsonReply);
+
+ /**
+ * @brief Parses messages data from JSON string
+ *
+ * @param jsonReply JSON string
+ */
+ void parseMessagesData(const QByteArray &jsonReply);
+
+
+ /**
* @brief Parses user and friend data from JSON string
*
* @param jsonReply JSON string
/**
* @brief Slot for received images
*
- * @param url Image url
- * @param image Received image
+ * @param id image ID
+ * @param image image pixmap
*/
- void imageReceived(const QUrl &url, const QPixmap &image);
+ void imageReceived(const QString &id, const QPixmap &image);
/*******************************************************************************
* SIGNALS
/**
* @brief Signal for image fetching
*
+ * @param id Image id
* @param url Image url
*/
- void fetchImage(const QUrl &url);
+ void fetchImage(const QString &id, const QUrl &url);
/**
* @brief Signals when user's/friend's image is downloaded
void imageReady(User *user);
/**
+ * @brief Signals when image is downloaded
+ *
+ * @param id image ID
+ * @param image image pixmap
+ */
+ void imageReady(const QString &id, const QPixmap &image);
+
+ /**
* @brief Signal when fetchPeopleWithSimilarInterest request is finished
*
* @param interestingPeople list of interesting people
*/
- void interestingPeopleReceived(QList<User *> &interestingPeople);
+ void interestingPeopleReceived(QList<User> &interestingPeople);
/**
* @brief Signal when fetchMessages request is finished
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
-
private:
-
bool m_defaultImage; ///< Indicates if some of the friends/user doesn't have a image
QList<QNetworkReply *> m_currentRequests; ///< List of current http requests