From f5e8276b228cb33ad68ffed53a281a7e9d61ae9f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 13 Nov 2012 14:35:32 +0100 Subject: [PATCH] Added fscommon.cpp/h as central location for common used functions and moved reportToNearbyChat() there --- indra/newview/CMakeLists.txt | 2 + indra/newview/chatbar_as_cmdline.cpp | 186 +++++++++++++-------------- indra/newview/chatbar_as_cmdline.h | 1 - indra/newview/fscommon.cpp | 37 ++++++ indra/newview/fscommon.h | 31 +++++ indra/newview/fslslpreproc.cpp | 64 ++++----- indra/newview/llpanelpeople.cpp | 13 +- indra/newview/llpanelpeople.h | 1 - indra/newview/llstartup.cpp | 1 - indra/newview/llviewermenu.cpp | 5 +- indra/newview/llviewermessage.cpp | 4 +- indra/newview/llviewerthrottle.cpp | 1 - indra/newview/qtoolalign.cpp | 8 +- 13 files changed, 200 insertions(+), 154 deletions(-) create mode 100644 indra/newview/fscommon.cpp create mode 100644 indra/newview/fscommon.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 16b4f2be35..b2bb2193d0 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -109,6 +109,7 @@ set(viewer_SOURCE_FILES exopanelsnapshotflickr.cpp floatermedialists.cpp fsareasearch.cpp + fscommon.cpp fscontactsfloater.cpp fsdata.cpp fsfloaterprofile.cpp @@ -755,6 +756,7 @@ set(viewer_HEADER_FILES exogroupmutelist.h floatermedialists.h fsareasearch.h + fscommon.h fscontactsfloater.h fsdata.h fsfloaterprofile.h diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 74dd74ae7b..3674d75f8f 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -89,6 +89,7 @@ #include "llpanelpeople.h" #include "llvieweraudio.h" +#include "fscommon.h" LLViewerInventoryItem::item_array_t findInventoryInFolder(const std::string& ifolder) { @@ -120,22 +121,22 @@ public: doZdCleanup(); if (errorCode == 1) { - cmdline_printchat(llformat("The object with the UUID of \"%s\" can no longer be found in-world.",dUUID.c_str())); - cmdline_printchat("This can occur if the object was returned or deleted, or if your client is no longer rendering it."); - cmdline_printchat(llformat("Transfer from \"%s\" to \"%s\" aborted.",dFolder.c_str(),dUUID.c_str())); + reportToNearbyChat(llformat("The object with the UUID of \"%s\" can no longer be found in-world.",dUUID.c_str())); + reportToNearbyChat("This can occur if the object was returned or deleted, or if your client is no longer rendering it."); + reportToNearbyChat(llformat("Transfer from \"%s\" to \"%s\" aborted.",dFolder.c_str(),dUUID.c_str())); } else { if(mPackage) { - cmdline_printchat("Packager finished, you may now pick up the prim that contains the objects."); - cmdline_printchat(llformat("Packaged what you had selected in world into the folder \"%s\" in your inventory and into the prim with the UUID of \"%s\"",dFolder.c_str(),dUUID.c_str())); - cmdline_printchat("Don't worry if you look at the contents of package right now, it may show as empty, it isn't, it's just a bug with Second Life itself."); - cmdline_printchat("If you take it into your inventory then rez it back out, all the contents will be there."); + reportToNearbyChat("Packager finished, you may now pick up the prim that contains the objects."); + reportToNearbyChat(llformat("Packaged what you had selected in world into the folder \"%s\" in your inventory and into the prim with the UUID of \"%s\"",dFolder.c_str(),dUUID.c_str())); + reportToNearbyChat("Don't worry if you look at the contents of package right now, it may show as empty, it isn't, it's just a bug with Second Life itself."); + reportToNearbyChat("If you take it into your inventory then rez it back out, all the contents will be there."); } else { - cmdline_printchat(llformat("Completed transfer from \"%s\" to \"%s\".",dFolder.c_str(),dUUID.c_str())); + reportToNearbyChat(llformat("Completed transfer from \"%s\" to \"%s\".",dFolder.c_str(),dUUID.c_str())); } } } @@ -146,7 +147,7 @@ public: LLViewerObject *objectp = gObjectList.findObject(indest); if(objectp) { - cmdline_printchat(std::string("transferring ")+subj->getName()); + reportToNearbyChat(std::string("transferring ")+subj->getName()); LLToolDragAndDrop::dropInventory(objectp,subj,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); if (instack.size() > 0) { @@ -207,18 +208,18 @@ public: mFolderName = dtarget; if(mPackage) { - cmdline_printchat("Packager started. Phase 1 (taking in-world objects into inventory) starting in: "); + reportToNearbyChat("Packager started. Phase 1 (taking in-world objects into inventory) starting in: "); } else { - cmdline_printchat("Ztake activated. Taking selected in-world objects into inventory in: "); + reportToNearbyChat("Ztake activated. Taking selected in-world objects into inventory in: "); } } ~JCZtake() { if(!mPackage) { - cmdline_printchat("Ztake deactivated."); + reportToNearbyChat("Ztake deactivated."); } } BOOL tick() @@ -240,7 +241,7 @@ public: if(mCountdown > 0) { - cmdline_printchat(llformat("%i...", mCountdown--)); + reportToNearbyChat(llformat("%i...", mCountdown--)); } else if(mToTake.size() > 0) { @@ -267,7 +268,7 @@ public: { if(mPackage) { - cmdline_printchat("Phase 1 of the packager finished."); + reportToNearbyChat("Phase 1 of the packager finished."); std::stack lolstack; LLDynamicArray > lolinv = findInventoryInFolder(mFolderName); for(LLDynamicArray >::iterator it = lolinv.begin(); it != lolinv.end(); ++it) @@ -277,7 +278,7 @@ public: } if(lolstack.size()) { - cmdline_printchat("Do not have the destination prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); + reportToNearbyChat("Do not have the destination prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); LLUUID sdest = LLUUID(mPackageDest); new JCZdrop(lolstack, sdest, mFolderName.c_str(), mPackageDest.asString().c_str(), true); } @@ -285,18 +286,18 @@ public: } else { - cmdline_printchat("Ztake has taken all selected objects. Say \"ztake off\" to deactivate ztake or select more objects to continue."); + reportToNearbyChat("Ztake has taken all selected objects. Say \"ztake off\" to deactivate ztake or select more objects to continue."); } } else { if(mPackage) { - cmdline_printchat(llformat("Packager: %i objects left to take.", mToTake.size())); + reportToNearbyChat(llformat("Packager: %i objects left to take.", mToTake.size())); } else { - cmdline_printchat(llformat("Ztake: %i objects left to take.", mToTake.size())); + reportToNearbyChat(llformat("Ztake: %i objects left to take.", mToTake.size())); } } } @@ -348,11 +349,11 @@ public: TMZtake(const LLUUID& target) : LLEventTimer(0.33f), mTarget(target), mRunning(FALSE), mCountdown(5) { - cmdline_printchat("Mtake activated. Taking selected in-world objects into inventory in: "); + reportToNearbyChat("Mtake activated. Taking selected in-world objects into inventory in: "); } ~TMZtake() { - cmdline_printchat("Mtake deactivated."); + reportToNearbyChat("Mtake deactivated."); } BOOL tick() { @@ -396,7 +397,7 @@ public: } if(mCountdown > 0) { - cmdline_printchat(llformat("%i...", mCountdown--)); + reportToNearbyChat(llformat("%i...", mCountdown--)); } else if(mToTake.size() > 0) { @@ -421,11 +422,11 @@ public: { if(mToTake.size() == 0) { - cmdline_printchat("Mtake has taken all selected objects. Say \"Mtake off\" to deactivate Mtake or select more objects to continue."); + reportToNearbyChat("Mtake has taken all selected objects. Say \"Mtake off\" to deactivate Mtake or select more objects to continue."); } else { - cmdline_printchat(llformat("Mtake: %i objects left to take.", mToTake.size())); + reportToNearbyChat(llformat("Mtake: %i objects left to take.", mToTake.size())); } } } @@ -514,7 +515,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(from_gesture) { - cmdline_printchat("Due to the changes in code, it is no longer necessary to use this gesture."); + reportToNearbyChat("Due to the changes in code, it is no longer necessary to use this gesture."); // We don't have this debug setting // gSavedSettings.setBOOL("RenderFarClipStepping",TRUE); return false; @@ -524,7 +525,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { gSavedSettings.setF32("RenderFarClip", drawDist); gAgentCamera.mDrawDistance = drawDist; - cmdline_printchat(std::string(llformat("Draw distance set to: %dm",drawDist))); + reportToNearbyChat(std::string(llformat("Draw distance set to: %dm",drawDist))); return false; } } @@ -589,7 +590,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) std::string bw_cmd_respond; args["[VALUE]"] = llformat ("%d", band_width); bw_cmd_respond = LLTrans::getString("FSCmdLineRSP", args); - cmdline_printchat(bw_cmd_respond); + reportToNearbyChat(bw_cmd_respond); return false; } } @@ -643,7 +644,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) object_name = RlvStrings::getAnonym(object_name); } snprintf(buffer,sizeof(buffer),"%s: (%s)",targetKey.asString().c_str(), object_name.c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); } return false; } @@ -658,7 +659,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) if (!myObject) { snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); return false; } @@ -699,7 +700,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) msg->addVector3("Binormal", LLVector3::zero); msg->sendMessage(myObject->getRegion()->getHost()); snprintf(buffer,sizeof(buffer),"Touched object with key %s",targetKey.asString().c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); } } return false; @@ -715,7 +716,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) if (!myObject) { snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); return false; } if((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(myObject, LLVector3::zero))) @@ -731,7 +732,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) gAgent.getRegion()->sendReliableMessage(); snprintf(buffer,sizeof(buffer),"Sat on object with key %s",targetKey.asString().c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); } } return false; @@ -741,7 +742,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) if((!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand( ))) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - cmdline_printchat(std::string("Standing up")); + reportToNearbyChat(std::string("Standing up")); } return false; } @@ -775,7 +776,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } gAgent.sendReliableMessage(); snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str()); - cmdline_printchat(std::string(buffer)); + reportToNearbyChat(std::string(buffer)); return false; } } @@ -869,7 +870,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) result_str << result; out = result_str.str(); } - cmdline_printchat(out); + reportToNearbyChat(out); return false; } } @@ -885,7 +886,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) else if(revised_text == "/cs") { LLFloaterReg::showInstance("contactsets"); - cmdline_printchat("Displaying Contact Sets Floater."); + reportToNearbyChat("Displaying Contact Sets Floater."); return false; } @@ -908,22 +909,22 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(zdrop != NULL) { - cmdline_printchat("Zdrop is already active."); + reportToNearbyChat("Zdrop is already active."); } else { std::string loldest; if(i >> loldest) { - cmdline_printchat("Beginning Zdrop."); - cmdline_printchat("Verifying destination prim is present inworld..."); + reportToNearbyChat("Beginning Zdrop."); + reportToNearbyChat("Verifying destination prim is present inworld..."); if(loldest.length() != 36) { - cmdline_printchat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); + reportToNearbyChat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); } else if (gObjectList.findObject(LLUUID(loldest)) == false) { - cmdline_printchat("Unable to locate object. Please verify the object is rezzed and in view, and that the UUID is correct."); + reportToNearbyChat("Unable to locate object. Please verify the object is rezzed and in view, and that the UUID is correct."); } else { @@ -939,7 +940,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) LLUUID folder = gInventory.findCategoryByName(lolfolder); if(folder.notNull()) { - cmdline_printchat("Verifying folder location..."); + reportToNearbyChat("Verifying folder location..."); std::stack lolstack; LLDynamicArray > lolinv = findInventoryInFolder(lolfolder); for(LLDynamicArray >::iterator it = lolinv.begin(); it != lolinv.end(); ++it) @@ -949,32 +950,32 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } if(lolstack.size()) { - cmdline_printchat(llformat("Found folder \"%s\".", lolfolder.c_str())); - cmdline_printchat(llformat("Found prim \"%s\".", loldest.c_str())); - cmdline_printchat(llformat("Transferring inventory items from \"%s\" to prim \"%s\".", lolfolder.c_str(), loldest.c_str())); - cmdline_printchat("WARNING: No-copy items will be moved to the destination prim!"); - cmdline_printchat("Do not have the prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); - cmdline_printchat("Use \"Zdrop off\" to stop the transfer"); + reportToNearbyChat(llformat("Found folder \"%s\".", lolfolder.c_str())); + reportToNearbyChat(llformat("Found prim \"%s\".", loldest.c_str())); + reportToNearbyChat(llformat("Transferring inventory items from \"%s\" to prim \"%s\".", lolfolder.c_str(), loldest.c_str())); + reportToNearbyChat("WARNING: No-copy items will be moved to the destination prim!"); + reportToNearbyChat("Do not have the prim selected while transfer is running to reduce the chances of \"Inventory creation on in-world object failed.\""); + reportToNearbyChat("Use \"Zdrop off\" to stop the transfer"); LLUUID sdest = LLUUID(loldest); zdrop = new JCZdrop(lolstack, sdest, lolfolder.c_str(), loldest.c_str()); } } else { - cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", lolfolder.c_str())); - cmdline_printchat("Zdrop cannot work if the folder is inside another folder."); + reportToNearbyChat(llformat("\"%s\" folder not found. Please check the spelling.", lolfolder.c_str())); + reportToNearbyChat("Zdrop cannot work if the folder is inside another folder."); } } catch(std::out_of_range e) { - cmdline_printchat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); - cmdline_printchat("Valid command: Zdrop (rezzed prim UUID) (source inventory folder name)"); + reportToNearbyChat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); + reportToNearbyChat("Valid command: Zdrop (rezzed prim UUID) (source inventory folder name)"); } } } else { - cmdline_printchat("Please specify an object UUID to copy the items in this folder to."); + reportToNearbyChat("Please specify an object UUID to copy the items in this folder to."); } } } @@ -982,7 +983,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(zdrop == NULL) { - cmdline_printchat("Zdrop is already deactivated."); + reportToNearbyChat("Zdrop is already deactivated."); } else { @@ -993,13 +994,13 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } else { - cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Zdrop on (source inventory folder) (rezzed prim UUID) ; Zdrop off", setting.c_str())); + reportToNearbyChat(llformat("Invalid command: \"%s\". Valid commands: Zdrop on (source inventory folder) (rezzed prim UUID) ; Zdrop off", setting.c_str())); } } else { - cmdline_printchat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); - cmdline_printchat("Valid commands: Zdrop on (rezzed prim UUID) (source inventory folder name) ; Zdrop off"); + reportToNearbyChat("The Zdrop command transfers items from your inventory to a rezzed prim without the need to wait for the contents of the prim to load. No-copy items are moved to the prim. All other items are copied."); + reportToNearbyChat("Valid commands: Zdrop on (rezzed prim UUID) (source inventory folder name) ; Zdrop off"); } return false; } @@ -1012,12 +1013,12 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(ztake != NULL) { - cmdline_printchat("Ztake is already active."); + reportToNearbyChat("Ztake is already active."); } else { - cmdline_printchat("Beginning Ztake."); - cmdline_printchat("Verifying folder location..."); + reportToNearbyChat("Beginning Ztake."); + reportToNearbyChat("Verifying folder location..."); std::string folder_name; std::string tmp; while(i >> tmp) @@ -1030,18 +1031,18 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) LLUUID folder = gInventory.findCategoryByName(folder_name); if(folder.notNull()) { - cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + reportToNearbyChat(llformat("Found destination folder \"%s\".", folder_name.c_str())); ztake = new JCZtake(folder); } else { - cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); - cmdline_printchat("Ztake cannot work if the folder is inside another folder."); + reportToNearbyChat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + reportToNearbyChat("Ztake cannot work if the folder is inside another folder."); } } catch(std::out_of_range e) { - cmdline_printchat("Please specify a destination folder in your inventory."); + reportToNearbyChat("Please specify a destination folder in your inventory."); } } } @@ -1049,7 +1050,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(ztake == NULL) { - cmdline_printchat("Ztake is already deactivated."); + reportToNearbyChat("Ztake is already deactivated."); } else { @@ -1060,14 +1061,14 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } else { - cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Ztake on (destination inventory folder) ; Ztake off", setting.c_str())); + reportToNearbyChat(llformat("Invalid command: \"%s\". Valid commands: Ztake on (destination inventory folder) ; Ztake off", setting.c_str())); } return false; } else { - cmdline_printchat("The Ztake command copies selected rezzed objects into the folder you specify in your inventory."); - cmdline_printchat("Valid commands: Ztake on (destination inventory folder name) ; Ztake off"); + reportToNearbyChat("The Ztake command copies selected rezzed objects into the folder you specify in your inventory."); + reportToNearbyChat("Valid commands: Ztake on (destination inventory folder name) ; Ztake off"); } return false; } @@ -1076,14 +1077,14 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) std::string loldest; if(i >> loldest) { - cmdline_printchat("Verifying destination prim is present inworld..."); + reportToNearbyChat("Verifying destination prim is present inworld..."); if(loldest.length() != 36) { - cmdline_printchat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); + reportToNearbyChat("UUID entered is of an invalid length! (Hint: use the \"copy key\" button in the build menu.)"); } else if (gObjectList.findObject(LLUUID(loldest)) == false) { - cmdline_printchat("Unable to locate object. Please verify the object is rezzed, in view, and that the UUID is correct."); + reportToNearbyChat("Unable to locate object. Please verify the object is rezzed, in view, and that the UUID is correct."); } else { @@ -1099,24 +1100,24 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) LLUUID folder = gInventory.findCategoryByName(folder_name); if(folder.notNull()) { - cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + reportToNearbyChat(llformat("Found destination folder \"%s\".", folder_name.c_str())); ztake = new JCZtake(folder, true, LLUUID(loldest), folder_name); } else { - cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); - cmdline_printchat("The packager cannot work if the folder is inside another folder."); + reportToNearbyChat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + reportToNearbyChat("The packager cannot work if the folder is inside another folder."); } } catch(std::out_of_range e) { - cmdline_printchat("Please specify a destination folder in your inventory."); + reportToNearbyChat("Please specify a destination folder in your inventory."); } } } else { - cmdline_printchat(llformat("Packager usage: \"%s destination_prim_UUID inventory folder name\"",command.c_str())); + reportToNearbyChat(llformat("Packager usage: \"%s destination_prim_UUID inventory folder name\"",command.c_str())); } return false; } @@ -1129,12 +1130,12 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(mtake != NULL) { - cmdline_printchat("Mtake is already active."); + reportToNearbyChat("Mtake is already active."); } else { - cmdline_printchat("Beginning Mtake."); - cmdline_printchat("Verifying folder location..."); + reportToNearbyChat("Beginning Mtake."); + reportToNearbyChat("Verifying folder location..."); std::string folder_name; std::string tmp; while(i >> tmp) @@ -1147,18 +1148,18 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) LLUUID folder = gInventory.findCategoryByName(folder_name); if(folder.notNull()) { - cmdline_printchat(llformat("Found destination folder \"%s\".", folder_name.c_str())); + reportToNearbyChat(llformat("Found destination folder \"%s\".", folder_name.c_str())); mtake = new TMZtake(folder); } else { - cmdline_printchat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); - cmdline_printchat("Mtake cannot work if the folder is inside another folder."); + reportToNearbyChat(llformat("\"%s\" folder not found. Please check the spelling.", folder_name.c_str())); + reportToNearbyChat("Mtake cannot work if the folder is inside another folder."); } } catch(std::out_of_range e) { - cmdline_printchat("Please specify a destination folder in your inventory."); + reportToNearbyChat("Please specify a destination folder in your inventory."); } } } @@ -1166,7 +1167,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) { if(mtake == NULL) { - cmdline_printchat("Mtake is already deactivated."); + reportToNearbyChat("Mtake is already deactivated."); } else { @@ -1177,14 +1178,14 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } else { - cmdline_printchat(llformat("Invalid command: \"%s\". Valid commands: Mtake on (destination inventory folder) ; Mtake off", setting.c_str())); + reportToNearbyChat(llformat("Invalid command: \"%s\". Valid commands: Mtake on (destination inventory folder) ; Mtake off", setting.c_str())); } return false; } else { - cmdline_printchat("The Mtake command renames selected rezzed objects to the dimensions of the prim, then copies them into the folder you specify in your inventory."); - cmdline_printchat("Valid commands: Mtake on (destination inventory folder name) ; Mtake off"); + reportToNearbyChat("The Mtake command renames selected rezzed objects to the dimensions of the prim, then copies them into the folder you specify in your inventory."); + reportToNearbyChat("Valid commands: Mtake on (destination inventory folder name) ; Mtake off"); } return false; } @@ -1242,7 +1243,7 @@ void cmdline_tp2name(std::string target) } } - cmdline_printchat("Avatar not found."); + reportToNearbyChat("Avatar not found."); } void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value @@ -1292,14 +1293,3 @@ void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat( msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null ); msg->sendReliable(gAgent.getRegionHost()); } - -void cmdline_printchat(std::string message) -{ - - LLChat chat; - chat.mText = message; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); -} diff --git a/indra/newview/chatbar_as_cmdline.h b/indra/newview/chatbar_as_cmdline.h index 1a65beb15d..4fc3ed447d 100644 --- a/indra/newview/chatbar_as_cmdline.h +++ b/indra/newview/chatbar_as_cmdline.h @@ -37,7 +37,6 @@ #include "llchat.h" bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture = false); -void cmdline_printchat(std::string message); void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0); void cmdline_tp2name(std::string target); LLUUID cmdline_partial_name2key(std::string name); diff --git a/indra/newview/fscommon.cpp b/indra/newview/fscommon.cpp new file mode 100644 index 0000000000..a9808e582f --- /dev/null +++ b/indra/newview/fscommon.cpp @@ -0,0 +1,37 @@ +/** + * @file fscommon.cpp + * @brief Central class for common used functions in Firestorm + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2012 Ansariel Hiller @ Second Life + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "llviewerprecompiledheaders.h" + +#include "fscommon.h" +#include "llnotificationmanager.h" + +void reportToNearbyChat(const std::string& message) +{ + LLChat chat; + chat.mText = message; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLSD args; + args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); +} \ No newline at end of file diff --git a/indra/newview/fscommon.h b/indra/newview/fscommon.h new file mode 100644 index 0000000000..a237f61307 --- /dev/null +++ b/indra/newview/fscommon.h @@ -0,0 +1,31 @@ +/** + * @file fscommon.h + * @brief Central class for common used functions in Firestorm + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2012 Ansariel Hiller @ Second Life + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FS_FSCOMMON_H +#define FS_FSCOMMON_H + +#include "llchat.h" + +void reportToNearbyChat(const std::string& message); + +#endif // FS_FSCOMMON_H \ No newline at end of file diff --git a/indra/newview/fslslpreproc.cpp b/indra/newview/fslslpreproc.cpp index 557b5e5f84..e843eafefd 100644 --- a/indra/newview/fslslpreproc.cpp +++ b/indra/newview/fslslpreproc.cpp @@ -52,6 +52,8 @@ #include "llvoavatarself.h" // NaCl End +#include "fscommon.h" + #ifdef __GNUC__ // There is a sprintf( ... "%d", size_t_value) buried inside boost::wave. In order to not mess with system header, I rather disable that warning here. #pragma GCC diagnostic ignored "-Wformat" @@ -101,8 +103,6 @@ LLUUID FSLSLPreprocessor::findInventoryByName(std::string name) } -////void cmdline_printchat(std::string message); - std::map FSLSLPreprocessor::cached_assetids; #if !defined(LL_DARWIN) || defined(DARWINPREPROC) @@ -171,7 +171,7 @@ std::string FSLSLPreprocessor::decode(std::string script) if(tip != encode_start) { - //cmdline_printchat("no start"); + //reportToNearbyChat("no start"); //if(sp != -1)trigger warningg/error? return script; } @@ -181,13 +181,13 @@ std::string FSLSLPreprocessor::decode(std::string script) if(end == -1) { - //cmdline_printchat("no end"); + //reportToNearbyChat("no end"); return script; } std::string data = script.substr(startpoint,end-startpoint); - //cmdline_printchat("data="+data); + //reportToNearbyChat("data="+data); std::string otext = data; @@ -334,7 +334,7 @@ std::string FSLSLPreprocessor::lslopt(std::string script) int pos = TOPfmatch.position(boost::match_results::size_type(0)); std::string funcb = scopeript2(top, pos); functions[funcname] = funcb; - //cmdline_printchat("func "+funcname+" added to list["+funcb+"]"); + //reportToNearbyChat("func "+funcname+" added to list["+funcb+"]"); top.erase(pos,funcb.size()); } @@ -410,12 +410,12 @@ std::string FSLSLPreprocessor::lslopt(std::string script) std::string err = "not a valid regular expression: \""; err += e.what(); err += "\"; optimization skipped"; - ////cmdline_printchat(err); + ////reportToNearbyChat(err); } catch (...) { - ////cmdline_printchat("unexpected exception caught; optimization skipped"); + ////reportToNearbyChat("unexpected exception caught; optimization skipped"); } return script; } @@ -432,12 +432,12 @@ std::string FSLSLPreprocessor::lslcomp(std::string script) std::string err = "not a valid regular expression: \""; err += e.what(); err += "\"; compression skipped"; - ////cmdline_printchat(err); + ////reportToNearbyChat(err); } catch (...) { - ////cmdline_printchat("unexpected exception caught; compression skipped"); + ////reportToNearbyChat("unexpected exception caught; compression skipped"); } return script; } @@ -474,7 +474,7 @@ public: std::string const &filename, bool include_next) { std::string cfilename = filename.substr(1,filename.length()-2); - //cmdline_printchat(cfilename+":found_include_directive"); + //reportToNearbyChat(cfilename+":found_include_directive"); LLUUID item_id = FSLSLPreprocessor::findInventoryByName(cfilename); if(item_id.notNull()) { @@ -589,7 +589,7 @@ void cache_script(std::string name, std::string content) { content += "\n";/*hack!*/ - //cmdline_printchat("writing "+name+" to cache"); + //reportToNearbyChat("writing "+name+" to cache"); std::string path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"lslpreproc",name); LLAPRFile infile(path.c_str(), LL_APR_WB); apr_file_t *fp = infile.getFileHandle(); @@ -601,7 +601,7 @@ void FSLSLPreprocessor::FSProcCacheCallback(LLVFS *vfs, const LLUUID& iuuid, LLA { LLUUID uuid = iuuid; - //cmdline_printchat("cachecallback called"); + //reportToNearbyChat("cachecallback called"); ProcCacheInfo* info =(ProcCacheInfo*)userdata; LLViewerInventoryItem* item = info->item; FSLSLPreprocessor* self = info->self; @@ -626,13 +626,13 @@ void FSLSLPreprocessor::FSProcCacheCallback(LLVFS *vfs, const LLUUID& iuuid, LLA delete buffer; if(boost::filesystem::native(name)) { - //cmdline_printchat("native name of "+name); + //reportToNearbyChat("native name of "+name); self->mCore->mErrorList->setCommentText(std::string("Cached ")+name); cache_script(name, content); std::set::iterator loc = self->caching_files.find(name); if(loc != self->caching_files.end()) { - //cmdline_printchat("finalizing cache"); + //reportToNearbyChat("finalizing cache"); self->caching_files.erase(loc); //self->cached_files.insert(name); if(uuid.isNull())uuid.generate(); @@ -641,7 +641,7 @@ void FSLSLPreprocessor::FSProcCacheCallback(LLVFS *vfs, const LLUUID& iuuid, LLA self->start_process(); }else { - ////cmdline_printchat("something fucked"); + ////reportToNearbyChat("something fucked"); } }else self->mCore->mErrorList->setCommentText(std::string("Error: script named '")+name+"' isn't safe to copy to the filesystem. This include will fail."); }else @@ -782,10 +782,10 @@ std::string reformat_switch_statements(std::string script) //arg *will have* () around it if(arg == "begin out of bounds" || arg == "end out of bounds") { - ////cmdline_printchat(arg); + ////reportToNearbyChat(arg); break; } - //cmdline_printchat("arg=["+arg+"]"); + //reportToNearbyChat("arg=["+arg+"]"); std::string rstate = scopeript2(buffer, res+slen+arg.length()-1); int cutlen = slen; @@ -798,7 +798,7 @@ std::string reformat_switch_statements(std::string script) //rip off the scope edges int slicestart = rstate.find("{")+1; rstate = rstate.substr(slicestart,(rstate.rfind("}")-slicestart)-1); - //cmdline_printchat("rstate=["+rstate+"]"); + //reportToNearbyChat("rstate=["+rstate+"]"); @@ -820,19 +820,19 @@ std::string reformat_switch_statements(std::string script) if(case_end != -1) { std::string casearg = rstate.substr(case_start+caselen,case_end-(case_start+caselen)); - //cmdline_printchat("casearg=["+casearg+"]"); + //reportToNearbyChat("casearg=["+casearg+"]"); std::string label = quicklabel(); ifs[casearg] = label; - //cmdline_printchat("BEFORE["+rstate+"]"); + //reportToNearbyChat("BEFORE["+rstate+"]"); bool addcurl = (case_end == next_curl ? 1 : 0); label = "@"+label+";\n"; if(addcurl)label += "{"; rstate.erase(case_start,(case_end-case_start) + 1); rstate.insert(case_start,label); - //cmdline_printchat("AFTER["+rstate+"]"); + //reportToNearbyChat("AFTER["+rstate+"]"); }else { - ////cmdline_printchat("error in regex case_end != -1"); + ////reportToNearbyChat("error in regex case_end != -1"); rstate.erase(case_start,caselen); rstate.insert(case_start,"error; cannot find { or :"); } @@ -860,7 +860,7 @@ std::string reformat_switch_statements(std::string script) arg = argl; }else { - cmdline_printchat("type="+type); + reportToNearbyChat("type="+type); }*/ std::map::iterator ifs_it; @@ -881,7 +881,7 @@ std::string reformat_switch_statements(std::string script) } rstate = rstate + "}"; - //cmdline_printchat("replacing["+buffer.substr(res,cutlen)+"] with ["+rstate+"]"); + //reportToNearbyChat("replacing["+buffer.substr(res,cutlen)+"] with ["+rstate+"]"); buffer.erase(res,cutlen); buffer.insert(res,rstate); @@ -899,11 +899,11 @@ std::string reformat_switch_statements(std::string script) std::string err = "not a valid regular expression: \""; err += e.what(); err += "\"; switch statements skipped"; - ////cmdline_printchat(err); + ////reportToNearbyChat(err); } catch (...) { - ////cmdline_printchat("unexpected exception caught; buffer=["+buffer+"]"); + ////reportToNearbyChat("unexpected exception caught; buffer=["+buffer+"]"); } } return script; @@ -913,7 +913,7 @@ void FSLSLPreprocessor::start_process() { if(waving) { - ////cmdline_printchat("already waving?"); + ////reportToNearbyChat("already waving?"); return; } waving = TRUE; @@ -952,7 +952,7 @@ void FSLSLPreprocessor::start_process() //display the settings mCore->mErrorList->setCommentText(std::string(settings)); - ////cmdline_printchat(settings); + ////reportToNearbyChat(settings); BOOL errored = FALSE; std::string err; try @@ -1041,7 +1041,7 @@ void FSLSLPreprocessor::start_process() errored = TRUE; // some preprocessing error err = name + "(" + llformat("%d",e.line_no()) + "): " + e.description(); - ////cmdline_printchat(err); + ////reportToNearbyChat(err); mCore->mErrorList->setCommentText(err); } catch(std::exception const& e) @@ -1050,7 +1050,7 @@ void FSLSLPreprocessor::start_process() errored = TRUE; err = std::string(current_position.get_file().c_str()) + "(" + llformat("%d",current_position.get_line()) + "): "; err += std::string("exception caught: ") + e.what(); - ////cmdline_printchat(err); + ////reportToNearbyChat(err); mCore->mErrorList->setCommentText(err); } catch (...) @@ -1059,7 +1059,7 @@ void FSLSLPreprocessor::start_process() errored = TRUE; err = std::string(current_position.get_file().c_str()) + llformat("%d",current_position.get_line()); err += std::string("): unexpected exception caught."); - ////cmdline_printchat(err); + ////reportToNearbyChat(err); mCore->mErrorList->setCommentText(err); } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 941f14f873..346f0e2f5f 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -85,6 +85,8 @@ #include "fslslbridge.h" #include "fslslbridgerequest.h" #include "lltracker.h" +#include "fscommon.h" + using namespace std; using namespace boost; @@ -1575,17 +1577,6 @@ void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_si button->setClickedCallback(cb); } -void LLPanelPeople::reportToNearbyChat(std::string message) -// small utility method for radar alerts. -{ - LLChat chat; - chat.mText = message; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); -} - void LLPanelPeople::updateButtons() { std::string cur_tab = getActiveTabName(); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 558d0a66d9..d6ea3e9d8a 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -112,7 +112,6 @@ private: void buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb); void showGroupMenu(LLMenuGL* menu); void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true); - void reportToNearbyChat(std::string message); void handleLimitRadarByRange(const LLSD& newalue); std::string getRadarName(LLUUID avId); std::string getRadarName(LLAvatarName avName); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ad02b899bb..d05728f3a8 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -306,7 +306,6 @@ void apply_udp_blacklist(const std::string& csv); bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y); // Aurora Sim void transition_back_to_login_panel(const std::string& emsg); -void cmdline_printchat(std::string message); void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a0b6f25474..0f7e638d9d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -130,6 +130,7 @@ //-TT Client LSL Bridge #include "fslslbridge.h" //-TT +#include "fscommon.h" // ## Zi: Texture Refresh #include "llavatarpropertiesprocessor.h" @@ -373,8 +374,6 @@ static LLMenuParcelObserver* gMenuParcelObserver = NULL; static LLUIListener sUIListener; -void cmdline_printchat(std::string message); - LLMenuParcelObserver::LLMenuParcelObserver() { LLViewerParcelMgr::getInstance()->addObserver(this); @@ -740,7 +739,7 @@ class LLAdvancedToggleHUDInfo : public view_listener_t } else if ("badge" == info_type) { - cmdline_printchat("hippos!"); + reportToNearbyChat("hippos!"); } return true; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a3391b9851..b9d14c2e90 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -148,7 +148,7 @@ const static boost::regex NEWLINES("\\n{1}"); #include "llpanelpeople.h" // [/AO] #include "tea.h" // -#include "chatbar_as_cmdline.h" +#include "fscommon.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -7172,7 +7172,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use action = LLTrans::getString("Collision_UnknownType", args); return; } - cmdline_printchat(action); + reportToNearbyChat(action); } // Nearby Chat Collision Messages // Report Collision Messages to scripts diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index ba2f0de754..4fdd65abfd 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -58,7 +58,6 @@ const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds LLViewerThrottle gViewerThrottle; -void cmdline_printchat(std::string message);// FIRE-6340, FIRE-6567 - Setting Bandwidth issues // static const std:: string LLViewerThrottle::sNames[TC_EOF] = { diff --git a/indra/newview/qtoolalign.cpp b/indra/newview/qtoolalign.cpp index 8e110ab047..11e7d8351a 100644 --- a/indra/newview/qtoolalign.cpp +++ b/indra/newview/qtoolalign.cpp @@ -25,6 +25,7 @@ #include "llviewerwindow.h" #include "lleventtimer.h" +#include "fscommon.h" const F32 MANIPULATOR_SIZE = 5.0; const F32 MANIPULATOR_SELECT_SIZE = 20.0; @@ -32,7 +33,6 @@ const F32 MANIPULATOR_SELECT_SIZE = 20.0; AlignThread* AlignThread::sInstance = NULL; -void cmdline_printchat(std::string message); QToolAlign::QToolAlign() : LLTool(std::string("Align")) @@ -454,11 +454,11 @@ void QToolAlign::align() { if(AlignThread::sInstance) { - cmdline_printchat("The align tool is still working."); + reportToNearbyChat("The align tool is still working."); } else { - cmdline_printchat("Please hold, the align tool is busy working."); + reportToNearbyChat("Please hold, the align tool is busy working."); AlignThread::sInstance = new AlignThread(); AlignThread::sInstance->start(); } @@ -479,7 +479,7 @@ public: delete AlignThread::sInstance; AlignThread::sInstance = NULL; LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); - cmdline_printchat("The align tool is finished."); + reportToNearbyChat("The align tool is finished."); return TRUE; } };