cleaned small profila image handling
authorVille Tiensuu <ville.tiensuu@ixonos.com>
Mon, 31 May 2010 12:37:06 +0000 (15:37 +0300)
committerVille Tiensuu <ville.tiensuu@ixonos.com>
Mon, 31 May 2010 12:37:06 +0000 (15:37 +0300)
images.qrc
res/images/big_profile_image.gif [new file with mode: 0644]
src/situareservice/situareservice.cpp
src/ui/userinfopanel.cpp
src/user/user.cpp
src/user/user.h

index 0aad3c5..0847afd 100644 (file)
         <file>res/images/large_profile_pic_border_left.png</file>
         <file>res/images/large_profile_pic_border_middle.png</file>
         <file>res/images/large_profile_pic_border_right.png</file>
-        <file>res/images/large_profile_pic_border_bottom_filler.png</file>
-        <file>res/images/large_profile_pic_border_side_filler.png</file>
-        <file>res/images/large_profile_pic_border_top_filler.png</file>
-        <file>res/images/large_profile_pic_border_top_left.png</file>
-        <file>res/images/large_profile_pic_border_top_right.png</file>
-        <file>res/images/large_profile_pic_border_bottom_left.png</file>
-        <file>res/images/large_profile_pic_border_bottom_right.png</file>
+        <file>res/images/big_profile_image.gif</file>
     </qresource>
 </RCC>
diff --git a/res/images/big_profile_image.gif b/res/images/big_profile_image.gif
new file mode 100644 (file)
index 0000000..1d68d35
Binary files /dev/null and b/res/images/big_profile_image.gif differ
index b28902c..7a34ed8 100644 (file)
@@ -326,8 +326,9 @@ void SituareService::parseUserData(const QByteArray &jsonReply)
 
     QPointF coordinates(userMap["longitude"].toReal(), userMap["latitude"].toReal());
 
-    QUrl imageUrl = userMap["profile_pic"].toUrl();
-    QUrl imageUrlBig = userMap["pic_big"].toUrl();
+    QUrl imageUrl = userMap["pic_big"].toUrl();
+    qWarning() << "IMAGE URL: " << imageUrl;
+
 
     if(imageUrl.isEmpty()) {
         // user doesn't have profile image, so we need to get him a silhouette image
@@ -335,7 +336,7 @@ void SituareService::parseUserData(const QByteArray &jsonReply)
     }
 
     m_user = new User(userMap["address"].toString(), coordinates, userMap["name"].toString(),
-                  userMap["note"].toString(), imageUrl, imageUrlBig, userMap["timestamp"].toString(),
+                  userMap["note"].toString(), imageUrl, userMap["timestamp"].toString(),
                   true, userMap["uid"].toString());
 
     foreach (QVariant friendsVariant, result["friends"].toList()) {
@@ -346,7 +347,6 @@ void SituareService::parseUserData(const QByteArray &jsonReply)
       QPointF coordinates(friendMap["longitude"].toReal(), friendMap["latitude"].toReal());
 
       QUrl imageUrl = friendMap["profile_pic"].toUrl();
-      QUrl imageUrlBig = friendMap["pic_big"].toUrl();
 
       if(imageUrl.isEmpty()) {
           // friend doesn't have profile image, so we need to get him a silhouette image
@@ -355,7 +355,7 @@ void SituareService::parseUserData(const QByteArray &jsonReply)
 
       User *user = new User(friendMap["address"].toString(), coordinates,
                             friendMap["name"].toString(),
-                            friendMap["note"].toString(), imageUrl, imageUrlBig,
+                            friendMap["note"].toString(), imageUrl,
                             friendMap["timestamp"].toString(),
                             false, friendMap["uid"].toString(),
                             distanceMap["units"].toString(),
@@ -373,8 +373,9 @@ void SituareService::imageReceived(const QUrl &url, const QPixmap &image)
 
     // assign facebook silhouette image to all who doesn't have a profile image
     if(url == QUrl(SILHOUETTE_URL)) {
-        if(m_user->profileImageUrl().isEmpty()) {
-            m_user->setProfileImage(AvatarImage::create(image));
+        if(m_user->profileImageUrl().isEmpty()) {            ;
+            m_user->setProfileImage(AvatarImage::create(QPixmap(
+                    ":res/images/big_profile_image.gif")));
         }
         for(int i=0;i < m_friendsList.count();i++) {
             if(m_friendsList.at(i)->profileImageUrl().isEmpty()) {
@@ -387,10 +388,6 @@ void SituareService::imageReceived(const QUrl &url, const QPixmap &image)
         m_user->setProfileImage(AvatarImage::create(image));
     }
 
-    if (m_user->profileImageUrlBig() == url) {
-        m_user->setProfileImageBig(AvatarImage::create(image));
-    }
-
     for(int i=0;i<m_friendsList.count();i++) {
         if(m_friendsList.at(i)->profileImageUrl() == url) {
             m_friendsList.at(i)->setProfileImage(AvatarImage::create(image));
@@ -414,13 +411,8 @@ void SituareService::addProfileImages()
         emit fetchImage(QUrl(SILHOUETTE_URL));
     }
 
-    // dont download small profile image because not needed.
-//    if(!m_user->profileImageUrl().isEmpty() && m_user->profileImageUrl().isValid())
-//        emit fetchImage(m_user->profileImageUrl());
-
-    if(!m_user->profileImageUrlBig().isEmpty() && m_user->profileImageUrlBig().isValid()) {
-        emit fetchImage(m_user->profileImageUrlBig());
-    }
+    if(!m_user->profileImageUrl().isEmpty() && m_user->profileImageUrl().isValid())
+        emit fetchImage(m_user->profileImageUrl());
 
     for(int i=0;i<m_friendsList.count();i++) {
         if(!m_friendsList.at(i)->profileImageUrl().isEmpty() &&
index 98b2e67..33afd5e 100644 (file)
@@ -70,7 +70,7 @@ void UserInfoPanel::userDataReceived(User *user)
 
     if(user) {
         m_userInfo->setUserName(user->name());
-        m_userInfo->setProfileImage(user->profileImageBig());
+        m_userInfo->setProfileImage(user->profileImage());
         m_userInfo->setMessageText(user->note());
         m_userInfo->setAddress(user->address());
         m_userInfo->setTime(user->timestamp());
index 9781ec6..f63f1dd 100644 (file)
 #include "user.h"
 
 User::User(const QString &address, const QPointF &coordinates, const QString &name,
-           const QString &note, const QUrl &imageUrl, const QUrl &imageUrlBig,
-           const QString &timestamp, const bool &type, const QString &userId,
-           const QString &units, const double &value)
+           const QString &note, const QUrl &imageUrl, const QString &timestamp, const bool &type,
+           const QString &userId, const QString &units, const double &value)
                : m_address(address)
                , m_coordinates(coordinates)
                , m_name(name)
                , m_note(note)
-               , m_profileImageUrl(imageUrl)
-               , m_profileImageUrlBig(imageUrlBig)
+               , m_profileImageUrl(imageUrl)               
                , m_timestamp(timestamp)
                , m_type(type)
                , m_units(units)
@@ -81,21 +79,11 @@ void User::setProfileImage(const QPixmap &image)
     m_profileImage = image;
 }
 
-void User::setProfileImageBig(const QPixmap &image)
-{
-    m_profileImageBig = image;
-}
-
 void User::setProfileImageUrl(const QUrl &imageUrl)
 {
     m_profileImageUrl = imageUrl;
 }
 
-void User::setProfileImageUrlBig(const QUrl &imageUrl)
-{
-    m_profileImageUrlBig = imageUrl;
-}
-
 void User::setTimestamp(const QString &timestamp)
 {
     m_timestamp = timestamp;
@@ -132,21 +120,11 @@ const QPixmap& User::profileImage() const
     return m_profileImage;
 }
 
-const QPixmap& User::profileImageBig() const
-{
-    return m_profileImageBig;
-}
-
 const QUrl& User::profileImageUrl() const
 {
     return m_profileImageUrl;
 }
 
-const QUrl& User::profileImageUrlBig() const
-{
-    return m_profileImageUrlBig;
-}
-
 const QString& User::timestamp() const
 {
     return m_timestamp;
index ff6a22c..6f166cd 100644 (file)
@@ -42,9 +42,9 @@ public:
     *
     */
     User(const QString &address, const QPointF &coordinates, const QString &name,
-         const QString &note, const QUrl &imageUrl, const QUrl &imageUrlBig,
-         const QString &timestamp, const bool &type, const QString &userId,
-         const QString &units = 0, const double &value = 0);
+         const QString &note, const QUrl &imageUrl, const QString &timestamp,
+         const bool &type, const QString &userId, const QString &units = 0,
+         const double &value = 0);
 
     /**
     * @brief Default constructor, initializes member data as NULL/0
@@ -93,13 +93,6 @@ public:
     void setProfileImage(const QPixmap &image);
 
     /**
-    * @brief Set big profile image
-    *
-    * @param image big profile Image
-    */
-    void setProfileImageBig(const QPixmap &image);
-
-    /**
     * @brief Set download address for profile image
     *
     * @param imageUrl image url of big image
@@ -107,13 +100,6 @@ public:
     void setProfileImageUrl(const QUrl &imageUrl);
 
     /**
-    * @brief Set download address for big profile image
-    *
-    * @param imageUrl image url
-    */
-    void setProfileImageUrlBig(const QUrl &imageUrl);
-
-    /**
     * @brief Set timestamp for last status update, timestamp is in literal mode
     *
     * @param timestamp timestamp
@@ -164,13 +150,6 @@ public:
     const QPixmap &profileImage() const;
 
     /**
-    * @brief Get big profile image
-    *
-    * @return QPixmap big profile image
-    */
-    const QPixmap &profileImageBig() const;
-
-    /**
     * @brief Get download address for profile image
     *
     * @return QString url
@@ -178,13 +157,6 @@ public:
     const QUrl &profileImageUrl() const;
 
     /**
-    * @brief Get download address for big profile image
-    *
-    * @return QString url of big profile image
-    */
-    const QUrl &profileImageUrlBig() const;
-
-    /**
     * @brief Get timestamp of last status update
     *
     * @return QString timestamp
@@ -210,20 +182,18 @@ public:
      ******************************************************************************/
 
 private:
-    QString m_address; ///< placeholder for address information
+    bool m_type; ///< placeholder for user type
+    double m_value; ///< placeholder for distance value
+
     QPointF m_coordinates; ///< placeholder for coordinates
+    QString m_address; ///< placeholder for address information    
     QString m_name; ///< placeholder for name
-    QString m_note; ///< placeholder for note
-    QUrl m_profileImageUrl; ///< placeholder for image url
-    QUrl m_profileImageUrlBig; ///< placeholder for big profile image url
-    QString m_timestamp; ///< placeholer for timestamp
-    bool m_type; ///< placeholder for user type
+    QString m_note; ///< placeholder for note    
+    QString m_timestamp; ///< placeholer for timestamp    
     QString m_units; ///< placeholder for distance unit type
     QString m_userId; ///< placeholder for userId
-    double m_value; ///< placeholder for distance value
-
+    QUrl m_profileImageUrl; ///< placeholder for image url
     QPixmap m_profileImage; ///< placeholder for image
-    QPixmap m_profileImageBig; ///< placeholder for big image
 };