Some style violations fixed.

This commit is contained in:
plfiorini 2010-05-20 21:31:55 +00:00
parent 8477dae359
commit 88c5eedc9b
19 changed files with 119 additions and 138 deletions

View File

@ -15,14 +15,14 @@ public:
void SetNickname(BString nick);
CayaStatus Status() const;
void SetStatus(CayaStatus status, const char* str = NULL);
void SetStatus(CayaStatus status,
const char* str = NULL);
private:
AccountManager();
~AccountManager();
CayaStatus fStatus;
//BObjectList<Account*> fAccounts;
};
#endif // _ACCOUNT_MANAGER_H

View File

@ -5,6 +5,6 @@
#ifndef _CAYA_H
#define _CAYA_H
#define CAYA_SIGNATURE "application/x-vnd.xeD.Caya"
#define CAYA_SIGNATURE "application/x-vnd.caya.Caya"
#endif // _CAYA_H

View File

@ -101,8 +101,8 @@ our_image(image_info& image)
int32 cookie = 0;
while (get_next_image_info(team, &cookie, &image) == B_OK) {
if ((char *)our_image >= (char *)image.text
&& (char *)our_image <= (char *)image.text + image.text_size)
if ((char*)our_image >= (char*)image.text
&& (char*)our_image <= (char*)image.text + image.text_size)
return B_OK;
}

View File

@ -40,8 +40,8 @@ ChatWindow::ChatWindow(ContactLinker* cl)
{
fReceiveView = new CayaRenderView("fReceiveView");
fReceiveView->SetOtherNick(cl->GetName());
BScrollView* scrollViewReceive = new BScrollView("scrollviewR", fReceiveView,
B_WILL_DRAW, false, true);
BScrollView* scrollViewReceive = new BScrollView("scrollviewR",
fReceiveView, B_WILL_DRAW, false, true);
fSendView = new BTextView("fReceiveView");
BScrollView* scrollViewSend = new BScrollView("scrollviewS", fSendView,
@ -61,7 +61,6 @@ ChatWindow::ChatWindow(ContactLinker* cl)
MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));
fSendView->MakeFocus(true);
}
@ -128,7 +127,7 @@ ChatWindow::ObserveString(int32 what, BString str)
{
switch (what) {
case STR_CONTACT_NAME:
if (Lock()){
if (Lock()) {
SetTitle(str);
fReceiveView->SetOtherNick(str);
Unlock();

View File

@ -2,39 +2,36 @@
* Copyright 2009, Andrea Anzani. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef ChatWindow_H_
#define ChatWindow_H_
#ifndef _CHAT_WINDOW_H
#define _CHAT_WINDOW_H
#include <Window.h>
#include <TextView.h>
#include "Observer.h"
#include "CayaConstants.h"
class ContactLinker;
class CayaRenderView;
class ChatWindow: public BWindow , public Observer
{
public:
class ChatWindow: public BWindow, public Observer {
public:
ChatWindow(ContactLinker* cl);
virtual void MessageReceived(BMessage* message);
void ImMessage(BMessage *msg);
virtual bool QuitRequested();
void ImMessage(BMessage* msg);
void ObserveString(int32 what, BString str);
void ObservePointer(int32 what, void* ptr);
void ObserveInteger(int32 what, int32 val);
void AppendStatus(CayaStatus status);
private:
private:
BTextView* fSendView;
ContactLinker* fContactLinker;
CayaRenderView *fReceiveView;
CayaRenderView* fReceiveView;
};
#endif
//--
#endif // _CHAT_WINDOW_H

View File

@ -17,7 +17,7 @@
EditingFilter::EditingFilter(BTextView* view)
:
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, B_KEY_DOWN, NULL),
_view(view)
fView(view)
{
}
@ -36,10 +36,10 @@ EditingFilter::Filter(BMessage* message, BHandler** target)
// If the Alt key jives with the command_enter status
if ((modifiers & B_COMMAND_KEY) != 0 && byte == B_ENTER) {
_view->Insert("\n");
fView->Insert("\n");
return B_SKIP_MESSAGE;
} else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) {
_view->Window()->PostMessage(CAYA_CHAT);
fView->Window()->PostMessage(CAYA_CHAT);
return B_SKIP_MESSAGE;
}

View File

@ -2,20 +2,20 @@
* Copyright 2009, Andrea Anzani. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef EDITING_FILTER_H
#define EDITING_FILTER_H
#ifndef _EDITING_FILTER_H
#define _EDITING_FILTER_H
#include <MessageFilter.h>
#include <interface/TextView.h>
#include <TextView.h>
class EditingFilter : public BMessageFilter {
public:
EditingFilter(BTextView *view);
EditingFilter(BTextView* view);
virtual filter_result Filter(BMessage *message, BHandler **target);
virtual filter_result Filter(BMessage* message, BHandler** target);
private:
BTextView *_view;
BTextView* fView;
};
#endif
#endif // _EDITING_FILTER_H

View File

@ -13,7 +13,7 @@
#include <Debug.h>
#include <TranslationUtils.h>
ImageCache *ImageCache::m_instance = NULL;
ImageCache* ImageCache::fInstance = NULL;
ImageCache::ImageCache()
@ -23,8 +23,8 @@ ImageCache::ImageCache()
ImageCache::~ImageCache()
{
while (m_bitmaps.CountItems()) {
BBitmap* bit = m_bitmaps.ValueFor(0);
while (fBitmaps.CountItems()) {
BBitmap* bit = fBitmaps.ValueFor(0);
delete bit;
}
}
@ -33,20 +33,21 @@ ImageCache::~ImageCache()
BBitmap*
ImageCache::GetImage(BString which, BString name)
{
if (m_instance == NULL)
m_instance = new ImageCache();
if (fInstance == NULL)
fInstance = new ImageCache();
// Loads the bitmap if found
bool found;
BBitmap* bitmap = m_instance->m_bitmaps.ValueFor(name, &found);
BBitmap* bitmap = fInstance->fBitmaps.ValueFor(name, &found);
if (!found) {
bitmap = LoadImage(which.String(), name.String());
if (bitmap)
m_instance->m_bitmaps.AddItem(name, bitmap);
fInstance->fBitmaps.AddItem(name, bitmap);
return bitmap;
} else
return bitmap;
return NULL;
}
@ -54,22 +55,22 @@ ImageCache::GetImage(BString which, BString name)
void
ImageCache::AddImage(BString name, BBitmap* which)
{
if (m_instance == NULL)
m_instance = new ImageCache();
if (fInstance == NULL)
fInstance = new ImageCache();
m_instance->m_bitmaps.AddItem(name, which);
fInstance->fBitmaps.AddItem(name, which);
}
void
ImageCache::DeleteImage(BString name)
{
if (m_instance == NULL)
m_instance = new ImageCache();
if (fInstance == NULL)
fInstance = new ImageCache();
BBitmap* bitmap = m_instance->m_bitmaps.ValueFor(name);
if (bitmap){
m_instance->m_bitmaps.RemoveItemFor(name);
BBitmap* bitmap = fInstance->fBitmaps.ValueFor(name);
if (bitmap) {
fInstance->fBitmaps.RemoveItemFor(name);
delete bitmap;
}
}
@ -78,9 +79,9 @@ ImageCache::DeleteImage(BString name)
void
ImageCache::Release()
{
if (m_instance != NULL) {
delete m_instance;
m_instance = NULL;
if (fInstance != NULL) {
delete fInstance;
fInstance = NULL;
}
}
@ -93,6 +94,6 @@ ImageCache::LoadImage(const char* fullName, const char* shortName)
bitmap = BTranslationUtils::GetBitmap('PNG ', shortName);
if (!bitmap)
printf("ImageCache: Can't load bitmap! %s\n",fullName);
printf("ImageCache: Can't load bitmap! %s\n", fullName);
return bitmap;
}

View File

@ -2,56 +2,40 @@
* Copyright 2009, Andrea Anzani. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef ImageCache_H
#define ImageCache_H
/**
* ImageCache.
* @author Andrea Anzani.
*/
class BBitmap;
#ifndef _IMAGE_CACHE_H
#define _IMAGE_CACHE_H
#include <SupportDefs.h>
#include <String.h>
#include <libsupport/KeyMap.h>
class ImageCache
{
class BBitmap;
protected: // Constructor/Destructor
class ImageCache {
public:
/* Returns the image corresponding to the which constant */
static BBitmap* GetImage(BString fullPath,
BString symbolicName);
ImageCache();
~ImageCache();
public: // Operations
/** Returns the image corresponding to the which constant */
static BBitmap * GetImage( BString fullPath , BString symbolicName);
static void AddImage(BString name,BBitmap* which);
static void AddImage(BString name, BBitmap* which);
static void DeleteImage(BString name);
/** Frees the singleton instance of the cache;
Call this when app quits
/* Frees the singleton instance of the cache, must be
* called when the application quits.
*/
static void Release();
protected:
ImageCache();
~ImageCache();
private:
static BBitmap* LoadImage(const char* resourceName,
const char*);
static BBitmap * LoadImage( const char *resourceName,const char *);
// Class Data
static ImageCache * m_instance;
private: // Instance Data
KeyMap<BString,BBitmap*> m_bitmaps;
static ImageCache* fInstance;
KeyMap<BString, BBitmap*> fBitmaps;
};
#endif /* __C_ImageCache_H__ */
#endif // _IMAGE_CACHE_H

View File

@ -40,7 +40,8 @@ public:
private:
ProtocolManager();
void _GetAccounts(CayaProtocolAddOn* addOn, BHandler* target);
void _GetAccounts(CayaProtocolAddOn* addOn,
BHandler* target);
AddOnMap fAddOnMap;
ProtocolMap fProtocolMap;

View File

@ -136,7 +136,7 @@ Server::Filter(BMessage* message, BHandler **target)
BString id = message->FindString("id");
if (id.Length() > 0) {
bool found = false;
ContactLinker *item = fRosterMap.ValueFor(id, &found);
ContactLinker* item = fRosterMap.ValueFor(id, &found);
if (found)
item->HideWindow();
@ -244,7 +244,7 @@ Server::ImMessage(BMessage* msg)
// BPath fullPath(&ref);
// BBitmap* bitmap = ImageCache::GetImage(
// BString(fullPath.Path()), BString(fullPath.Path()));
BBitmap *bitmap = BTranslationUtils::GetBitmap(&ref);
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
linker->SetNotifyAvatarBitmap(bitmap);
} else
linker->SetNotifyAvatarBitmap(NULL);

View File

@ -30,22 +30,19 @@ public:
void Quit();
void AddProtocolLooper(bigtime_t instanceId, CayaProtocol* cayap);
void AddProtocolLooper(bigtime_t instanceId,
CayaProtocol* cayap);
void RemoveProtocolLooper(bigtime_t instanceId);
void LoginAll();
#if 0
void UpdateSettings(BMessage settings);
#endif
void SendProtocolMessage(BMessage* msg);
void SendAllProtocolMessage(BMessage* msg);
RosterMap RosterItems() const;
RosterItem* RosterItemForId(BString id);
//TODO: there should be a contact for each account.
// TODO: there should be a contact for each account.
ContactLinker* GetOwnContact();
private:

View File

@ -26,8 +26,9 @@ const uint32 kOK = 'save';
AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings,
const char* account)
: BWindow(BRect(0, 0, 1, 1), title, B_MODAL_WINDOW, B_NOT_RESIZABLE |
B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
:
BWindow(BRect(0, 0, 1, 1), title, B_MODAL_WINDOW, B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
fSettings(settings),
fAccount(account),
fTarget(NULL)

View File

@ -18,7 +18,8 @@ const uint32 kAccountRenamed = 'acrd';
class AccountDialog : public BWindow {
public:
AccountDialog(const char* title, ProtocolSettings* settings,
AccountDialog(const char* title,
ProtocolSettings* settings,
const char* account = NULL);
void SetTarget(BHandler* target);

View File

@ -12,8 +12,10 @@
#include "ProtocolSettings.h"
AccountListItem::AccountListItem(ProtocolSettings* settings, const char* account)
: BStringItem(account),
AccountListItem::AccountListItem(ProtocolSettings* settings,
const char* account)
:
BStringItem(account),
fSettings(settings),
fAccount(account),
fBaselineOffset(0)

View File

@ -164,9 +164,6 @@ RosterListView::Draw(BRect updateRect)
}
// #pragama mark -
void
RosterListView::Sort()
{

View File

@ -23,7 +23,8 @@ const float kCircle = 12;
StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status,
bool custom, char shortcut, uint32 modifiers)
: BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
:
BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
fStatus(status),
fCustom(custom)
{