remove author tracking, non-wordstyle option, and notifications

master
Oz Linden 2012-05-11 14:31:45 -04:00
parent 9bdb1d82f8
commit 6d9c0fab8f
6 changed files with 1 additions and 165 deletions

View File

@ -2,25 +2,15 @@
<map>
<key>Custom</key>
<map>
<key>announce</key>
<integer>0</integer>
<key>author</key>
<string>You</string>
<key>data</key>
<map></map>
<key>enabled</key>
<integer>1</integer>
<key>priority</key>
<integer>10</integer>
<key>wordStyle</key>
<integer>1</integer>
</map>
<key>Abbreviations</key>
<map>
<key>announce</key>
<integer>0</integer>
<key>author</key>
<string>Wulf / TankMaster</string>
<key>data</key>
<map>
<key>afaic</key>
@ -90,15 +80,9 @@
<integer>1</integer>
<key>priority</key>
<integer>4</integer>
<key>wordStyle</key>
<integer>1</integer>
</map>
<key>Spelling Corrections</key>
<map>
<key>announce</key>
<integer>0</integer>
<key>author</key>
<string>LordGregGreg / Wikipedia</string>
<key>data</key>
<map>
<key>Amercia</key>
@ -8362,8 +8346,6 @@
<integer>1</integer>
<key>priority</key>
<integer>5</integer>
<key>wordStyle</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@ -137,8 +137,6 @@ LLSD AutoReplace::exportList(std::string listName)
{
toReturn["listName"]=listName;
toReturn["data"]=mAutoReplaces[listName]["data"];
toReturn["author"]=mAutoReplaces[listName]["author"];
toReturn["wordStyle"]=mAutoReplaces[listName]["wordStyle"];
toReturn["priority"]=mAutoReplaces[listName]["priority"];
}
return toReturn;
@ -152,9 +150,6 @@ BOOL AutoReplace::addReplacementList(LLSD newList)
LLSD newPart;
newPart["data"]=newList["data"];
newPart["enabled"]=TRUE;
newPart["announce"]=FALSE;
newPart["author"]=newList["author"];
newPart["wordStyle"]=newList["wordStyle"];
newPart["priority"]=newList["priority"].asInteger();
llinfos << "adding new list with settings priority "<<newPart["priority"].asInteger() <<llendl;
mAutoReplaces[name]=newPart;
@ -183,26 +178,6 @@ BOOL AutoReplace::setListEnabled(std::string listName, BOOL enabled)
return FALSE;
}
BOOL AutoReplace::setListAnnounceeState(std::string listName, BOOL announce)
{
if(mAutoReplaces.has(listName))
{
mAutoReplaces[listName]["announce"]=announce;
return TRUE;
}
return FALSE;
}
BOOL AutoReplace::setListStyle(std::string listName, BOOL announce)
{
if(mAutoReplaces.has(listName))
{
mAutoReplaces[listName]["wordStyle"]=announce;
return TRUE;
}
return FALSE;
}
BOOL AutoReplace::setListPriority(std::string listName, int priority)
{
if(mAutoReplaces.has(listName))
@ -214,7 +189,6 @@ BOOL AutoReplace::setListPriority(std::string listName, int priority)
}
LLSD AutoReplace::getAutoReplaces()
{
//loadFromDisk();
return mAutoReplaces;
}
void AutoReplace::loadFromDisk()
@ -308,39 +282,9 @@ std::string AutoReplace::replaceWord(std::string currentWord)
const LLSD& loc_map = (*loc_it).second;
if(loc_map["priority"].asInteger()==currentPriority)
{
if(!loc_map["wordStyle"].asBoolean())
{
//this means look for partial matches instead of a full word
if(loc_map["enabled"].asBoolean())
{
LLSD::map_const_iterator inner_it = loc_map["data"].beginMap();
LLSD::map_const_iterator inner_end = loc_map["data"].endMap();
for (; inner_it != inner_end; ++inner_it)
{
const std::string& wrong = (*inner_it).first;
const std::string& right = (*inner_it).second;
int location = currentWord.find(wrong);
if(location != std::string::npos)
{
currentWord=currentWord.replace(location,wrong.length(),right);
}
}
}
}else
if((loc_map["data"].has(currentWord))&&(loc_map["enabled"].asBoolean()))
{
std::string replacement = loc_map["data"][currentWord];
if(loc_map["announce"].asBoolean())
{
LLSD args;
//"[Before]" has been auto replaced by "[Replacement]"
// based on your [ListName] list.
args["BEFORE"] = currentWord;
args["LISTNAME"]=location;
args["REPLACEMENT"]=replacement;
LLNotificationsUtil::add("AutoReplace",args);
}
lldebugs << "found a word in list " << location.c_str() << " and it will replace " << currentWord.c_str() << " => " << replacement.c_str() << llendl;
return replacement;
}
@ -353,8 +297,6 @@ std::string AutoReplace::replaceWords(std::string words)
{
static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace");
if(!(perform_autoreplace))return words;
//*TODO update this function to use the "wordStyle" thing,
//but so far this function is never used, so later
boost_tokenizer tokens(words, boost::char_separator<char>(" "));
for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
@ -369,16 +311,6 @@ std::string AutoReplace::replaceWords(std::string words)
if((loc_map["data"].has(currentWord))&&(loc_map["enabled"].asBoolean()))
{
std::string replacement = loc_map["data"][currentWord];
if(loc_map["announce"].asBoolean())
{
LLSD args;
//"[Before]" has been auto replaced by "[Replacement]"
// based on your [ListName] list.
args["BEFORE"] = currentWord;
args["LISTNAME"]=location;
args["REPLACEMENT"]=replacement;
LLNotificationsUtil::add("AutoReplace",args);
}
lldebugs << "found a word in list " << location.c_str() << " and it will replace " << currentWord.c_str() << " => " << replacement.c_str() << llendl;
int wordStart = words.find(currentWord);
words.replace(wordStart,currentWord.length(),replacement);
@ -399,12 +331,9 @@ BOOL AutoReplace::addEntryToList(std::string wrong, std::string right, std::stri
}
else if(listName == "Custom")
{
mAutoReplaces[listName]["announce"] = 0;
mAutoReplaces[listName]["author"] = "You";
mAutoReplaces[listName]["data"][wrong] = right;
mAutoReplaces[listName]["enabled"] = 1;
mAutoReplaces[listName]["priority"] = 10;
mAutoReplaces[listName]["wordStyle"] = 1;
return TRUE;
}

View File

@ -33,9 +33,7 @@ public:
BOOL addReplacementList(LLSD newList);
BOOL removeReplacementList(std::string listName);
BOOL setListEnabled(std::string listName, BOOL enabled);
BOOL setListAnnounceeState(std::string listName, BOOL announce);
BOOL setListPriority(std::string listName, int priority);
BOOL setListStyle(std::string listName, BOOL announce);
std::string replaceWords(std::string words);
std::string replaceWord(std::string currentWord);
BOOL addEntryToList(std::string wrong, std::string right, std::string listName);

View File

@ -131,10 +131,7 @@ void AutoReplaceFloater::updateItemsList()
LLSD listData = AutoReplace::getInstance()->getAutoReplaceEntries(listName);
childSetValue("ac_list_enabled",listData["enabled"].asBoolean());
childSetValue("ac_list_style",listData["wordStyle"].asBoolean());
childSetValue("ac_list_show",listData["announce"].asBoolean());
childSetValue("ac_text_name",listName);
childSetValue("ac_text_author",listData["author"]);
childSetValue("ac_priority",listData["priority"]);
LLSD autoReplaces = listData["data"];
@ -201,7 +198,6 @@ void AutoReplaceFloater::updateListControlsEnabled(BOOL selected)
childSetEnabled("ac_text1",selected);
childSetEnabled("ac_text2",selected);
childSetEnabled("ac_text_name",selected);
childSetEnabled("ac_text_author",selected);
childSetEnabled("ac_list_enabled",selected);
childSetEnabled("ac_list_show",selected);
childSetEnabled("ac_list_style",selected);
@ -256,7 +252,6 @@ void AutoReplaceFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data)
{
std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
AutoReplace::getInstance()->setListEnabled(listName,self->childGetValue("ac_list_enabled").asBoolean());
AutoReplace::getInstance()->setListAnnounceeState(listName,self->childGetValue("ac_list_show").asBoolean());
AutoReplace::getInstance()->setListStyle(listName,self->childGetValue("ac_list_style").asBoolean());
AutoReplace::getInstance()->setListPriority(listName,self->childGetValue("ac_priority").asInteger());

View File

@ -126,39 +126,6 @@
name="ac_text_name">
List Name
</text>
<text
bottom_delta="20"
left_delta="-2"
height="16"
width="40"
follows="left|top"
halign="center"
font="SansSerifSmall"
mouse_opaque="true"
name="ac_text2">
Author:
</text>
<view_border
bottom_delta="-0"
left_delta="42"
height="16"
width="140"
follows="left|top"
bevel_style="in"
mouse_opaque="false"
name="ac_box2"/>
<text
bottom_delta="0"
left_delta="0"
height="16"
width="140"
follows="left|top"
halign="center"
font="SansSerifSmall"
mouse_opaque="true"
name="ac_text_author">
Author Name
</text>
<check_box
bottom_delta="20"
left_delta="-32"
@ -188,34 +155,6 @@
label_width="0"
name="ac_priority"
tool_tip="This number determine what order your list will be used to replace words. A higher priority means it will be used before lower priority lists."/>
<check_box
bottom_delta="20"
left_delta="-120"
height="16"
width="100"
enabled="true"
follows="left|top"
font="SansSerifSmall"
mouse_opaque="true"
radio_style="false"
label="Show Notifications"
control_name="ac_list_show"
name="ac_list_show"
tool_tip="Having this enabled will make a notification pop up every time a word is replaced."/>
<check_box
bottom_delta="20"
left_delta="-0"
height="16"
width="100"
enabled="true"
follows="left|top"
font="SansSerifSmall"
mouse_opaque="true"
radio_style="false"
label="Word Style"
control_name="ac_list_style"
name="ac_list_style"
tool_tip="Having this checked means the list is for full words that should be replaced, unchecked means that it will look within words contents as well."/>
<button
top="100"
left="5"
@ -279,7 +218,7 @@
left="10"
top="450"
width="364">
Original text:
Keyword:
</text>
<line_editor
follows="left|top"

View File

@ -6763,13 +6763,6 @@ One or more of your Voice Morphs will expire in less than [INTERVAL] days.
<tag>voice</tag>
</notification>
<notification
icon="notifytip.tga"
name="AutoReplace"
type="notifytip">
&apos;[BEFORE]&apos; has been auto replaced by &apos;[REPLACEMENT]&apos;
based on your [LISTNAME] list.
</notification>
<notification
icon="notify.tga"
name="VoiceEffectsNew"