Some style violations fixed.
This commit is contained in:
parent
8477dae359
commit
88c5eedc9b
|
@ -15,14 +15,14 @@ public:
|
||||||
void SetNickname(BString nick);
|
void SetNickname(BString nick);
|
||||||
|
|
||||||
CayaStatus Status() const;
|
CayaStatus Status() const;
|
||||||
void SetStatus(CayaStatus status, const char* str = NULL);
|
void SetStatus(CayaStatus status,
|
||||||
|
const char* str = NULL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AccountManager();
|
AccountManager();
|
||||||
~AccountManager();
|
~AccountManager();
|
||||||
|
|
||||||
CayaStatus fStatus;
|
CayaStatus fStatus;
|
||||||
//BObjectList<Account*> fAccounts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ACCOUNT_MANAGER_H
|
#endif // _ACCOUNT_MANAGER_H
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
#ifndef _CAYA_H
|
#ifndef _CAYA_H
|
||||||
#define _CAYA_H
|
#define _CAYA_H
|
||||||
|
|
||||||
#define CAYA_SIGNATURE "application/x-vnd.xeD.Caya"
|
#define CAYA_SIGNATURE "application/x-vnd.caya.Caya"
|
||||||
|
|
||||||
#endif // _CAYA_H
|
#endif // _CAYA_H
|
||||||
|
|
|
@ -40,8 +40,8 @@ ChatWindow::ChatWindow(ContactLinker* cl)
|
||||||
{
|
{
|
||||||
fReceiveView = new CayaRenderView("fReceiveView");
|
fReceiveView = new CayaRenderView("fReceiveView");
|
||||||
fReceiveView->SetOtherNick(cl->GetName());
|
fReceiveView->SetOtherNick(cl->GetName());
|
||||||
BScrollView* scrollViewReceive = new BScrollView("scrollviewR", fReceiveView,
|
BScrollView* scrollViewReceive = new BScrollView("scrollviewR",
|
||||||
B_WILL_DRAW, false, true);
|
fReceiveView, B_WILL_DRAW, false, true);
|
||||||
|
|
||||||
fSendView = new BTextView("fReceiveView");
|
fSendView = new BTextView("fReceiveView");
|
||||||
BScrollView* scrollViewSend = new BScrollView("scrollviewS", fSendView,
|
BScrollView* scrollViewSend = new BScrollView("scrollviewS", fSendView,
|
||||||
|
@ -61,7 +61,6 @@ ChatWindow::ChatWindow(ContactLinker* cl)
|
||||||
MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));
|
MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));
|
||||||
|
|
||||||
fSendView->MakeFocus(true);
|
fSendView->MakeFocus(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,39 +2,36 @@
|
||||||
* Copyright 2009, Andrea Anzani. All rights reserved.
|
* Copyright 2009, Andrea Anzani. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef ChatWindow_H_
|
#ifndef _CHAT_WINDOW_H
|
||||||
#define ChatWindow_H_
|
#define _CHAT_WINDOW_H
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include "Observer.h"
|
#include "Observer.h"
|
||||||
|
|
||||||
#include "CayaConstants.h"
|
#include "CayaConstants.h"
|
||||||
|
|
||||||
class ContactLinker;
|
class ContactLinker;
|
||||||
class CayaRenderView;
|
class CayaRenderView;
|
||||||
|
|
||||||
class ChatWindow: public BWindow , public Observer
|
class ChatWindow: public BWindow, public Observer {
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWindow(ContactLinker* cl);
|
ChatWindow(ContactLinker* cl);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
void ImMessage(BMessage *msg);
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
|
void ImMessage(BMessage* msg);
|
||||||
|
|
||||||
void ObserveString(int32 what, BString str);
|
void ObserveString(int32 what, BString str);
|
||||||
void ObservePointer(int32 what, void* ptr);
|
void ObservePointer(int32 what, void* ptr);
|
||||||
void ObserveInteger(int32 what, int32 val);
|
void ObserveInteger(int32 what, int32 val);
|
||||||
void AppendStatus(CayaStatus status);
|
void AppendStatus(CayaStatus status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BTextView* fSendView;
|
BTextView* fSendView;
|
||||||
ContactLinker* fContactLinker;
|
ContactLinker* fContactLinker;
|
||||||
CayaRenderView* fReceiveView;
|
CayaRenderView* fReceiveView;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _CHAT_WINDOW_H
|
||||||
|
|
||||||
//--
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
EditingFilter::EditingFilter(BTextView* view)
|
EditingFilter::EditingFilter(BTextView* view)
|
||||||
:
|
:
|
||||||
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, B_KEY_DOWN, NULL),
|
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 the Alt key jives with the command_enter status
|
||||||
if ((modifiers & B_COMMAND_KEY) != 0 && byte == B_ENTER) {
|
if ((modifiers & B_COMMAND_KEY) != 0 && byte == B_ENTER) {
|
||||||
_view->Insert("\n");
|
fView->Insert("\n");
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
} else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) {
|
} else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) {
|
||||||
_view->Window()->PostMessage(CAYA_CHAT);
|
fView->Window()->PostMessage(CAYA_CHAT);
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* Copyright 2009, Andrea Anzani. All rights reserved.
|
* Copyright 2009, Andrea Anzani. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef EDITING_FILTER_H
|
#ifndef _EDITING_FILTER_H
|
||||||
#define EDITING_FILTER_H
|
#define _EDITING_FILTER_H
|
||||||
|
|
||||||
#include <MessageFilter.h>
|
#include <MessageFilter.h>
|
||||||
#include <interface/TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
class EditingFilter : public BMessageFilter {
|
class EditingFilter : public BMessageFilter {
|
||||||
public:
|
public:
|
||||||
|
@ -15,7 +15,7 @@ public:
|
||||||
virtual filter_result Filter(BMessage* message, BHandler** target);
|
virtual filter_result Filter(BMessage* message, BHandler** target);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BTextView *_view;
|
BTextView* fView;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif // _EDITING_FILTER_H
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
|
||||||
ImageCache *ImageCache::m_instance = NULL;
|
ImageCache* ImageCache::fInstance = NULL;
|
||||||
|
|
||||||
|
|
||||||
ImageCache::ImageCache()
|
ImageCache::ImageCache()
|
||||||
|
@ -23,8 +23,8 @@ ImageCache::ImageCache()
|
||||||
|
|
||||||
ImageCache::~ImageCache()
|
ImageCache::~ImageCache()
|
||||||
{
|
{
|
||||||
while (m_bitmaps.CountItems()) {
|
while (fBitmaps.CountItems()) {
|
||||||
BBitmap* bit = m_bitmaps.ValueFor(0);
|
BBitmap* bit = fBitmaps.ValueFor(0);
|
||||||
delete bit;
|
delete bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,20 +33,21 @@ ImageCache::~ImageCache()
|
||||||
BBitmap*
|
BBitmap*
|
||||||
ImageCache::GetImage(BString which, BString name)
|
ImageCache::GetImage(BString which, BString name)
|
||||||
{
|
{
|
||||||
if (m_instance == NULL)
|
if (fInstance == NULL)
|
||||||
m_instance = new ImageCache();
|
fInstance = new ImageCache();
|
||||||
|
|
||||||
// Loads the bitmap if found
|
// Loads the bitmap if found
|
||||||
bool found;
|
bool found;
|
||||||
BBitmap* bitmap = m_instance->m_bitmaps.ValueFor(name, &found);
|
BBitmap* bitmap = fInstance->fBitmaps.ValueFor(name, &found);
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
bitmap = LoadImage(which.String(), name.String());
|
bitmap = LoadImage(which.String(), name.String());
|
||||||
if (bitmap)
|
if (bitmap)
|
||||||
m_instance->m_bitmaps.AddItem(name, bitmap);
|
fInstance->fBitmaps.AddItem(name, bitmap);
|
||||||
return bitmap;
|
return bitmap;
|
||||||
} else
|
} else
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,22 +55,22 @@ ImageCache::GetImage(BString which, BString name)
|
||||||
void
|
void
|
||||||
ImageCache::AddImage(BString name, BBitmap* which)
|
ImageCache::AddImage(BString name, BBitmap* which)
|
||||||
{
|
{
|
||||||
if (m_instance == NULL)
|
if (fInstance == NULL)
|
||||||
m_instance = new ImageCache();
|
fInstance = new ImageCache();
|
||||||
|
|
||||||
m_instance->m_bitmaps.AddItem(name, which);
|
fInstance->fBitmaps.AddItem(name, which);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageCache::DeleteImage(BString name)
|
ImageCache::DeleteImage(BString name)
|
||||||
{
|
{
|
||||||
if (m_instance == NULL)
|
if (fInstance == NULL)
|
||||||
m_instance = new ImageCache();
|
fInstance = new ImageCache();
|
||||||
|
|
||||||
BBitmap* bitmap = m_instance->m_bitmaps.ValueFor(name);
|
BBitmap* bitmap = fInstance->fBitmaps.ValueFor(name);
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
m_instance->m_bitmaps.RemoveItemFor(name);
|
fInstance->fBitmaps.RemoveItemFor(name);
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,9 +79,9 @@ ImageCache::DeleteImage(BString name)
|
||||||
void
|
void
|
||||||
ImageCache::Release()
|
ImageCache::Release()
|
||||||
{
|
{
|
||||||
if (m_instance != NULL) {
|
if (fInstance != NULL) {
|
||||||
delete m_instance;
|
delete fInstance;
|
||||||
m_instance = NULL;
|
fInstance = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,56 +2,40 @@
|
||||||
* Copyright 2009, Andrea Anzani. All rights reserved.
|
* Copyright 2009, Andrea Anzani. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef ImageCache_H
|
#ifndef _IMAGE_CACHE_H
|
||||||
#define ImageCache_H
|
#define _IMAGE_CACHE_H
|
||||||
|
|
||||||
/**
|
|
||||||
* ImageCache.
|
|
||||||
* @author Andrea Anzani.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class BBitmap;
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include <libsupport/KeyMap.h>
|
#include <libsupport/KeyMap.h>
|
||||||
|
|
||||||
class ImageCache
|
class BBitmap;
|
||||||
{
|
|
||||||
|
|
||||||
protected: // Constructor/Destructor
|
|
||||||
|
|
||||||
ImageCache();
|
|
||||||
|
|
||||||
~ImageCache();
|
|
||||||
|
|
||||||
public: // Operations
|
|
||||||
|
|
||||||
/** Returns the image corresponding to the which constant */
|
|
||||||
static BBitmap * GetImage( BString fullPath , BString symbolicName);
|
|
||||||
|
|
||||||
|
class ImageCache {
|
||||||
|
public:
|
||||||
|
/* 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);
|
static void DeleteImage(BString name);
|
||||||
|
|
||||||
/** Frees the singleton instance of the cache;
|
/* Frees the singleton instance of the cache, must be
|
||||||
Call this when app quits
|
* called when the application quits.
|
||||||
*/
|
*/
|
||||||
static void Release();
|
static void Release();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ImageCache();
|
||||||
|
~ImageCache();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static BBitmap* LoadImage(const char* resourceName,
|
||||||
|
const char*);
|
||||||
|
|
||||||
static BBitmap * LoadImage( const char *resourceName,const char *);
|
static ImageCache* fInstance;
|
||||||
// Class Data
|
KeyMap<BString, BBitmap*> fBitmaps;
|
||||||
|
|
||||||
static ImageCache * m_instance;
|
|
||||||
|
|
||||||
private: // Instance Data
|
|
||||||
|
|
||||||
|
|
||||||
KeyMap<BString,BBitmap*> m_bitmaps;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __C_ImageCache_H__ */
|
#endif // _IMAGE_CACHE_H
|
||||||
|
|
|
@ -40,7 +40,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProtocolManager();
|
ProtocolManager();
|
||||||
void _GetAccounts(CayaProtocolAddOn* addOn, BHandler* target);
|
void _GetAccounts(CayaProtocolAddOn* addOn,
|
||||||
|
BHandler* target);
|
||||||
|
|
||||||
AddOnMap fAddOnMap;
|
AddOnMap fAddOnMap;
|
||||||
ProtocolMap fProtocolMap;
|
ProtocolMap fProtocolMap;
|
||||||
|
|
|
@ -30,15 +30,12 @@ public:
|
||||||
|
|
||||||
void Quit();
|
void Quit();
|
||||||
|
|
||||||
void AddProtocolLooper(bigtime_t instanceId, CayaProtocol* cayap);
|
void AddProtocolLooper(bigtime_t instanceId,
|
||||||
|
CayaProtocol* cayap);
|
||||||
void RemoveProtocolLooper(bigtime_t instanceId);
|
void RemoveProtocolLooper(bigtime_t instanceId);
|
||||||
|
|
||||||
void LoginAll();
|
void LoginAll();
|
||||||
|
|
||||||
#if 0
|
|
||||||
void UpdateSettings(BMessage settings);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void SendProtocolMessage(BMessage* msg);
|
void SendProtocolMessage(BMessage* msg);
|
||||||
void SendAllProtocolMessage(BMessage* msg);
|
void SendAllProtocolMessage(BMessage* msg);
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,9 @@ const uint32 kOK = 'save';
|
||||||
|
|
||||||
AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings,
|
AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings,
|
||||||
const char* account)
|
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),
|
fSettings(settings),
|
||||||
fAccount(account),
|
fAccount(account),
|
||||||
fTarget(NULL)
|
fTarget(NULL)
|
||||||
|
|
|
@ -18,7 +18,8 @@ const uint32 kAccountRenamed = 'acrd';
|
||||||
|
|
||||||
class AccountDialog : public BWindow {
|
class AccountDialog : public BWindow {
|
||||||
public:
|
public:
|
||||||
AccountDialog(const char* title, ProtocolSettings* settings,
|
AccountDialog(const char* title,
|
||||||
|
ProtocolSettings* settings,
|
||||||
const char* account = NULL);
|
const char* account = NULL);
|
||||||
|
|
||||||
void SetTarget(BHandler* target);
|
void SetTarget(BHandler* target);
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
#include "ProtocolSettings.h"
|
#include "ProtocolSettings.h"
|
||||||
|
|
||||||
|
|
||||||
AccountListItem::AccountListItem(ProtocolSettings* settings, const char* account)
|
AccountListItem::AccountListItem(ProtocolSettings* settings,
|
||||||
: BStringItem(account),
|
const char* account)
|
||||||
|
:
|
||||||
|
BStringItem(account),
|
||||||
fSettings(settings),
|
fSettings(settings),
|
||||||
fAccount(account),
|
fAccount(account),
|
||||||
fBaselineOffset(0)
|
fBaselineOffset(0)
|
||||||
|
|
|
@ -164,9 +164,6 @@ RosterListView::Draw(BRect updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragama mark -
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RosterListView::Sort()
|
RosterListView::Sort()
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,8 @@ const float kCircle = 12;
|
||||||
|
|
||||||
StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status,
|
StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status,
|
||||||
bool custom, char shortcut, uint32 modifiers)
|
bool custom, char shortcut, uint32 modifiers)
|
||||||
: BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
|
:
|
||||||
|
BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
|
||||||
fStatus(status),
|
fStatus(status),
|
||||||
fCustom(custom)
|
fCustom(custom)
|
||||||
{
|
{
|
||||||
|
|
Ŝarĝante…
Reference in New Issue