Handle IM_OWN_AVATAR_SET.
There's only one little problem that will probably be solved after Alpha1: if you have multiple accounts, all of them will set the avatar icon and the user will see just the last icon set.
This commit is contained in:
parent
95657d52ba
commit
f560943e6f
|
@ -199,13 +199,15 @@ MainWindow::ImMessage(BMessage* msg)
|
||||||
int32 im_what = msg->FindInt32("im_what");
|
int32 im_what = msg->FindInt32("im_what");
|
||||||
switch (im_what) {
|
switch (im_what) {
|
||||||
case IM_OWN_CONTACT_INFO:
|
case IM_OWN_CONTACT_INFO:
|
||||||
{
|
|
||||||
fStatusView->SetName(msg->FindString("name"));
|
fStatusView->SetName(msg->FindString("name"));
|
||||||
|
break;
|
||||||
|
case IM_OWN_AVATAR_SET:
|
||||||
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
|
|
||||||
if (msg->FindRef("ref", &ref) == B_OK) {
|
if (msg->FindRef("ref", &ref) == B_OK) {
|
||||||
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
|
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
|
||||||
fStatusView->SetAvatar(bitmap);
|
fStatusView->SetAvatarIcon(bitmap);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,11 @@ const int32 kSetNickname = 'stnk';
|
||||||
|
|
||||||
|
|
||||||
StatusView::StatusView(const char* name)
|
StatusView::StatusView(const char* name)
|
||||||
: BView(name, B_WILL_DRAW)
|
:
|
||||||
|
BView(name, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
// Nick name
|
// Nick name
|
||||||
fNickname = new NicknameTextControl("nickname", new BMessage(kSetNickname));
|
fNickname = new NicknameTextControl("Nickname", new BMessage(kSetNickname));
|
||||||
|
|
||||||
// Status menu
|
// Status menu
|
||||||
fStatusMenu = new BPopUpMenu("-");
|
fStatusMenu = new BPopUpMenu("-");
|
||||||
|
@ -58,11 +59,11 @@ StatusView::StatusView(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu field
|
// Menu field
|
||||||
BMenuField* statusField = new BMenuField("statusField", NULL,
|
BMenuField* statusField = new BMenuField("StatusField", NULL,
|
||||||
fStatusMenu, NULL);
|
fStatusMenu, NULL);
|
||||||
|
|
||||||
// Icon
|
// Icon
|
||||||
fAvatar = new BitmapView("icon");
|
fAvatar = new BitmapView("AvatarIcon");
|
||||||
fAvatar->SetExplicitMaxSize(BSize(50, 50));
|
fAvatar->SetExplicitMaxSize(BSize(50, 50));
|
||||||
fAvatar->SetExplicitPreferredSize(BSize(50, 50));
|
fAvatar->SetExplicitPreferredSize(BSize(50, 50));
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ StatusView::SetStatus(CayaStatus status)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StatusView::SetAvatar(BBitmap* bitmap)
|
StatusView::SetAvatarIcon(BBitmap* bitmap)
|
||||||
{
|
{
|
||||||
fAvatar->SetBitmap(bitmap);
|
fAvatar->SetBitmap(bitmap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
void SetName(BString name);
|
void SetName(BString name);
|
||||||
void SetStatus(CayaStatus status);
|
void SetStatus(CayaStatus status);
|
||||||
void SetAvatar(BBitmap* bitmap);
|
void SetAvatarIcon(BBitmap* bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BPopUpMenu* fStatusMenu;
|
BPopUpMenu* fStatusMenu;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue