Fetch user profile image by using UserImageProvider.
[situare] / src / user / profile.cpp
index eff1c7a..17eb7d0 100644 (file)
@@ -29,77 +29,56 @@ Profile::Profile(QObject *parent) :
     qDebug() << __PRETTY_FUNCTION__;
 }
 
-const QString& Profile::name() const
+void Profile::setProfile(const User &user)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    return m_name;
-}
-
-void Profile::setName(const QString &name)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_name = name;
+    m_profile = user;
     emit nameChanged();
+    emit messageChanged();
+    emit timeChanged();
+    emit addressChanged();
+    emit userIdChanged();
 }
 
-const QString& Profile::message() const
+const QString& Profile::name() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    return m_message;
+    return m_profile.name();
 }
 
-void Profile::setMessage(const QString &message)
+const QString& Profile::message() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_message = message;
-    emit messageChanged();
+    return m_profile.note();
 }
 
 const QString& Profile::time() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    return m_time;
-}
-
-void Profile::setTime(const QString &time)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_time = time;
-    emit timeChanged();
+    return m_profile.timestamp();
 }
 
 const QString& Profile::address() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    return m_address;
-}
-
-void Profile::setAddress(const QString &address)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_address = address;
-    emit addressChanged();
+    return m_profile.address();
 }
 
-const QString& Profile::imageUrl() const
+const QPixmap& Profile::pixmap() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    return m_imageUrl;
+    return m_profile.profileImage();
 }
 
-void Profile::setImageUrl(const QString &imageUrl)
+const QString& Profile::userId() const
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_imageUrl = imageUrl;
-    emit imageUrlChanged();
+    return m_profile.userId();
 }