41 |
41 |
42 #ifndef QCONTACTAVATAR_H |
42 #ifndef QCONTACTAVATAR_H |
43 #define QCONTACTAVATAR_H |
43 #define QCONTACTAVATAR_H |
44 |
44 |
45 #include <QString> |
45 #include <QString> |
46 #include <QPixmap> |
46 #include <QUrl> |
|
47 |
47 #include "qtcontactsglobal.h" |
48 #include "qtcontactsglobal.h" |
48 #include "qcontactdetail.h" |
49 #include "qcontactdetail.h" |
49 #include "qcontact.h" |
50 #include "qcontact.h" |
50 |
|
51 QT_BEGIN_NAMESPACE |
|
52 class QPixmap; |
|
53 class QSize; |
|
54 QT_END_NAMESPACE |
|
55 |
51 |
56 QTM_BEGIN_NAMESPACE |
52 QTM_BEGIN_NAMESPACE |
57 |
53 |
58 /* Leaf class */ |
54 /* Leaf class */ |
59 class Q_CONTACTS_EXPORT QContactAvatar : public QContactDetail |
55 class Q_CONTACTS_EXPORT QContactAvatar : public QContactDetail |
60 { |
56 { |
61 public: |
57 public: |
62 #ifdef Q_QDOC |
58 #ifdef Q_QDOC |
63 const char* DefinitionName; |
59 static const QLatin1Constant DefinitionName; |
64 const char* FieldAvatar; |
60 static const QLatin1Constant FieldImageUrl; |
65 const char* FieldAvatarPixmap; |
61 static const QLatin1Constant FieldVideoUrl; |
66 const char* FieldSubType; |
|
67 const char* SubTypeImage; |
|
68 const char* SubTypeVideo; |
|
69 const char* SubTypeTexturedMesh; |
|
70 const char* SubTypeAudioRingtone; |
|
71 const char* SubTypeVideoRingtone; |
|
72 #else |
62 #else |
73 Q_DECLARE_CUSTOM_CONTACT_DETAIL(QContactAvatar, "Avatar") |
63 Q_DECLARE_CUSTOM_CONTACT_DETAIL(QContactAvatar, "Avatar") |
74 Q_DECLARE_LATIN1_LITERAL(FieldAvatar, "Avatar"); |
64 Q_DECLARE_LATIN1_CONSTANT(FieldImageUrl, "ImageUrl"); |
75 Q_DECLARE_LATIN1_LITERAL(FieldAvatarPixmap, "AvatarPixmap"); |
65 Q_DECLARE_LATIN1_CONSTANT(FieldVideoUrl, "VideoUrl"); |
76 Q_DECLARE_LATIN1_LITERAL(FieldSubType, "SubType"); |
66 // MeshUri, VibetoneUri, Audio(theme)Uri, ...? |
77 Q_DECLARE_LATIN1_LITERAL(SubTypeImage, "Image"); |
|
78 Q_DECLARE_LATIN1_LITERAL(SubTypeVideo, "Video"); |
|
79 Q_DECLARE_LATIN1_LITERAL(SubTypeTexturedMesh, "TexturedMesh"); |
|
80 Q_DECLARE_LATIN1_LITERAL(SubTypeAudioRingtone, "AudioRingtone"); |
|
81 Q_DECLARE_LATIN1_LITERAL(SubTypeVideoRingtone, "VideoRingtone"); |
|
82 #endif |
67 #endif |
83 |
68 |
84 void setAvatar(const QString& avatarPath) {setValue(FieldAvatar, avatarPath);} |
69 void setImageUrl(const QUrl& imageUrl) {setValue(FieldImageUrl, imageUrl);} |
85 QString avatar() const {return value(FieldAvatar);} |
70 QUrl imageUrl() const {return value<QUrl>(FieldImageUrl);} |
86 QPixmap pixmap() const {return value<QPixmap>(QContactAvatar::FieldAvatarPixmap);} |
71 |
87 bool setPixmap(const QPixmap& pixmap) |
72 void setVideoUrl(const QUrl& videoUrl) {setValue(FieldVideoUrl, videoUrl);} |
88 { |
73 QUrl videoUrl() const {return value<QUrl>(FieldVideoUrl);} |
89 setSubType(SubTypeImage); |
|
90 return setValue(FieldAvatarPixmap, QVariant::fromValue(pixmap)); |
|
91 } |
|
92 |
|
93 void setSubType(const QString& subType) {setValue(FieldSubType, subType);} |
|
94 QString subType() const {return value(FieldSubType);} |
|
95 }; |
74 }; |
96 |
75 |
97 QTM_END_NAMESPACE |
76 QTM_END_NAMESPACE |
98 |
77 |
99 #endif |
78 #endif |
100 |
|