Compliance fixes
This commit is contained in:
@@ -8,18 +8,7 @@
|
|||||||
* ALL SOURCE CODE IS PROVIDED "AS IS." THE CREATOR MAKES NO
|
* ALL SOURCE CODE IS PROVIDED "AS IS." THE CREATOR MAKES NO
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
*
|
|
||||||
* HACKERS CAN TURN YOUR COMPUTER INTO A BOMB.
|
|
||||||
* & BLOW YOUR FAMILY TO SMITHEREENS!
|
|
||||||
*
|
|
||||||
* \ . ./
|
|
||||||
* \ .:";'.:.." /
|
|
||||||
* (M^^.^~~:.'").
|
|
||||||
* - (/ . . . \ \) -
|
|
||||||
* ((| :. ~ ^ :. .|))
|
|
||||||
* - (\- | \ / | /) -
|
|
||||||
* T -\ \ / /-
|
|
||||||
* [_]..........................\ \ / /
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -59,11 +48,13 @@
|
|||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
#include "llsdserialize.h"
|
#include "llsdserialize.h"
|
||||||
|
#include "lldarray.h"
|
||||||
|
#include "llfile.h"
|
||||||
#include "llchat.h"
|
#include "llchat.h"
|
||||||
#include "llfloaterchat.h"
|
#include "llfloaterchat.h"
|
||||||
|
|
||||||
ASFloaterContactGroups* ASFloaterContactGroups::sInstance = NULL;
|
ASFloaterContactGroups* ASFloaterContactGroups::sInstance = NULL;
|
||||||
|
LLDynamicArray<LLUUID> ASFloaterContactGroups::mSelectedUUIDs;
|
||||||
|
|
||||||
ASFloaterContactGroups::ASFloaterContactGroups()
|
ASFloaterContactGroups::ASFloaterContactGroups()
|
||||||
: LLFloater(std::string("floater_contact_groups"), std::string("FloaterContactRect"), LLStringUtil::null)
|
: LLFloater(std::string("floater_contact_groups"), std::string("FloaterContactRect"), LLStringUtil::null)
|
||||||
@@ -72,13 +63,90 @@ ASFloaterContactGroups::ASFloaterContactGroups()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void ASFloaterContactGroups::show(void*)
|
void ASFloaterContactGroups::show(LLDynamicArray<LLUUID> ids)
|
||||||
{
|
{
|
||||||
if (!sInstance)
|
if (!sInstance)
|
||||||
sInstance = new ASFloaterContactGroups();
|
sInstance = new ASFloaterContactGroups();
|
||||||
|
|
||||||
|
mSelectedUUIDs = ids;
|
||||||
|
|
||||||
sInstance->open();
|
sInstance->open();
|
||||||
sInstance->populateGroupList();
|
sInstance->populateGroupList();
|
||||||
|
sInstance->populateFriendList();
|
||||||
|
|
||||||
|
sInstance->childSetAction("Cancel", onBtnClose, sInstance);
|
||||||
|
sInstance->childSetAction("Save", onBtnSave, sInstance);
|
||||||
|
sInstance->childSetAction("Create", onBtnCreate, sInstance);
|
||||||
|
sInstance->childSetAction("Delete", onBtnDelete, sInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::onBtnDelete(void* userdata)
|
||||||
|
{
|
||||||
|
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
|
||||||
|
|
||||||
|
if(self)
|
||||||
|
{
|
||||||
|
LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("group_scroll_list");
|
||||||
|
if(scroller != NULL)
|
||||||
|
{
|
||||||
|
self->deleteContactGroup(scroller->getValue().asString());
|
||||||
|
self->populateGroupList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::onBtnSave(void* userdata)
|
||||||
|
{
|
||||||
|
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
|
||||||
|
|
||||||
|
if(self)
|
||||||
|
{
|
||||||
|
if (self->mSelectedUUIDs.count() > 0)
|
||||||
|
{
|
||||||
|
LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("group_scroll_list");
|
||||||
|
if(scroller != NULL)
|
||||||
|
{
|
||||||
|
for (S32 i = self->mSelectedUUIDs.count(); i > 0; --i)
|
||||||
|
{
|
||||||
|
self->addContactMember(scroller->getValue().asString(), self->mSelectedUUIDs.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::onBtnClose(void* userdata)
|
||||||
|
{
|
||||||
|
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
|
||||||
|
if(self) self->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::onBtnCreate(void* userdata)
|
||||||
|
{
|
||||||
|
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
|
||||||
|
if(self)
|
||||||
|
{
|
||||||
|
LLLineEditor* editor = self->getChild<LLLineEditor>("add_group_lineedit");
|
||||||
|
if (editor)
|
||||||
|
{
|
||||||
|
LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("friend_scroll_list");
|
||||||
|
if(scroller != NULL)
|
||||||
|
{
|
||||||
|
self->createContactGroup(editor->getValue().asString());
|
||||||
|
self->populateGroupList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLChat msg("Null editor");
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLChat msg("Null floater");
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASFloaterContactGroups::~ASFloaterContactGroups()
|
ASFloaterContactGroups::~ASFloaterContactGroups()
|
||||||
@@ -86,43 +154,144 @@ ASFloaterContactGroups::~ASFloaterContactGroups()
|
|||||||
sInstance=NULL;
|
sInstance=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::populateFriendList()
|
||||||
|
{
|
||||||
|
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("friend_scroll_list");
|
||||||
|
if(scroller != NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ASFloaterContactGroups::cleanFileName(std::string filename)
|
||||||
|
{
|
||||||
|
std::string invalidChars = "\"\'\\/?*:<>| ";
|
||||||
|
S32 position = filename.find_first_of(invalidChars);
|
||||||
|
while (position != filename.npos)
|
||||||
|
{
|
||||||
|
filename[position] = '_';
|
||||||
|
position = filename.find_first_of(invalidChars, position);
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::addContactMember(std::string contact_grp, LLUUID to_add)
|
||||||
|
{
|
||||||
|
std::string clean_contact_grp = cleanFileName(contact_grp);
|
||||||
|
std::string member_string = "Ascent." + clean_contact_grp + ".Members";
|
||||||
|
|
||||||
|
if (!gSavedSettings.controlExists(member_string))
|
||||||
|
gSavedSettings.declareString(member_string, to_add.asString(), "Stores UUIDs of members for " + clean_contact_grp, TRUE);
|
||||||
|
else
|
||||||
|
gSavedSettings.setString(member_string, gSavedSettings.getString(member_string) + " " + to_add.asString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::deleteContactGroup(std::string contact_grp)
|
||||||
|
{
|
||||||
|
std::string clean_contact_grp = cleanFileName(contact_grp);
|
||||||
|
std::string display_string = "Ascent." + clean_contact_grp + ".Display";
|
||||||
|
gSavedSettings.setString(display_string, "##DELETED##");
|
||||||
|
|
||||||
|
std::string group_list(gSavedSettings.getString("AscentContactGroups"));
|
||||||
|
|
||||||
|
if (group_list.find(clean_contact_grp) != group_list.npos)
|
||||||
|
{
|
||||||
|
gSavedSettings.setString(
|
||||||
|
"AscentContactGroups",
|
||||||
|
group_list.erase(
|
||||||
|
group_list.find_first_of(clean_contact_grp),
|
||||||
|
clean_contact_grp.length()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASFloaterContactGroups::createContactGroup(std::string contact_grp)
|
||||||
|
{
|
||||||
|
std::string clean_contact_grp = cleanFileName(contact_grp);
|
||||||
|
std::string display_string = "Ascent." + clean_contact_grp + ".Display";
|
||||||
|
std::string member_string = "Ascent." + clean_contact_grp + ".Members";
|
||||||
|
|
||||||
|
if (gSavedSettings.controlExists(display_string))
|
||||||
|
{
|
||||||
|
std::string s_display = gSavedSettings.getString(display_string);
|
||||||
|
if (s_display != "##DELETED##")
|
||||||
|
{
|
||||||
|
LLChat msg("Can't create duplicate group names.");
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gSavedSettings.declareString(member_string, "NULL_KEY", "Stores UUIDs of members for " + clean_contact_grp, TRUE);
|
||||||
|
gSavedSettings.declareString(display_string, contact_grp, "Stores the real name of " + clean_contact_grp, TRUE);
|
||||||
|
|
||||||
|
gSavedSettings.setString(display_string, contact_grp);
|
||||||
|
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
|
||||||
|
|
||||||
|
gSavedSettings.setString(member_string, "NULL_KEY");
|
||||||
|
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
|
||||||
|
|
||||||
|
if (!gSavedSettings.controlExists("AscentContactGroups"))
|
||||||
|
{
|
||||||
|
gSavedSettings.declareString("AscentContactGroups", clean_contact_grp, "Stores titles of all Contact Groups", TRUE);
|
||||||
|
gSavedSettings.setString("AscentContactGroups", clean_contact_grp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string group_list(gSavedSettings.getString("AscentContactGroups"));
|
||||||
|
group_list += " " + clean_contact_grp;
|
||||||
|
gSavedSettings.setString("AscentContactGroups", group_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StringSplit(std::string str, std::string delim, std::vector<std::string> results)
|
||||||
|
{
|
||||||
|
int cutAt;
|
||||||
|
while((cutAt = str.find_first_of(delim)) != str.npos)
|
||||||
|
{
|
||||||
|
if(cutAt > 0)
|
||||||
|
{
|
||||||
|
results.push_back(str.substr(0,cutAt));
|
||||||
|
}
|
||||||
|
str = str.substr(cutAt+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(str.length() > 0)
|
||||||
|
{
|
||||||
|
results.push_back(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ASFloaterContactGroups::populateGroupList()
|
void ASFloaterContactGroups::populateGroupList()
|
||||||
{
|
{
|
||||||
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("group_scroll_list");
|
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("group_scroll_list");
|
||||||
if(scroller != NULL)
|
if(scroller != NULL)
|
||||||
{
|
{
|
||||||
std::string name;
|
scroller->deleteAllItems();
|
||||||
|
|
||||||
gDirUtilp->getNextFileInDir(gDirUtilp->getPerAccountChatLogsDir(),"*",name,false);//stupid hack to clear last file search
|
if (gSavedSettings.controlExists("AscentContactGroups"))
|
||||||
scroller->clear();
|
|
||||||
|
|
||||||
std::string path_name(gDirUtilp->getPerAccountChatLogsDir() + gDirUtilp->getDirDelimiter());
|
|
||||||
S32 count = gDirUtilp->countFilesInDir(path_name, "*.grp");
|
|
||||||
bool found = true;
|
|
||||||
LLChat msg(count + " total files in folder " + path_name);
|
|
||||||
LLFloaterChat::addChat(msg);
|
|
||||||
while(found = gDirUtilp->getNextFileInDir(path_name, "*.grp", name, false))
|
|
||||||
{
|
{
|
||||||
if ((name == ".") || (name == "..")) continue;
|
scroller->addSimpleElement(gSavedSettings.getString("AscentContactGroups"), ADD_BOTTOM);
|
||||||
|
/**
|
||||||
|
std::vector<std::string> group_list;
|
||||||
|
StringSplit(gSavedSettings.getString("AscentContactGroups"), " ", group_list);
|
||||||
|
|
||||||
//llinfos << "path name " << path_name << " and name " << name << " and found " << found << llendl;
|
for (S32 i=0; i < group_list.size(); i++)
|
||||||
if(found)
|
|
||||||
{
|
{
|
||||||
LLChat msg("Found: " + name);
|
scroller->addSimpleElement(group_list[i], ADD_BOTTOM);
|
||||||
LLFloaterChat::addChat(msg);
|
LLChat msg("Add " + group_list[i]);
|
||||||
scroller->addSimpleElement(name.substr(0, -4), ADD_BOTTOM);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LLChat msg("Skipped: " + name);
|
|
||||||
LLFloaterChat::addChat(msg);
|
LLFloaterChat::addChat(msg);
|
||||||
}
|
}
|
||||||
|
**/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLChat msg("Null Scroller");
|
LLChat msg("Null Scroller");
|
||||||
LLFloaterChat::addChat(msg);
|
LLFloaterChat::addChat(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#define ASCENT_CONTACT_GROUPS
|
#define ASCENT_CONTACT_GROUPS
|
||||||
|
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
#include "lldarray.h"
|
||||||
|
|
||||||
class LLScrollListCtrl;
|
class LLScrollListCtrl;
|
||||||
|
|
||||||
@@ -27,15 +28,28 @@ public:
|
|||||||
virtual ~ASFloaterContactGroups();
|
virtual ~ASFloaterContactGroups();
|
||||||
|
|
||||||
// by convention, this shows the floater and does instance management
|
// by convention, this shows the floater and does instance management
|
||||||
static void show(void*);
|
static void show(LLDynamicArray<LLUUID> ids);
|
||||||
|
static std::string cleanFileName(std::string filename);
|
||||||
|
|
||||||
void populateGroupList();
|
void populateGroupList();
|
||||||
|
void populateFriendList();
|
||||||
|
void addContactMember(std::string contact_grp, LLUUID to_add);
|
||||||
|
void createContactGroup(std::string contact_grp);
|
||||||
|
void deleteContactGroup(std::string contact_grp);
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
static void onBtnClose(void* userdata);
|
||||||
|
static void onBtnSave(void* userdata);
|
||||||
|
static void onBtnCreate(void* userdata);
|
||||||
|
static void onBtnDelete(void* userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//assuming we just need one, which is typical
|
//assuming we just need one, which is typical
|
||||||
static ASFloaterContactGroups* sInstance;
|
static ASFloaterContactGroups* sInstance;
|
||||||
|
static LLDynamicArray<LLUUID> mSelectedUUIDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ASCENT_UPLOAD_BROWSER
|
#endif // ASCENT_CONTACT_GROUPS
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -201,6 +201,84 @@ void LLPanelFriends::updateFriends(U32 changed_mask)
|
|||||||
// <dogmode>
|
// <dogmode>
|
||||||
// Contact search and group system.
|
// Contact search and group system.
|
||||||
// 09/05/2010 - Charley Levenque
|
// 09/05/2010 - Charley Levenque
|
||||||
|
std::string LLPanelFriends::cleanFileName(std::string filename)
|
||||||
|
{
|
||||||
|
std::string invalidChars = "\"\'\\/?*:<>|";
|
||||||
|
S32 position = filename.find_first_of(invalidChars);
|
||||||
|
while (position != filename.npos)
|
||||||
|
{
|
||||||
|
filename[position] = '_';
|
||||||
|
position = filename.find_first_of(invalidChars, position);
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPanelFriends::populateContactGroupSelect()
|
||||||
|
{
|
||||||
|
LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
|
||||||
|
|
||||||
|
if (combo)
|
||||||
|
{
|
||||||
|
combo->removeall();
|
||||||
|
combo->add("All", ADD_BOTTOM);
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
gDirUtilp->getNextFileInDir(gDirUtilp->getPerAccountChatLogsDir(),"*",name,false);//stupid hack to clear last file search
|
||||||
|
|
||||||
|
std::string path_name(gDirUtilp->getPerAccountChatLogsDir() + gDirUtilp->getDirDelimiter());
|
||||||
|
bool found = true;
|
||||||
|
while(found = gDirUtilp->getNextFileInDir(path_name, "*.grp", name, false))
|
||||||
|
{
|
||||||
|
if ((name == ".") || (name == "..")) continue;
|
||||||
|
|
||||||
|
//llinfos << "path name " << path_name << " and name " << name << " and found " << found << llendl;
|
||||||
|
if(found)
|
||||||
|
{
|
||||||
|
S32 periodIndex = name.find_last_of(".");
|
||||||
|
name = name.substr(0, periodIndex);
|
||||||
|
|
||||||
|
if ((name == ".") || (name == "..")) continue;
|
||||||
|
|
||||||
|
combo->add(name, ADD_BOTTOM);
|
||||||
|
LLChat msg("Combo Add " + name);
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLChat msg("Null combo");
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPanelFriends::setContactGroup(std::string contact_grp)
|
||||||
|
{
|
||||||
|
std::string group_path = gDirUtilp->getPerAccountChatLogsDir() + gDirUtilp->getDirDelimiter();
|
||||||
|
std::string filename = group_path + cleanFileName(contact_grp + ".grp");
|
||||||
|
|
||||||
|
FILE* fp = LLFile::fopen(filename, "w");
|
||||||
|
|
||||||
|
if (fp)
|
||||||
|
{
|
||||||
|
char buffer[10000]; /*Flawfinder: ignore*/
|
||||||
|
char *bptr;
|
||||||
|
S32 len = 0;
|
||||||
|
|
||||||
|
while ( fgets(buffer, 10000, fp) && !feof(fp) )
|
||||||
|
{
|
||||||
|
len = strlen(buffer) - 1; /*Flawfinder: ignore*/
|
||||||
|
for ( bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string file_contents(buffer);
|
||||||
|
mContactFilter = file_contents;
|
||||||
|
|
||||||
|
LLChat msg(mContactFilter);
|
||||||
|
LLFloaterChat::addChat(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LLPanelFriends::filterContacts()
|
void LLPanelFriends::filterContacts()
|
||||||
{
|
{
|
||||||
//LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
|
//LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
|
||||||
@@ -213,15 +291,13 @@ void LLPanelFriends::filterContacts()
|
|||||||
if (search_name != "" && search_name != mLastContactSearch)
|
if (search_name != "" && search_name != mLastContactSearch)
|
||||||
{
|
{
|
||||||
mLastContactSearch = search_name;
|
mLastContactSearch = search_name;
|
||||||
//LLStringUtil::toLower(search_name);
|
|
||||||
refreshNames(LLFriendObserver::ADD);
|
refreshNames(LLFriendObserver::ADD);
|
||||||
|
|
||||||
std::vector<LLScrollListItem*> vFriends = mFriendsList->getAllData(); // all of it.
|
std::vector<LLScrollListItem*> vFriends = mFriendsList->getAllData(); // all of it.
|
||||||
for (std::vector<LLScrollListItem*>::iterator itr = vFriends.begin(); itr != vFriends.end(); ++itr)
|
for (std::vector<LLScrollListItem*>::iterator itr = vFriends.begin(); itr != vFriends.end(); ++itr)
|
||||||
{
|
{
|
||||||
friend_name = (*itr)->getColumn(LIST_FRIEND_NAME)->getValue().asString();
|
friend_name = utf8str_tolower((*itr)->getColumn(LIST_FRIEND_NAME)->getValue().asString());
|
||||||
//LLStringUtil::toLower(friend_name);
|
BOOL show_entry = (friend_name.find(utf8str_tolower(search_name)) != std::string::npos);
|
||||||
BOOL show_entry = (friend_name.find(search_name) != std::string::npos);
|
|
||||||
if (!show_entry)
|
if (!show_entry)
|
||||||
{
|
{
|
||||||
mFriendsList->deleteItems((*itr)->getValue());
|
mFriendsList->deleteItems((*itr)->getValue());
|
||||||
@@ -244,6 +320,20 @@ void LLPanelFriends::onContactSearchKeystroke(LLLineEditor* caller, void* user_d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data)
|
||||||
|
{
|
||||||
|
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||||
|
|
||||||
|
if(panelp)
|
||||||
|
{
|
||||||
|
LLComboBox* combo = panelp->getChild<LLComboBox>("buddy_group_combobox");
|
||||||
|
if (combo->getValue().asString() != "All")
|
||||||
|
{
|
||||||
|
panelp->setContactGroup(combo->getValue().asString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// --
|
// --
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
@@ -254,6 +344,7 @@ BOOL LLPanelFriends::postBuild()
|
|||||||
mFriendsList->setMaximumSelectCallback(onMaximumSelect);
|
mFriendsList->setMaximumSelectCallback(onMaximumSelect);
|
||||||
mFriendsList->setCommitOnSelectionChange(TRUE);
|
mFriendsList->setCommitOnSelectionChange(TRUE);
|
||||||
childSetCommitCallback("friend_list", onSelectName, this);
|
childSetCommitCallback("friend_list", onSelectName, this);
|
||||||
|
childSetCommitCallback("buddy_group_combobox", onChangeContactGroup, this);
|
||||||
childSetDoubleClickCallback("friend_list", onClickIM);
|
childSetDoubleClickCallback("friend_list", onClickIM);
|
||||||
|
|
||||||
// <dogmode>
|
// <dogmode>
|
||||||
@@ -264,7 +355,6 @@ BOOL LLPanelFriends::postBuild()
|
|||||||
{
|
{
|
||||||
contact->setKeystrokeCallback(&onContactSearchKeystroke);
|
contact->setKeystrokeCallback(&onContactSearchKeystroke);
|
||||||
}
|
}
|
||||||
// --
|
|
||||||
|
|
||||||
getChild<LLTextBox>("s_num")->setValue("0");
|
getChild<LLTextBox>("s_num")->setValue("0");
|
||||||
getChild<LLTextBox>("f_num")->setValue(llformat("%d", mFriendsList->getItemCount()));
|
getChild<LLTextBox>("f_num")->setValue(llformat("%d", mFriendsList->getItemCount()));
|
||||||
@@ -608,6 +698,7 @@ BOOL LLPanelFriends::refreshNamesPresence(const LLAvatarTracker::buddy_map_t & a
|
|||||||
// meal disk
|
// meal disk
|
||||||
void LLPanelFriends::refreshUI()
|
void LLPanelFriends::refreshUI()
|
||||||
{
|
{
|
||||||
|
populateContactGroupSelect();
|
||||||
BOOL single_selected = FALSE;
|
BOOL single_selected = FALSE;
|
||||||
BOOL multiple_selected = FALSE;
|
BOOL multiple_selected = FALSE;
|
||||||
int num_selected = mFriendsList->getAllSelected().size();
|
int num_selected = mFriendsList->getAllSelected().size();
|
||||||
@@ -655,7 +746,7 @@ LLDynamicArray<LLUUID> LLPanelFriends::getSelectedIDs()
|
|||||||
return friend_ids;
|
return friend_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data)
|
void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data)
|
||||||
{
|
{
|
||||||
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||||
@@ -695,7 +786,12 @@ void LLPanelFriends::onClickProfile(void* user_data)
|
|||||||
// static
|
// static
|
||||||
void LLPanelFriends::onClickAssign(void* user_data)
|
void LLPanelFriends::onClickAssign(void* user_data)
|
||||||
{
|
{
|
||||||
ASFloaterContactGroups::show(user_data);
|
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||||
|
if (panelp)
|
||||||
|
{
|
||||||
|
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs();
|
||||||
|
ASFloaterContactGroups::show(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelFriends::onClickIM(void* user_data)
|
void LLPanelFriends::onClickIM(void* user_data)
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ private:
|
|||||||
void refreshNames(U32 changed_mask);
|
void refreshNames(U32 changed_mask);
|
||||||
// <dogmode> Contacts search and group system
|
// <dogmode> Contacts search and group system
|
||||||
void filterContacts();
|
void filterContacts();
|
||||||
|
void setContactGroup(std::string contact_grp);
|
||||||
|
void populateContactGroupSelect();
|
||||||
|
std::string cleanFileName(std::string filename);
|
||||||
// --
|
// --
|
||||||
BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies);
|
BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies);
|
||||||
BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies);
|
BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies);
|
||||||
@@ -125,6 +128,7 @@ private:
|
|||||||
|
|
||||||
// callback methods
|
// callback methods
|
||||||
static void onSelectName(LLUICtrl* ctrl, void* user_data);
|
static void onSelectName(LLUICtrl* ctrl, void* user_data);
|
||||||
|
static void onChangeContactGroup(LLUICtrl* ctrl, void* user_data);
|
||||||
static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
|
static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
|
||||||
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
|
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
|
||||||
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data);
|
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data);
|
||||||
@@ -154,6 +158,7 @@ private:
|
|||||||
LLUUID mAddFriendID;
|
LLUUID mAddFriendID;
|
||||||
std::string mAddFriendName;
|
std::string mAddFriendName;
|
||||||
LLScrollListCtrl* mFriendsList;
|
LLScrollListCtrl* mFriendsList;
|
||||||
|
std::string mContactFilter;
|
||||||
BOOL mShowMaxSelectWarning;
|
BOOL mShowMaxSelectWarning;
|
||||||
BOOL mAllowRightsChange;
|
BOOL mAllowRightsChange;
|
||||||
S32 mNumRightsChanged;
|
S32 mNumRightsChanged;
|
||||||
|
|||||||
@@ -70,13 +70,13 @@
|
|||||||
#include "llappviewer.h" // gVFS
|
#include "llappviewer.h" // gVFS
|
||||||
#include "llanimstatelabels.h"
|
#include "llanimstatelabels.h"
|
||||||
#include "llresmgr.h"
|
#include "llresmgr.h"
|
||||||
// <edit>
|
// <edit>
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llpreviewsound.h"
|
#include "llpreviewsound.h"
|
||||||
#include "llpreviewanim.h"
|
#include "llpreviewanim.h"
|
||||||
|
|
||||||
#include "lllocalinventory.h"
|
#include "lllocalinventory.h"
|
||||||
#include "llfilepicker.h"
|
#include "llfilepicker.h"
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
// *TODO: Translate?
|
// *TODO: Translate?
|
||||||
@@ -170,9 +170,9 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID&
|
|||||||
|
|
||||||
// this will call refresh when we have everything.
|
// this will call refresh when we have everything.
|
||||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
|
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
|
||||||
// <edit>
|
// <edit>
|
||||||
//if(item && !item->isComplete())
|
//if(item && !item->isComplete())
|
||||||
if(item && !item->isComplete() && !(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot)))
|
if(item && !item->isComplete() && !(gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot)))
|
||||||
// </edit>
|
// </edit>
|
||||||
{
|
{
|
||||||
LLInventoryGestureAvailable* observer;
|
LLInventoryGestureAvailable* observer;
|
||||||
@@ -229,25 +229,25 @@ BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
|||||||
if (item
|
if (item
|
||||||
&& gInventory.getItem(item->getUUID()))
|
&& gInventory.getItem(item->getUUID()))
|
||||||
{
|
{
|
||||||
// <edit>
|
// <edit>
|
||||||
/*
|
/*
|
||||||
// </edit>
|
// </edit>
|
||||||
LLPermissions perm = item->getPermissions();
|
LLPermissions perm = item->getPermissions();
|
||||||
if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
|
if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
|
||||||
{
|
{
|
||||||
*accept = ACCEPT_NO;
|
*accept = ACCEPT_NO;
|
||||||
if (tooltip_msg.empty())
|
if (tooltip_msg.empty())
|
||||||
{
|
{
|
||||||
tooltip_msg.assign("Only animations and sounds\n"
|
tooltip_msg.assign("Only animations and sounds\n"
|
||||||
"with unrestricted permissions\n"
|
"with unrestricted permissions\n"
|
||||||
"can be added to a gesture.");
|
"can be added to a gesture.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (drop)
|
else if (drop)
|
||||||
// <edit>
|
// <edit>
|
||||||
*/
|
*/
|
||||||
if(drop)
|
if(drop)
|
||||||
// </edit>
|
// </edit>
|
||||||
{
|
{
|
||||||
LLScrollListItem* line = NULL;
|
LLScrollListItem* line = NULL;
|
||||||
@@ -381,9 +381,9 @@ LLPreviewGesture::LLPreviewGesture()
|
|||||||
mSoundCombo(NULL),
|
mSoundCombo(NULL),
|
||||||
mChatEditor(NULL),
|
mChatEditor(NULL),
|
||||||
mSaveBtn(NULL),
|
mSaveBtn(NULL),
|
||||||
// <edit>
|
// <edit>
|
||||||
mDuplicateBtn(NULL),
|
mDuplicateBtn(NULL),
|
||||||
mOpenBtn(NULL),
|
mOpenBtn(NULL),
|
||||||
// </edit>
|
// </edit>
|
||||||
mPreviewBtn(NULL),
|
mPreviewBtn(NULL),
|
||||||
mPreviewGesture(NULL),
|
mPreviewGesture(NULL),
|
||||||
@@ -549,18 +549,6 @@ BOOL LLPreviewGesture::postBuild()
|
|||||||
btn->setCallbackUserData(this);
|
btn->setCallbackUserData(this);
|
||||||
mSaveBtn = btn;
|
mSaveBtn = btn;
|
||||||
|
|
||||||
// <edit>
|
|
||||||
btn = getChild<LLButton>( "duplicate_btn");
|
|
||||||
btn->setClickedCallback(onClickDuplicate);
|
|
||||||
btn->setCallbackUserData(this);
|
|
||||||
mDuplicateBtn = btn;
|
|
||||||
|
|
||||||
btn = getChild<LLButton>( "open_btn");
|
|
||||||
btn->setClickedCallback(onClickOpen);
|
|
||||||
btn->setCallbackUserData(this);
|
|
||||||
mOpenBtn = btn;
|
|
||||||
// </edit>
|
|
||||||
|
|
||||||
btn = getChild<LLButton>( "preview_btn");
|
btn = getChild<LLButton>( "preview_btn");
|
||||||
btn->setClickedCallback(onClickPreview);
|
btn->setClickedCallback(onClickPreview);
|
||||||
btn->setCallbackUserData(this);
|
btn->setCallbackUserData(this);
|
||||||
@@ -640,9 +628,9 @@ void LLPreviewGesture::addAnimations()
|
|||||||
LLViewerInventoryCategory::cat_array_t cats;
|
LLViewerInventoryCategory::cat_array_t cats;
|
||||||
LLViewerInventoryItem::item_array_t items;
|
LLViewerInventoryItem::item_array_t items;
|
||||||
LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION,
|
LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION,
|
||||||
// <edit>
|
// <edit>
|
||||||
// PERM_ITEM_UNRESTRICTED,
|
// PERM_ITEM_UNRESTRICTED,
|
||||||
PERM_NONE,
|
PERM_NONE,
|
||||||
// </edit>
|
// </edit>
|
||||||
gAgent.getID(),
|
gAgent.getID(),
|
||||||
gAgent.getGroupID());
|
gAgent.getGroupID());
|
||||||
@@ -760,21 +748,21 @@ void LLPreviewGesture::refresh()
|
|||||||
mWaitTimeEditor->setEnabled(FALSE);
|
mWaitTimeEditor->setEnabled(FALSE);
|
||||||
mActiveCheck->setEnabled(FALSE);
|
mActiveCheck->setEnabled(FALSE);
|
||||||
mSaveBtn->setEnabled(FALSE);
|
mSaveBtn->setEnabled(FALSE);
|
||||||
// <edit>
|
// <edit>
|
||||||
mDuplicateBtn->setEnabled(TRUE);
|
mDuplicateBtn->setEnabled(TRUE);
|
||||||
mOpenBtn->setEnabled(TRUE);
|
mOpenBtn->setEnabled(TRUE);
|
||||||
mStepList->setEnabled(TRUE);
|
mStepList->setEnabled(TRUE);
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
// Make sure preview button is enabled, so we can stop it
|
// Make sure preview button is enabled, so we can stop it
|
||||||
mPreviewBtn->setEnabled(TRUE);
|
mPreviewBtn->setEnabled(TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
//BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID());
|
//BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID());
|
||||||
BOOL modifiable = TRUE;
|
BOOL modifiable = TRUE;
|
||||||
mOpenBtn->setEnabled(TRUE);
|
mOpenBtn->setEnabled(TRUE);
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
childSetEnabled("desc", modifiable);
|
childSetEnabled("desc", modifiable);
|
||||||
@@ -824,8 +812,8 @@ void LLPreviewGesture::refresh()
|
|||||||
mWaitAnimCheck->setVisible(FALSE);
|
mWaitAnimCheck->setVisible(FALSE);
|
||||||
mWaitTimeCheck->setVisible(FALSE);
|
mWaitTimeCheck->setVisible(FALSE);
|
||||||
mWaitTimeEditor->setVisible(FALSE);
|
mWaitTimeEditor->setVisible(FALSE);
|
||||||
// <edit>
|
// <edit>
|
||||||
mOpenBtn->setVisible(FALSE);
|
mOpenBtn->setVisible(FALSE);
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
std::string optionstext;
|
std::string optionstext;
|
||||||
@@ -846,8 +834,8 @@ void LLPreviewGesture::refresh()
|
|||||||
mAnimationRadio->setVisible(TRUE);
|
mAnimationRadio->setVisible(TRUE);
|
||||||
mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
|
mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
|
||||||
mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID);
|
mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID);
|
||||||
// <edit>
|
// <edit>
|
||||||
mOpenBtn->setVisible(TRUE);
|
mOpenBtn->setVisible(TRUE);
|
||||||
// </edit>
|
// </edit>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -857,8 +845,8 @@ void LLPreviewGesture::refresh()
|
|||||||
optionstext = getString("step_sound");
|
optionstext = getString("step_sound");
|
||||||
mSoundCombo->setVisible(TRUE);
|
mSoundCombo->setVisible(TRUE);
|
||||||
mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
|
mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
|
||||||
// <edit>
|
// <edit>
|
||||||
mOpenBtn->setVisible(TRUE);
|
mOpenBtn->setVisible(TRUE);
|
||||||
// </edit>
|
// </edit>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1171,9 +1159,9 @@ void LLPreviewGesture::saveIfNeeded()
|
|||||||
|
|
||||||
BOOL ok = gesture->serialize(dp);
|
BOOL ok = gesture->serialize(dp);
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
//if (dp.getCurrentSize() > 1000)
|
//if (dp.getCurrentSize() > 1000)
|
||||||
if(0)
|
if(0)
|
||||||
// </edit>
|
// </edit>
|
||||||
{
|
{
|
||||||
LLNotifications::instance().add("GestureSaveFailedTooManySteps");
|
LLNotifications::instance().add("GestureSaveFailedTooManySteps");
|
||||||
@@ -1273,61 +1261,61 @@ void LLPreviewGesture::saveIfNeeded()
|
|||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
void LLPreviewGesture::saveDuplicate()
|
void LLPreviewGesture::saveDuplicate()
|
||||||
{
|
{
|
||||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(mItemUUID);
|
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(mItemUUID);
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
create_inventory_item( gAgent.getID(),
|
create_inventory_item( gAgent.getID(),
|
||||||
gAgent.getSessionID(),
|
gAgent.getSessionID(),
|
||||||
item->getParentUUID(),
|
item->getParentUUID(),
|
||||||
LLTransactionID::tnull,
|
LLTransactionID::tnull,
|
||||||
item->getName(),
|
item->getName(),
|
||||||
item->getUUID().asString(),
|
item->getUUID().asString(),
|
||||||
item->getType(),
|
item->getType(),
|
||||||
item->getInventoryType(),
|
item->getInventoryType(),
|
||||||
NOT_WEARABLE,
|
NOT_WEARABLE,
|
||||||
PERM_ITEM_UNRESTRICTED,
|
PERM_ITEM_UNRESTRICTED,
|
||||||
new LLPreviewGesture::GestureItemForDuplicateCallback);
|
new LLPreviewGesture::GestureItemForDuplicateCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPreviewGesture::GestureItemForDuplicateCallback::fire(const LLUUID& new_item_id)
|
void LLPreviewGesture::GestureItemForDuplicateCallback::fire(const LLUUID& new_item_id)
|
||||||
{
|
{
|
||||||
LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)gInventory.getItem(new_item_id);
|
LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)gInventory.getItem(new_item_id);
|
||||||
LLUUID old_item_id = LLUUID(new_item->getDescription());
|
LLUUID old_item_id = LLUUID(new_item->getDescription());
|
||||||
if(old_item_id.isNull()) return;
|
if(old_item_id.isNull()) return;
|
||||||
LLViewerInventoryItem* old_item = (LLViewerInventoryItem*)gInventory.getItem(old_item_id);
|
LLViewerInventoryItem* old_item = (LLViewerInventoryItem*)gInventory.getItem(old_item_id);
|
||||||
if(!old_item) return;
|
if(!old_item) return;
|
||||||
new_item->setDescription(old_item->getDescription());
|
new_item->setDescription(old_item->getDescription());
|
||||||
new_item->updateServer(FALSE);
|
new_item->updateServer(FALSE);
|
||||||
gInventory.updateItem(new_item);
|
gInventory.updateItem(new_item);
|
||||||
gInventory.notifyObservers();
|
gInventory.notifyObservers();
|
||||||
LLPreviewGesture* preview = (LLPreviewGesture*)LLPreview::find(old_item_id);
|
LLPreviewGesture* preview = (LLPreviewGesture*)LLPreview::find(old_item_id);
|
||||||
if(!preview) return;
|
if(!preview) return;
|
||||||
LLMultiGesture* gesture = preview->createGesture();
|
LLMultiGesture* gesture = preview->createGesture();
|
||||||
S32 max_size = gesture->getMaxSerialSize();
|
S32 max_size = gesture->getMaxSerialSize();
|
||||||
char* buffer = new char[max_size];
|
char* buffer = new char[max_size];
|
||||||
LLDataPackerAsciiBuffer dp(buffer, max_size);
|
LLDataPackerAsciiBuffer dp(buffer, max_size);
|
||||||
BOOL ok = gesture->serialize(dp);
|
BOOL ok = gesture->serialize(dp);
|
||||||
if(!ok) return;
|
if(!ok) return;
|
||||||
LLTransactionID tid;
|
LLTransactionID tid;
|
||||||
LLAssetID asset_id;
|
LLAssetID asset_id;
|
||||||
tid.generate();
|
tid.generate();
|
||||||
asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
|
asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||||
LLVFile file(gVFS, asset_id, LLAssetType::AT_GESTURE, LLVFile::APPEND);
|
LLVFile file(gVFS, asset_id, LLAssetType::AT_GESTURE, LLVFile::APPEND);
|
||||||
S32 size = dp.getCurrentSize();
|
S32 size = dp.getCurrentSize();
|
||||||
file.setMaxSize(size);
|
file.setMaxSize(size);
|
||||||
file.write((U8*)buffer, size);
|
file.write((U8*)buffer, size);
|
||||||
|
|
||||||
std::string agent_url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
std::string agent_url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||||
if(agent_url.empty()) return;
|
if(agent_url.empty()) return;
|
||||||
LLSD body;
|
LLSD body;
|
||||||
body["item_id"] = new_item_id;
|
body["item_id"] = new_item_id;
|
||||||
LLHTTPClient::post(agent_url, body,
|
LLHTTPClient::post(agent_url, body,
|
||||||
new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_GESTURE));
|
new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_GESTURE));
|
||||||
}
|
}
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
// TODO: This is very similar to LLPreviewNotecard::onSaveComplete.
|
// TODO: This is very similar to LLPreviewNotecard::onSaveComplete.
|
||||||
@@ -1400,57 +1388,57 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data,
|
|||||||
info = NULL;
|
info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
void LLPreviewGesture::onSaveDuplicateComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
|
void LLPreviewGesture::onSaveDuplicateComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
|
||||||
{
|
{
|
||||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||||
if (info && (status == 0))
|
if (info && (status == 0))
|
||||||
{
|
{
|
||||||
std::string item_name = "New Gesture";
|
std::string item_name = "New Gesture";
|
||||||
std::string item_desc = "";
|
std::string item_desc = "";
|
||||||
// Saving into user inventory
|
// Saving into user inventory
|
||||||
LLViewerInventoryItem* item;
|
LLViewerInventoryItem* item;
|
||||||
item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
|
item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
item_name = item->getName();
|
item_name = item->getName();
|
||||||
item_desc = item->getDescription();
|
item_desc = item->getDescription();
|
||||||
}
|
}
|
||||||
gMessageSystem->newMessageFast(_PREHASH_CreateInventoryItem);
|
gMessageSystem->newMessageFast(_PREHASH_CreateInventoryItem);
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_InventoryBlock);
|
gMessageSystem->nextBlockFast(_PREHASH_InventoryBlock);
|
||||||
gMessageSystem->addU32Fast(_PREHASH_CallbackID, 0);
|
gMessageSystem->addU32Fast(_PREHASH_CallbackID, 0);
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_FolderID, LLUUID::null);
|
gMessageSystem->addUUIDFast(_PREHASH_FolderID, LLUUID::null);
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_TransactionID, info->mTransactionID);
|
gMessageSystem->addUUIDFast(_PREHASH_TransactionID, info->mTransactionID);
|
||||||
gMessageSystem->addU32Fast(_PREHASH_NextOwnerMask, 2147483647);
|
gMessageSystem->addU32Fast(_PREHASH_NextOwnerMask, 2147483647);
|
||||||
gMessageSystem->addS8Fast(_PREHASH_Type, 21);
|
gMessageSystem->addS8Fast(_PREHASH_Type, 21);
|
||||||
gMessageSystem->addS8Fast(_PREHASH_InvType, 20);
|
gMessageSystem->addS8Fast(_PREHASH_InvType, 20);
|
||||||
gMessageSystem->addU8Fast(_PREHASH_WearableType, 0);
|
gMessageSystem->addU8Fast(_PREHASH_WearableType, 0);
|
||||||
gMessageSystem->addStringFast(_PREHASH_Name, item_name);
|
gMessageSystem->addStringFast(_PREHASH_Name, item_name);
|
||||||
gMessageSystem->addStringFast(_PREHASH_Description, item_desc);
|
gMessageSystem->addStringFast(_PREHASH_Description, item_desc);
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
|
|
||||||
// Find our window and close it if requested.
|
// Find our window and close it if requested.
|
||||||
/*
|
/*
|
||||||
LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(info->mItemUUID);
|
LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(info->mItemUUID);
|
||||||
if (previewp && previewp->mCloseAfterSave)
|
if (previewp && previewp->mCloseAfterSave)
|
||||||
{
|
{
|
||||||
previewp->close();
|
previewp->close();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llwarns << "Problem saving gesture: " << status << llendl;
|
llwarns << "Problem saving gesture: " << status << llendl;
|
||||||
LLSD args;
|
LLSD args;
|
||||||
args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
|
args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
|
||||||
LLNotifications::instance().add("GestureSaveFailedReason", args);
|
LLNotifications::instance().add("GestureSaveFailedReason", args);
|
||||||
}
|
}
|
||||||
delete info;
|
delete info;
|
||||||
info = NULL;
|
info = NULL;
|
||||||
}
|
}
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
LLMultiGesture* LLPreviewGesture::createGesture()
|
LLMultiGesture* LLPreviewGesture::createGesture()
|
||||||
@@ -1905,34 +1893,34 @@ void LLPreviewGesture::onClickSave(void* data)
|
|||||||
self->saveIfNeeded();
|
self->saveIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
// static
|
// static
|
||||||
void LLPreviewGesture::onClickDuplicate(void* data)
|
void LLPreviewGesture::onClickDuplicate(void* data)
|
||||||
{
|
{
|
||||||
LLPreviewGesture* self = (LLPreviewGesture*)data;
|
LLPreviewGesture* self = (LLPreviewGesture*)data;
|
||||||
self->saveDuplicate();
|
self->saveDuplicate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLPreviewGesture::onClickOpen(void* data)
|
void LLPreviewGesture::onClickOpen(void* data)
|
||||||
{
|
{
|
||||||
LLPreviewGesture* self = (LLPreviewGesture*)data;
|
LLPreviewGesture* self = (LLPreviewGesture*)data;
|
||||||
|
|
||||||
LLScrollListItem* step_item = self->mStepList->getFirstSelected();
|
LLScrollListItem* step_item = self->mStepList->getFirstSelected();
|
||||||
if (!step_item) return;
|
if (!step_item) return;
|
||||||
|
|
||||||
LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
|
LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
|
||||||
if (step->getType() == STEP_SOUND)
|
if (step->getType() == STEP_SOUND)
|
||||||
{
|
{
|
||||||
LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
|
LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
|
||||||
LLLocalInventory::addItem(sound_step->mSoundName, (int)LLAssetType::AT_SOUND, sound_step->mSoundAssetID, true);
|
LLLocalInventory::addItem(sound_step->mSoundName, (int)LLAssetType::AT_SOUND, sound_step->mSoundAssetID, true);
|
||||||
}
|
}
|
||||||
else if (step->getType() == STEP_ANIMATION)
|
else if (step->getType() == STEP_ANIMATION)
|
||||||
{
|
{
|
||||||
LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
|
LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
|
||||||
LLLocalInventory::addItem(anim_step->mAnimName, (int)LLAssetType::AT_ANIMATION, anim_step->mAnimAssetID, true);
|
LLLocalInventory::addItem(anim_step->mAnimName, (int)LLAssetType::AT_ANIMATION, anim_step->mAnimAssetID, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -1980,63 +1968,63 @@ void LLPreviewGesture::onDonePreview(LLMultiGesture* gesture, void* data)
|
|||||||
self->refresh();
|
self->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
// virtual
|
// virtual
|
||||||
BOOL LLPreviewGesture::canSaveAs() const
|
BOOL LLPreviewGesture::canSaveAs() const
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void LLPreviewGesture::saveAs()
|
void LLPreviewGesture::saveAs()
|
||||||
{
|
{
|
||||||
std::string default_filename("untitled.gesture");
|
std::string default_filename("untitled.gesture");
|
||||||
const LLInventoryItem *item = getItem();
|
const LLInventoryItem *item = getItem();
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
default_filename = LLDir::getScrubbedFileName(item->getName());
|
default_filename = LLDir::getScrubbedFileName(item->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
LLFilePicker& file_picker = LLFilePicker::instance();
|
LLFilePicker& file_picker = LLFilePicker::instance();
|
||||||
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_GESTURE, default_filename ) )
|
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_GESTURE, default_filename ) )
|
||||||
{
|
{
|
||||||
// User canceled or we failed to acquire save file.
|
// User canceled or we failed to acquire save file.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// remember the user-approved/edited file name.
|
// remember the user-approved/edited file name.
|
||||||
std::string filename = file_picker.getFirstFile();
|
std::string filename = file_picker.getFirstFile();
|
||||||
|
|
||||||
// Copy the UI into a gesture
|
// Copy the UI into a gesture
|
||||||
LLMultiGesture* gesture = createGesture();
|
LLMultiGesture* gesture = createGesture();
|
||||||
|
|
||||||
// Serialize the gesture
|
// Serialize the gesture
|
||||||
S32 max_size = gesture->getMaxSerialSize();
|
S32 max_size = gesture->getMaxSerialSize();
|
||||||
char* buffer = new char[max_size];
|
char* buffer = new char[max_size];
|
||||||
LLDataPackerAsciiBuffer dp(buffer, max_size);
|
LLDataPackerAsciiBuffer dp(buffer, max_size);
|
||||||
|
|
||||||
if(!gesture->serialize(dp))
|
if(!gesture->serialize(dp))
|
||||||
{
|
{
|
||||||
// FIXME: Notify user
|
// FIXME: Notify user
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 size = dp.getCurrentSize();
|
S32 size = dp.getCurrentSize();
|
||||||
|
|
||||||
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
|
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
|
||||||
export_file.write(buffer, size);
|
export_file.write(buffer, size);
|
||||||
export_file.close();
|
export_file.close();
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUUID LLPreviewGesture::getItemID()
|
LLUUID LLPreviewGesture::getItemID()
|
||||||
{
|
{
|
||||||
const LLViewerInventoryItem* item = getItem();
|
const LLViewerInventoryItem* item = getItem();
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
return item->getUUID();
|
return item->getUUID();
|
||||||
}
|
}
|
||||||
return LLUUID::null;
|
return LLUUID::null;
|
||||||
}
|
}
|
||||||
// </edit>
|
// </edit>
|
||||||
@@ -35,27 +35,15 @@
|
|||||||
width="112" />
|
width="112" />
|
||||||
<button bottom_delta="-3" follows="top|right" font="SansSerif" halign="center"
|
<button bottom_delta="-3" follows="top|right" font="SansSerif" halign="center"
|
||||||
height="20" label="Create" label_selected="Create" left_delta="20" right="-10"
|
height="20" label="Create" label_selected="Create" left_delta="20" right="-10"
|
||||||
mouse_opaque="true" name="create_grp_btn" scale_image="TRUE" width="90" />
|
mouse_opaque="true" name="Create" scale_image="TRUE" width="90" />
|
||||||
|
<button bottom_delta="-25" follows="top|right" font="SansSerif" halign="center"
|
||||||
|
height="20" label="Delete" label_selected="Delete" right="-15"
|
||||||
|
mouse_opaque="true" name="Delete" scale_image="TRUE" width="90" />
|
||||||
<scroll_list background_visible="true" bottom_delta="-125" column_padding="5"
|
<scroll_list background_visible="true" bottom_delta="-125" column_padding="5"
|
||||||
draw_border="true" draw_heading="false" draw_stripes="true"
|
draw_border="true" draw_heading="false" draw_stripes="true"
|
||||||
follows="left|top|right" height="120" left="10" mouse_opaque="true"
|
follows="left|top|right" height="120" left="10" mouse_opaque="true"
|
||||||
multi_select="false" name="group_scroll_list" width="115" />
|
multi_select="false" name="group_scroll_list" width="115" />
|
||||||
</panel>
|
</panel>
|
||||||
|
|
||||||
<panel name="ManageGroupsPanel" label="Manage Groups"
|
|
||||||
border="true" bottom="0" height="150" left="0" width="135"
|
|
||||||
mouse_opaque="true">
|
|
||||||
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
|
||||||
bottom="-24" drop_shadow_visible="true" follows="left|top"
|
|
||||||
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="10"
|
|
||||||
mouse_opaque="true" name="InstructSelectCallingCard" v_pad="0"
|
|
||||||
width="220">
|
|
||||||
Select a calling card:
|
|
||||||
</text>
|
|
||||||
<inventory_panel allow_multi_select="false" border="true" bottom_delta="-117"
|
|
||||||
follows="left|top|right|bottom" height="110" left="10" mouse_opaque="true"
|
|
||||||
name="InventoryPanel" sort_order="AvatarPickerSortOrder" width="115" />
|
|
||||||
</panel>
|
|
||||||
</tab_container>
|
</tab_container>
|
||||||
|
|
||||||
<button bottom="6" left="10" follows="left|bottom" font="SansSerif" halign="center"
|
<button bottom="6" left="10" follows="left|bottom" font="SansSerif" halign="center"
|
||||||
|
|||||||
@@ -105,6 +105,4 @@ unless you add wait steps.
|
|||||||
name="preview_btn" width="80" />
|
name="preview_btn" width="80" />
|
||||||
<button bottom="5" follows="top|left" height="20" label="Save" left_delta="90"
|
<button bottom="5" follows="top|left" height="20" label="Save" left_delta="90"
|
||||||
name="save_btn" width="80" />
|
name="save_btn" width="80" />
|
||||||
<button bottom="5" follows="top|left" height="20" label="Make Copy" left_delta="90"
|
|
||||||
name="duplicate_btn" width="80" />
|
|
||||||
</floater>
|
</floater>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
bottom_delta="20" height="18" hidden="false" left="-235" max_chars="20" mouse_opaque="true"
|
bottom_delta="20" height="18" hidden="false" left="-235" max_chars="20" mouse_opaque="true"
|
||||||
tool_tip="Buddy group"
|
tool_tip="Buddy group"
|
||||||
name="buddy_group_combobox" width="130">
|
name="buddy_group_combobox" width="130">
|
||||||
<combo_item type="string" length="1" enabled="true" name="All"
|
<combo_item type="string" length="20" enabled="true" name="All"
|
||||||
value="All">
|
value="All">
|
||||||
All
|
All
|
||||||
</combo_item>
|
</combo_item>
|
||||||
|
|||||||
Reference in New Issue
Block a user