Moved the freind remove code out of the floater so it works even when it is closed.

LGG@LGG-LAPPY 2011-10-19 03:02:03 -05:00
parent 466364f265
commit 1b8bf9fd3a
3 changed files with 24 additions and 14 deletions

View File

@ -33,10 +33,12 @@ LGGContactSets::LGGContactSets()
{
sInstance = this;
sInstance->loadFromDisk();
LLAvatarTracker::instance().addObserver(this);
}
LGGContactSets::~LGGContactSets()
{
LLAvatarTracker::instance().removeObserver(sInstance);
sInstance = NULL;
}
@ -49,6 +51,21 @@ LGGContactSets* LGGContactSets::getInstance()
return sInstance;
}
}
void LGGContactSets::changed(U32 mask)
{
if(mask & (LLFriendObserver::REMOVE))
{
const std::set<LLUUID>& changed_items = LLAvatarTracker::instance().getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
for (;id_it != id_end; ++id_it)
{
//if we are fortunate enough to be the viewer of choice when
//someone removes a friend, go and clean up the contact sets
LGGContactSets::getInstance()->removeFriendFromAllGroups(*id_it);
}
}
}
LLColor4 LGGContactSets::toneDownColor(LLColor4 inColor, float strength, bool usedForBackground)
{
if(usedForBackground)

View File

@ -1,4 +1,3 @@
#include "v4color.h"
/* Copyright (C) 2011 Greg Hendrickson (LordGregGreg Back)
This is free software; you can redistribute it and/or modify it
@ -19,13 +18,19 @@
#ifndef LGG_FRIENDS_GROUPS_H
#define LGG_FRIENDS_GROUPS_H
class LGGContactSets
#include "v4color.h"
//#include "llcallingcard.h"
class LGGContactSets//: public LLFriendObserver
{
LGGContactSets();
~LGGContactSets();
static LGGContactSets* sInstance;
public:
static LGGContactSets* getInstance();
virtual void changed(U32 mask);
static LLColor4 toneDownColor(LLColor4 inColor, float strength, bool usedForBackground=FALSE);
BOOL saveGroupToDisk(std::string groupName, std::string fileName);

View File

@ -172,18 +172,6 @@ void lggContactSetsFloater::processProperties(void* data, EAvatarProcessorType t
void lggContactSetsFloater::changed(U32 mask)
{
if(mask & (LLFriendObserver::REMOVE))
{
const std::set<LLUUID>& changed_items = LLAvatarTracker::instance().getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
for (;id_it != id_end; ++id_it)
{
//if we are fortunate enough to be the viewer of choice when
//someone removes a friend, go and clean up the contact sets
LGGContactSets::getInstance()->removeFriendFromAllGroups(*id_it);
}
}
if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE ))
{
sInstance->generateCurrentList();