Misc. tweaks, no functional change
This commit is contained in:
parent
803a2f20bd
commit
9f05ce1136
|
@ -59,6 +59,4 @@ private:
|
|||
|
||||
typedef KeyMap<BString, ChatCommand*> CommandMap;
|
||||
|
||||
|
||||
#endif // CHAT_COMMAND_H
|
||||
|
||||
|
|
|
@ -52,9 +52,8 @@ ImageCache::~ImageCache()
|
|||
ImageCache*
|
||||
ImageCache::Get()
|
||||
{
|
||||
if (fInstance == NULL) {
|
||||
if (fInstance == NULL)
|
||||
fInstance = new ImageCache();
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
|
@ -103,8 +102,10 @@ ImageCache::Release()
|
|||
void
|
||||
ImageCache::_LoadResource(int identifier, const char* key)
|
||||
{
|
||||
BResources* res = ChatResources();
|
||||
BBitmap* bitmap = IconFromResources(res, identifier, B_LARGE_ICON);
|
||||
BResources res = ChatResources();
|
||||
if (res.InitCheck() != B_OK)
|
||||
return;
|
||||
BBitmap* bitmap = IconFromResources(&res, identifier, B_LARGE_ICON);
|
||||
if (bitmap != NULL && bitmap->IsValid() == true)
|
||||
fBitmaps.AddItem(BString(key), bitmap);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ ProtocolLooper::ConversationById(BString id)
|
|||
void
|
||||
ProtocolLooper::AddConversation(Conversation* chat)
|
||||
{
|
||||
if (chat != NULL)
|
||||
fChatMap.AddItem(chat->GetId(), chat);
|
||||
}
|
||||
|
||||
|
@ -96,6 +97,7 @@ ProtocolLooper::AddConversation(Conversation* chat)
|
|||
void
|
||||
ProtocolLooper::RemoveConversation(Conversation* chat)
|
||||
{
|
||||
if (chat != NULL)
|
||||
fChatMap.RemoveItemFor(chat->GetId());
|
||||
}
|
||||
|
||||
|
@ -118,6 +120,7 @@ ProtocolLooper::ContactById(BString id)
|
|||
void
|
||||
ProtocolLooper::AddContact(Contact* contact)
|
||||
{
|
||||
if (contact != NULL)
|
||||
fRosterMap.AddItem(contact->GetId(), contact);
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,8 @@ ProtocolLooper::AddContact(Contact* contact)
|
|||
void
|
||||
ProtocolLooper::RemoveContact(Contact* contact)
|
||||
{
|
||||
if (contact == NULL)
|
||||
return;
|
||||
fRosterMap.RemoveItemFor(contact->GetId());
|
||||
fUserMap.AddItem(contact->GetId(), (User*)contact);
|
||||
}
|
||||
|
@ -159,6 +164,7 @@ ProtocolLooper::UserById(BString id)
|
|||
void
|
||||
ProtocolLooper::AddUser(User* user)
|
||||
{
|
||||
if (user != NULL)
|
||||
fUserMap.AddItem(user->GetId(), user);
|
||||
}
|
||||
|
||||
|
@ -187,6 +193,7 @@ ProtocolLooper::GetOwnContact()
|
|||
void
|
||||
ProtocolLooper::SetOwnContact(Contact* contact)
|
||||
{
|
||||
if (contact != NULL)
|
||||
fMySelf = contact;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ProtocolTemplate::ProtocolTemplate(ChatProtocol* protocol, const char* type)
|
|||
if (settingsTemplate.IsEmpty() == true) {
|
||||
size_t size;
|
||||
const void* buff =
|
||||
ChatResources()->LoadResource(B_MESSAGE_TYPE, type, &size);
|
||||
ChatResources().LoadResource(B_MESSAGE_TYPE, type, &size);
|
||||
|
||||
if (buff != NULL)
|
||||
settingsTemplate.Unflatten((const char*)buff);
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
BString fTitle;
|
||||
const char* fTitle;
|
||||
int32 fPerms; // Permissions afforded to role, as described above.
|
||||
int32 fPriority; // 'Rank' of role, with higher being greater priority.
|
||||
// I.E., a user with a priority of 11 can't kick a user
|
||||
|
|
|
@ -55,13 +55,15 @@ Server::Server()
|
|||
|| fCommands.CountItems() > 0)
|
||||
return;
|
||||
|
||||
BResources* res = ChatResources();
|
||||
BResources res = ChatResources();
|
||||
if (res.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
// Loading user pop-up items
|
||||
for (int i = 0; i < 6; i++) {
|
||||
size_t size;
|
||||
BMessage temp;
|
||||
const void* buff = res->LoadResource(B_MESSAGE_TYPE, 1100 + i, &size);
|
||||
const void* buff = res.LoadResource(B_MESSAGE_TYPE, 1100 + i, &size);
|
||||
temp.Unflatten((const char*)buff);
|
||||
fUserItems.AddItem(new BMessage(temp));
|
||||
}
|
||||
|
@ -69,7 +71,7 @@ Server::Server()
|
|||
// Loading room pop-up items
|
||||
BMessage leave;
|
||||
size_t leaveSize;
|
||||
const void* leaveBuff = res->LoadResource(B_MESSAGE_TYPE, 1120, &leaveSize);
|
||||
const void* leaveBuff = res.LoadResource(B_MESSAGE_TYPE, 1120, &leaveSize);
|
||||
leave.Unflatten((const char*)leaveBuff);
|
||||
fChatItems.AddItem(new BMessage(leave));
|
||||
|
||||
|
@ -77,7 +79,7 @@ Server::Server()
|
|||
for (int i = 0; i < 9; i++) {
|
||||
size_t size;
|
||||
BMessage temp;
|
||||
const void* buff = res->LoadResource(B_MESSAGE_TYPE, 1140 + i, &size);
|
||||
const void* buff = res.LoadResource(B_MESSAGE_TYPE, 1140 + i, &size);
|
||||
temp.Unflatten((const char*)buff);
|
||||
ChatCommand* cmd = new ChatCommand(&temp);
|
||||
fCommands.AddItem(cmd->GetName(), cmd);
|
||||
|
|
|
@ -95,7 +95,6 @@ TheApp::ReadyToRun()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fMainWin->Start();
|
||||
fMainWin->Show();
|
||||
}
|
||||
|
|
|
@ -264,18 +264,18 @@ User::_SetCachedAvatar(BBitmap* bitmap)
|
|||
{
|
||||
_EnsureCachePath();
|
||||
BFile cacheFile(fCachePath.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||
if (cacheFile.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
BBitmapStream* stream = new BBitmapStream(bitmap);
|
||||
BBitmapStream stream(bitmap);
|
||||
BTranslatorRoster* roster = BTranslatorRoster::Default();
|
||||
|
||||
int32 format_count;
|
||||
translator_info info;
|
||||
const translation_format* formats = NULL;
|
||||
roster->Identify(stream, new BMessage(), &info, 0, "image");
|
||||
roster->Identify(&stream, new BMessage(), &info, 0, "image");
|
||||
roster->GetOutputFormats(info.translator, &formats, &format_count);
|
||||
|
||||
roster->Translate(info.translator, stream, new BMessage(), &cacheFile,
|
||||
roster->Translate(info.translator, &stream, NULL, &cacheFile,
|
||||
formats[0].type);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ protected:
|
|||
UserItem* fListItem;
|
||||
|
||||
BString fID;
|
||||
bigtime_t fInstance;
|
||||
BString fName;
|
||||
BString fPersonalStatus;
|
||||
BBitmap* fAvatarBitmap;
|
||||
|
|
|
@ -91,23 +91,16 @@ CommandArgs(BString line)
|
|||
}
|
||||
|
||||
|
||||
BResources*
|
||||
BResources
|
||||
ChatResources()
|
||||
{
|
||||
BResources res;
|
||||
image_info info;
|
||||
if (our_image(info) != B_OK)
|
||||
return NULL;
|
||||
|
||||
if (our_image(info) == B_OK) {
|
||||
BFile file(info.name, B_READ_ONLY);
|
||||
if (file.InitCheck() != B_OK)
|
||||
return NULL;
|
||||
|
||||
BResources* res = new BResources(&file);
|
||||
if (res->InitCheck() != B_OK) {
|
||||
delete res;
|
||||
return NULL;
|
||||
if (file.InitCheck() == B_OK)
|
||||
res.SetTo(&file);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ bool IsCommand(BString line);
|
|||
BString CommandName(BString line);
|
||||
BString CommandArgs(BString line);
|
||||
|
||||
BResources* ChatResources();
|
||||
BResources ChatResources();
|
||||
|
||||
const char* SettingsPath();
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ ReplicantMenuItem::IsCustom() const
|
|||
void
|
||||
ReplicantMenuItem::SetIcon()
|
||||
{
|
||||
BResources* res = ChatResources();
|
||||
if (!res)
|
||||
BResources res = ChatResources();
|
||||
if (res.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
int32 num = 0;
|
||||
|
@ -84,8 +84,6 @@ ReplicantMenuItem::SetIcon()
|
|||
break;
|
||||
}
|
||||
|
||||
BBitmap* bitmap = IconFromResources(res, num, B_MINI_ICON);
|
||||
BBitmap* bitmap = IconFromResources(&res, num, B_MINI_ICON);
|
||||
SetBitmap(bitmap);
|
||||
|
||||
delete res;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,6 @@ ReplicantStatusView::ReplicantStatusView(BMessage* archive)
|
|||
|
||||
ReplicantStatusView::~ReplicantStatusView()
|
||||
{
|
||||
delete fResources;
|
||||
delete fCayaMsg;
|
||||
delete fReplicantHandler;
|
||||
delete fReplicantMenu;
|
||||
|
@ -300,7 +299,7 @@ ReplicantStatusView::_Init()
|
|||
BBitmap*
|
||||
ReplicantStatusView::_GetIcon(const uint32 id)
|
||||
{
|
||||
BBitmap* icon = IconFromResources(fResources, id, B_MINI_ICON);
|
||||
BBitmap* icon = IconFromResources(&fResources, id, B_MINI_ICON);
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ private:
|
|||
BBitmap* fExitMenuIcon;
|
||||
BBitmap* fPreferencesIcon;
|
||||
|
||||
BResources* fResources;
|
||||
BResources fResources;
|
||||
|
||||
BPopUpMenu* fReplicantMenu;
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ StatusMenuItem::IsCustom() const
|
|||
void
|
||||
StatusMenuItem::SetIcon()
|
||||
{
|
||||
BResources* res = ChatResources();
|
||||
if (!res)
|
||||
BResources res = ChatResources();
|
||||
if (res.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
int32 num = 0;
|
||||
|
@ -81,8 +81,6 @@ StatusMenuItem::SetIcon()
|
|||
break;
|
||||
}
|
||||
|
||||
BBitmap* bitmap = IconFromResources(res, num, B_MINI_ICON);
|
||||
BBitmap* bitmap = IconFromResources(&res, num, B_MINI_ICON);
|
||||
SetBitmap(bitmap);
|
||||
|
||||
delete res;
|
||||
}
|
||||
|
|
Ŝarĝante…
Reference in New Issue