Rename AO sets finished, some better UI handling for checking of names and reloading sets.

master
ZiRee 2011-04-26 18:08:09 +02:00
parent 34e0f4b534
commit f343623f0f
5 changed files with 78 additions and 11 deletions

View File

@ -37,6 +37,7 @@
#include "llspinctrl.h"
#include "llviewercontrol.h"
#include "llviewerinventory.h"
#include <boost/graph/graph_concepts.hpp>
FloaterAO::FloaterAO(const LLSD& key)
: LLTransientDockableFloater(NULL,true,key),
@ -270,12 +271,17 @@ void FloaterAO::onOpen(const LLSD& key)
void FloaterAO::onSelectSet()
{
mSelectedSet=AOEngine::instance().getSetByName(mSetSelector->getSelectedItemLabel());
if(mSelectedSet)
AOSet* set=AOEngine::instance().getSetByName(mSetSelector->getSelectedItemLabel());
if(!set)
{
updateSetParameters();
updateAnimationList();
onRenameSet();
return;
}
mSelectedSet=set;
updateSetParameters();
updateAnimationList();
}
void FloaterAO::onSelectSetSmall()
@ -288,6 +294,37 @@ void FloaterAO::onSelectSetSmall()
}
}
void FloaterAO::onRenameSet()
{
if(!mSelectedSet)
{
llwarns << "Rename AO set without set selected." << llendl;
return;
}
std::string name=mSetSelector->getSimple();
LLStringUtil::trim(name);
if(!name.empty())
{
if(name.find_first_of(":|")==std::string::npos)
{
if(AOEngine::instance().renameSet(mSelectedSet,name))
{
reloading(TRUE);
return;
}
}
else
{
LLSD args;
args["AO_SET_NAME"]=name;
LLNotificationsUtil::add("RenameAOCantContainColon",args);
}
}
mSetSelector->setSimple(mSelectedSet->getName());
}
void FloaterAO::onClickActivate()
{
lldebugs << "Set activated: " << mSetSelector->getSelectedItemLabel() << llendl;
@ -371,11 +408,15 @@ BOOL FloaterAO::newSetCallback(const LLSD& notification,const LLSD& response)
std::string newSetName=response["message"].asString();
S32 option=LLNotificationsUtil::getSelectedOption(notification,response);
if(newSetName=="")
LLStringUtil::trim(newSetName);
if(newSetName.empty())
return FALSE;
else if(newSetName.find(":")!=std::string::npos)
else if(newSetName.find_first_of(":|")!=std::string::npos)
{
LLNotificationsUtil::add("NewAOCantContainColon",LLSD());
LLSD args;
args["AO_SET_NAME"]=newSetName;
LLNotificationsUtil::add("NewAOCantContainColon",args);
return FALSE;
}

View File

@ -63,6 +63,7 @@ class FloaterAO
void onSelectSet();
void onSelectSetSmall();
void onRenameSet();
void onSelectState();
void onChangeAnimationSelection();
void onClickReload();

View File

@ -1047,6 +1047,19 @@ void AOEngine::saveSet(const AOSet* set)
gInventory.notifyObservers();
*/
rename_category(&gInventory,set->getInventoryUUID(),setParams);
llwarns << "sending update signal" << llendl;
mUpdatedSignal();
}
BOOL AOEngine::renameSet(AOSet* set,const std::string name)
{
if(name.empty() || name.find(":")!=std::string::npos)
return FALSE;
set->setName(name);
set->setDirty(TRUE);
return TRUE;
}
void AOEngine::saveState(const AOSet::AOState* state)

View File

@ -133,6 +133,7 @@ class AOEngine
const std::vector<AOSet*> getSetList() const;
const std::string getCurrentSetName() const;
const AOSet* getDefaultSet() const;
BOOL renameSet(AOSet* set,const std::string name);
void setDefaultSet(AOSet* set);
void setOverrideSits(AOSet* set,BOOL yes);

View File

@ -7032,7 +7032,7 @@ Reset WL settings for &apos;[PARCEL_NAME]&apos; to region default?
name="NewAOSet"
type="alertmodal">
Specify a name for the new AO set:
(The name may not contain a : character)
(The name may not contain a ":" or "|" character)
<form name="form">
<input name="message" type="text">
New AO Set
@ -7053,8 +7053,19 @@ New AO Set
icon="alertmodal.tga"
name="NewAOCantContainColon"
type="alertmodal">
Could not create new AO set.
The name may not contain ":" characters.
Could not create new AO set "[AO_SET_NAME]".
The name may not contain ":" or "|" characters.
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="RenameAOCantContainColon"
type="alertmodal">
Could not rename new AO set to "[AO_SET_NAME]".
The name may not contain ":" or "|" characters.
<usetemplate
name="okbutton"
yestext="OK"/>
@ -7064,7 +7075,7 @@ The name may not contain ":" characters.
icon="alertmodal.tga"
name="RemoveAOSet"
type="alertmodal">
Remove AO set [AO_SET_NAME] from the list?
Remove AO set "[AO_SET_NAME]" from the list?
<usetemplate
name="okcancelbuttons"
notext="Cancel"