Hide implementation details.

This commit is contained in:
plfiorini 2010-05-28 17:11:16 +00:00
parent 5b41b18007
commit af48b464ef
4 changed files with 40 additions and 24 deletions

View File

@ -22,6 +22,7 @@ public:
const char* Path() const;
CayaProtocol* Protocol() const;
const char* Signature() const;
const char* FriendlySignature() const;
BBitmap* Icon() const;

View File

@ -62,24 +62,17 @@ ProtocolManager::Get()
}
ProtocolAddOns
ProtocolManager::Protocols()
uint32
ProtocolManager::CountProtocolAddOns() const
{
return fAddOnMap.Values();
return fAddOnMap.CountItems();
}
ProtocolMap
ProtocolManager::ProtocolInstances() const
CayaProtocolAddOn*
ProtocolManager::ProtocolAddOnAt(uint32 i) const
{
return fProtocolMap;
}
CayaProtocol*
ProtocolManager::ProtocolInstance(bigtime_t identifier)
{
return fProtocolMap.ValueFor(identifier);
return fAddOnMap.ValueAt(i);
}
@ -90,6 +83,27 @@ ProtocolManager::ProtocolAddOn(const char* signature)
}
uint32
ProtocolManager::CountProtocolInstances() const
{
return fProtocolMap.CountItems();
}
CayaProtocol*
ProtocolManager::ProtocolInstanceAt(uint32 i) const
{
return fProtocolMap.ValueAt(i);
}
CayaProtocol*
ProtocolManager::ProtocolInstance(bigtime_t identifier)
{
return fProtocolMap.ValueFor(identifier);
}
void
ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account,
BHandler* target)

View File

@ -18,27 +18,28 @@ class BBitmap;
class BDirectory;
class BHandler;
typedef List<CayaProtocolAddOn*> ProtocolAddOns;
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
class ProtocolManager {
public:
void Init(BDirectory dir, BHandler* target);
static ProtocolManager* Get();
ProtocolAddOns Protocols();
ProtocolMap ProtocolInstances() const;
CayaProtocol* ProtocolInstance(bigtime_t identifier);
uint32 CountProtocolAddOns() const;
CayaProtocolAddOn* ProtocolAddOnAt(uint32 i) const;
CayaProtocolAddOn* ProtocolAddOn(const char* signature);
uint32 CountProtocolInstances() const;
CayaProtocol* ProtocolInstanceAt(uint32 i) const;
CayaProtocol* ProtocolInstance(bigtime_t identifier);
void AddAccount(CayaProtocolAddOn* addOn,
const char* account,
BHandler* target);
private:
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
ProtocolManager();
void _GetAccounts(CayaProtocolAddOn* addOn,
BHandler* target);

View File

@ -52,11 +52,11 @@ PreferencesAccounts::PreferencesAccounts()
BScrollView* scrollView = new BScrollView("scrollView", fListView,
B_WILL_DRAW, false, true);
ProtocolAddOns addOns = ProtocolManager::Get()->Protocols();
ProtocolManager* pm = ProtocolManager::Get();
fProtosMenu = new BPopUpMenu(NULL, true);
for (uint32 i = 0; i < addOns.CountItems(); i++) {
CayaProtocolAddOn* addOn = addOns.ItemAt(i);
for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) {
CayaProtocolAddOn* addOn = pm->ProtocolAddOnAt(i);
ProtocolSettings* settings = new ProtocolSettings(addOn);
// Add accounts to list view