Resolved a memory leak, removed unuseful commented code, CAYA_EXTENDED_AWAY replaced with CAYA_CUSTOM_STATUS and added CAYA_INVISIBLE.

This commit is contained in:
barrett 2012-05-15 17:20:11 +00:00
parent 710a3c6526
commit 7540f60d24
9 changed files with 51 additions and 92 deletions

View File

@ -31,9 +31,10 @@ enum CayaStatus {
CAYA_ONLINE = 1, CAYA_ONLINE = 1,
CAYA_AWAY = 2, CAYA_AWAY = 2,
CAYA_DO_NOT_DISTURB = 3, CAYA_DO_NOT_DISTURB = 3,
CAYA_OFFLINE = 4, CAYA_CUSTOM_STATUS = 4,
CAYA_EXTENDED_AWAY = 5, CAYA_INVISIBLE = 5,
CAYA_STATUSES = 6 CAYA_OFFLINE = 6,
CAYA_STATUSES = 7
}; };
#endif // _CAYA_CONSTANTS_H #endif // _CAYA_CONSTANTS_H

View File

@ -24,14 +24,16 @@ CayaStatusToString(CayaStatus status)
switch (status) { switch (status) {
case CAYA_ONLINE: case CAYA_ONLINE:
return "Available"; return "Available";
case CAYA_OFFLINE:
return "Offline";
case CAYA_AWAY: case CAYA_AWAY:
return "Away"; return "Away";
case CAYA_EXTENDED_AWAY:
return "Custom Status";
case CAYA_DO_NOT_DISTURB: case CAYA_DO_NOT_DISTURB:
return "Busy"; return "Busy";
case CAYA_CUSTOM_STATUS:
return "Custom Status";
case CAYA_INVISIBLE:
return "Invisible";
case CAYA_OFFLINE:
return "Offline";
default: default:
return NULL; return NULL;
} }

View File

@ -242,13 +242,18 @@ ChatWindow::AppendStatus(CayaStatus status)
case CAYA_ONLINE: case CAYA_ONLINE:
message << " is available"; message << " is available";
break; break;
case CAYA_EXTENDED_AWAY:
case CAYA_AWAY: case CAYA_AWAY:
message << " is away"; message << " is away";
break; break;
case CAYA_DO_NOT_DISTURB: case CAYA_DO_NOT_DISTURB:
message << " is busy, please do not disturb!"; message << " is busy, please do not disturb!";
break; break;
case CAYA_CUSTOM_STATUS:
message << " has set a custom status.";
break;
case CAYA_INVISIBLE:
message << " is invisible.";
break;
case CAYA_OFFLINE: case CAYA_OFFLINE:
message << " is offline"; message << " is offline";
break; break;

View File

@ -109,7 +109,7 @@ TheApp::AboutRequested()
AboutWindow* about = new AboutWindow("Caya", holders, AboutWindow* about = new AboutWindow("Caya", holders,
authors, extraInfo.String()); authors, extraInfo.String());
about->Show(); about->Show();
//delete about; delete about;
} }
@ -123,7 +123,6 @@ TheApp::GetMainWindow() const
void void
TheApp::MessageReceived(BMessage* message) TheApp::MessageReceived(BMessage* message)
{ {
//message->PrintToStream();
switch (message->what) { switch (message->what) {
case CAYA_REPLICANT_STATUS_SET: case CAYA_REPLICANT_STATUS_SET:
case CAYA_REPLICANT_SHOW_WINDOW: case CAYA_REPLICANT_SHOW_WINDOW:

View File

@ -24,6 +24,7 @@
#include "ContactLinker.h" #include "ContactLinker.h"
#include "CayaConstants.h" #include "CayaConstants.h"
#include "CayaRenderView.h" #include "CayaRenderView.h"
#include "CayaUtils.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "ContactInfoWindow.h" #include "ContactInfoWindow.h"
@ -45,24 +46,7 @@ ContactInfoWindow::ContactInfoWindow(ContactLinker* linker)
fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BString status(fContactLinker->GetName()); BString status(fContactLinker->GetName());
status << CayaStatusToString(fContactLinker->GetNotifyStatus());
switch (fContactLinker->GetNotifyStatus()) {
case CAYA_ONLINE:
status << " is available";
break;
case CAYA_EXTENDED_AWAY:
case CAYA_AWAY:
status << " is away";
break;
case CAYA_DO_NOT_DISTURB:
status << " is busy, please do not disturb!";
break;
case CAYA_OFFLINE:
status << " is offline";
break;
default:
break;
}
status << "\n\n ID : "; status << "\n\n ID : ";
status << fContactLinker->GetId(); status << fContactLinker->GetId();

View File

@ -67,15 +67,16 @@ ReplicantMenuItem::SetIcon()
case CAYA_ONLINE: case CAYA_ONLINE:
num = kOnlineReplicant; num = kOnlineReplicant;
break; break;
case CAYA_EXTENDED_AWAY:
num = kCayaIconReplicant;
break;
case CAYA_AWAY: case CAYA_AWAY:
num = kAwayReplicant; num = kAwayReplicant;
break; break;
case CAYA_DO_NOT_DISTURB: case CAYA_DO_NOT_DISTURB:
num = kBusyReplicant; num = kBusyReplicant;
break; break;
case CAYA_CUSTOM_STATUS:
num = kCayaIconReplicant;
break;
case CAYA_INVISIBLE:
case CAYA_OFFLINE: case CAYA_OFFLINE:
num = kOfflineReplicant; num = kOfflineReplicant;
break; break;

View File

@ -153,12 +153,13 @@ ReplicantStatusView::SetStatus(CayaStatus status)
case CAYA_AWAY: case CAYA_AWAY:
fIcon = fAwayIcon; fIcon = fAwayIcon;
break; break;
case CAYA_EXTENDED_AWAY:
fIcon = fCayaIcon;
break;
case CAYA_DO_NOT_DISTURB: case CAYA_DO_NOT_DISTURB:
fIcon = fBusyIcon; fIcon = fBusyIcon;
break; break;
case CAYA_CUSTOM_STATUS:
fIcon = fCayaIcon;
break;
case CAYA_INVISIBLE:
case CAYA_OFFLINE: case CAYA_OFFLINE:
fIcon = fOfflineIcon; fIcon = fOfflineIcon;
break; break;

View File

@ -112,64 +112,29 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete)
owner->FillRect(frame); owner->FillRect(frame);
} }
/*BResources* res = CayaResources(); // Draw contact status
if (res) { switch (fStatus) {
int32 num = 0; case CAYA_ONLINE:
owner->SetHighColor(CAYA_GREEN_COLOR);
switch (fStatus) {
case CAYA_ONLINE:
num = kOnlineReplicant;
break;
case CAYA_EXTENDED_AWAY:
num = kCayaIconReplicant;
break;
case CAYA_AWAY:
num = kAwayReplicant;
break;
case CAYA_DO_NOT_DISTURB:
num = kBusyReplicant;
break;
case CAYA_OFFLINE:
num = kOfflineReplicant;
break;
default:
break; break;
case CAYA_CUSTOM_STATUS:
case CAYA_AWAY:
owner->SetHighColor(CAYA_ORANGE_COLOR);
break;
case CAYA_DO_NOT_DISTURB:
owner->SetHighColor(CAYA_RED_COLOR);
break;
case CAYA_INVISIBLE:
case CAYA_OFFLINE:
break;
default:
break;
} }
BBitmap* bitmap = IconFromResources(res, num, B_MINI_ICON); owner->FillRect(BRect(frame.left,
BRect bitmapRect(frame.left + 40, frame.top + fBaselineOffset - 10, frame.top,
frame.left + 55, frame.top + 18); frame.left + 5, frame.top + h - 1
));
owner->SetDrawingMode(B_OP_ALPHA);
owner->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
owner->DrawBitmap(bitmap, bitmap->Bounds(),
bitmapRect, B_FILTER_BITMAP_BILINEAR);
delete res;
} else {*/
// Draw contact status
switch (fStatus) {
case CAYA_ONLINE:
owner->SetHighColor(CAYA_GREEN_COLOR);
break;
case CAYA_EXTENDED_AWAY:
case CAYA_AWAY:
owner->SetHighColor(CAYA_ORANGE_COLOR);
break;
case CAYA_DO_NOT_DISTURB:
owner->SetHighColor(CAYA_RED_COLOR);
break;
case CAYA_OFFLINE:
break;
default:
break;
}
owner->FillRect(BRect(frame.left,
frame.top,
frame.left + 5, frame.top + h - 1
));
//}
// Draw avatar icon // Draw avatar icon
if (fBitmap != NULL) { if (fBitmap != NULL) {

View File

@ -64,15 +64,16 @@ StatusMenuItem::SetIcon()
case CAYA_ONLINE: case CAYA_ONLINE:
num = kOnlineReplicant; num = kOnlineReplicant;
break; break;
case CAYA_EXTENDED_AWAY:
num = kCayaIconReplicant;
break;
case CAYA_AWAY: case CAYA_AWAY:
num = kAwayReplicant; num = kAwayReplicant;
break; break;
case CAYA_DO_NOT_DISTURB: case CAYA_DO_NOT_DISTURB:
num = kBusyReplicant; num = kBusyReplicant;
break; break;
case CAYA_CUSTOM_STATUS:
num = kCayaIconReplicant;
break;
case CAYA_INVISIBLE:
case CAYA_OFFLINE: case CAYA_OFFLINE:
num = kOfflineReplicant; num = kOfflineReplicant;
break; break;