Gave some much-needed love to the message logger and builder, fixed invisible icon in both and added the circuit chooser for the message builder
This commit is contained in:
@@ -11,8 +11,30 @@
|
|||||||
#include "llselectmgr.h" // fill in stuff about selected object
|
#include "llselectmgr.h" // fill in stuff about selected object
|
||||||
#include "llparcel.h"
|
#include "llparcel.h"
|
||||||
#include "llviewerparcelmgr.h" // same for parcel
|
#include "llviewerparcelmgr.h" // same for parcel
|
||||||
|
#include "llscrolllistctrl.h"
|
||||||
|
#include "llworld.h"
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
// LLNetListItem
|
||||||
|
////////////////////////////////
|
||||||
|
LLNetListItem::LLNetListItem(LLUUID id)
|
||||||
|
: mID(id),
|
||||||
|
mAutoName(TRUE),
|
||||||
|
mName("No name"),
|
||||||
|
mPreviousRegionName(""),
|
||||||
|
mCircuitData(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
// LLFloaterMessageBuilder
|
||||||
|
////////////////////////////////
|
||||||
|
std::list<LLNetListItem*> LLFloaterMessageBuilder::sNetListItems;
|
||||||
|
|
||||||
LLFloaterMessageBuilder::LLFloaterMessageBuilder(std::string initial_text)
|
LLFloaterMessageBuilder::LLFloaterMessageBuilder(std::string initial_text)
|
||||||
: LLFloater(),
|
: LLFloater(),
|
||||||
|
LLEventTimer(1.0f),
|
||||||
|
mNetInfoMode(NI_NET),
|
||||||
mInitialText(initial_text)
|
mInitialText(initial_text)
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_message_builder.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_message_builder.xml");
|
||||||
@@ -24,6 +46,119 @@ void LLFloaterMessageBuilder::show(std::string initial_text)
|
|||||||
{
|
{
|
||||||
(new LLFloaterMessageBuilder(initial_text))->open();
|
(new LLFloaterMessageBuilder(initial_text))->open();
|
||||||
}
|
}
|
||||||
|
BOOL LLFloaterMessageBuilder::tick()
|
||||||
|
{
|
||||||
|
refreshNetList();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
LLNetListItem* LLFloaterMessageBuilder::findNetListItem(LLHost host)
|
||||||
|
{
|
||||||
|
std::list<LLNetListItem*>::iterator end = sNetListItems.end();
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != end; ++iter)
|
||||||
|
if((*iter)->mCircuitData && (*iter)->mCircuitData->getHost() == host)
|
||||||
|
return (*iter);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
LLNetListItem* LLFloaterMessageBuilder::findNetListItem(LLUUID id)
|
||||||
|
{
|
||||||
|
std::list<LLNetListItem*>::iterator end = sNetListItems.end();
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != end; ++iter)
|
||||||
|
if((*iter)->mID == id)
|
||||||
|
return (*iter);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
void LLFloaterMessageBuilder::refreshNetList()
|
||||||
|
{
|
||||||
|
LLScrollListCtrl* scrollp = getChild<LLScrollListCtrl>("net_list");
|
||||||
|
// Update circuit data of net list items
|
||||||
|
std::vector<LLCircuitData*> circuits = gMessageSystem->getCircuit()->getCircuitDataList();
|
||||||
|
std::vector<LLCircuitData*>::iterator circuits_end = circuits.end();
|
||||||
|
for(std::vector<LLCircuitData*>::iterator iter = circuits.begin(); iter != circuits_end; ++iter)
|
||||||
|
{
|
||||||
|
LLNetListItem* itemp = findNetListItem((*iter)->getHost());
|
||||||
|
if(!itemp)
|
||||||
|
{
|
||||||
|
LLUUID id; id.generate();
|
||||||
|
itemp = new LLNetListItem(id);
|
||||||
|
sNetListItems.push_back(itemp);
|
||||||
|
}
|
||||||
|
itemp->mCircuitData = (*iter);
|
||||||
|
}
|
||||||
|
// Clear circuit data of items whose circuits are gone
|
||||||
|
std::list<LLNetListItem*>::iterator items_end = sNetListItems.end();
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
|
||||||
|
{
|
||||||
|
if(std::find(circuits.begin(), circuits.end(), (*iter)->mCircuitData) == circuits.end())
|
||||||
|
(*iter)->mCircuitData = NULL;
|
||||||
|
}
|
||||||
|
// Remove net list items that are totally useless now
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != sNetListItems.end();)
|
||||||
|
{
|
||||||
|
if((*iter)->mCircuitData == NULL)
|
||||||
|
iter = sNetListItems.erase(iter);
|
||||||
|
else ++iter;
|
||||||
|
}
|
||||||
|
// Update names of net list items
|
||||||
|
items_end = sNetListItems.end();
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
|
||||||
|
{
|
||||||
|
LLNetListItem* itemp = (*iter);
|
||||||
|
if(itemp->mAutoName)
|
||||||
|
{
|
||||||
|
if(itemp->mCircuitData)
|
||||||
|
{
|
||||||
|
LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(itemp->mCircuitData->getHost());
|
||||||
|
if(regionp)
|
||||||
|
{
|
||||||
|
std::string name = regionp->getName();
|
||||||
|
if(name == "") name = llformat("%s (awaiting region name)", itemp->mCircuitData->getHost().getString().c_str());
|
||||||
|
itemp->mName = name;
|
||||||
|
itemp->mPreviousRegionName = name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemp->mName = itemp->mCircuitData->getHost().getString();
|
||||||
|
if(itemp->mPreviousRegionName != "")
|
||||||
|
itemp->mName.append(llformat(" (was %s)", itemp->mPreviousRegionName.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// an item just for an event queue, not handled yet
|
||||||
|
itemp->mName = "Something else";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Rebuild scroll list from scratch
|
||||||
|
LLUUID selected_id = scrollp->getFirstSelected() ? scrollp->getFirstSelected()->getUUID() : LLUUID::null;
|
||||||
|
S32 scroll_pos = scrollp->getScrollPos();
|
||||||
|
scrollp->clearRows();
|
||||||
|
for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
|
||||||
|
{
|
||||||
|
LLNetListItem* itemp = (*iter);
|
||||||
|
LLSD element;
|
||||||
|
element["id"] = itemp->mID;
|
||||||
|
LLSD& text_column = element["columns"][0];
|
||||||
|
text_column["column"] = "text";
|
||||||
|
text_column["value"] = itemp->mName + (itemp->mCircuitData->getHost() == gAgent.getRegionHost() ? " (main)" : "");
|
||||||
|
|
||||||
|
LLSD& state_column = element["columns"][ 1];
|
||||||
|
state_column["column"] = "state";
|
||||||
|
state_column["value"] = "";
|
||||||
|
|
||||||
|
LLScrollListItem* scroll_itemp = scrollp->addElement(element);
|
||||||
|
BOOL has_live_circuit = itemp->mCircuitData && itemp->mCircuitData->isAlive();
|
||||||
|
|
||||||
|
LLScrollListText* state = (LLScrollListText*)scroll_itemp->getColumn(1);
|
||||||
|
|
||||||
|
if(has_live_circuit)
|
||||||
|
state->setText(std::string("Alive"));
|
||||||
|
else
|
||||||
|
state->setText(std::string("Alive"));
|
||||||
|
}
|
||||||
|
if(selected_id.notNull()) scrollp->selectByID(selected_id);
|
||||||
|
if(scroll_pos < scrollp->getItemCount()) scrollp->setScrollPos(scroll_pos);
|
||||||
|
}
|
||||||
BOOL LLFloaterMessageBuilder::postBuild()
|
BOOL LLFloaterMessageBuilder::postBuild()
|
||||||
{
|
{
|
||||||
childSetText("message_edit", mInitialText);
|
childSetText("message_edit", mInitialText);
|
||||||
@@ -785,7 +920,27 @@ void LLFloaterMessageBuilder::onClickSend(void* user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gMessageSystem->sendMessage(gAgent.getRegionHost());
|
|
||||||
|
LLScrollListCtrl* scrollp = floaterp->getChild<LLScrollListCtrl>("net_list");
|
||||||
|
LLScrollListItem* selected_itemp = scrollp->getFirstSelected();
|
||||||
|
|
||||||
|
//if a specific circuit is selected, send it to that, otherwise send it to the current sim
|
||||||
|
if(selected_itemp)
|
||||||
|
{
|
||||||
|
LLNetListItem* itemp = findNetListItem(selected_itemp->getUUID());
|
||||||
|
LLScrollListText* textColumn = (LLScrollListText*)selected_itemp->getColumn(1);
|
||||||
|
|
||||||
|
//why would you send data through a dead circuit?
|
||||||
|
if(textColumn->getValue().asString() == "Dead")
|
||||||
|
{
|
||||||
|
LLFloaterChat::addChat(LLChat("No sending messages through dead circuits!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gMessageSystem->sendMessage(itemp->mCircuitData->getHost());
|
||||||
|
} else {
|
||||||
|
gMessageSystem->sendMessage(gAgent.getRegionHost());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,13 +2,29 @@
|
|||||||
#ifndef LL_LLFLOATERMESSAGEBUILDER_H
|
#ifndef LL_LLFLOATERMESSAGEBUILDER_H
|
||||||
#define LL_LLFLOATERMESSAGEBUILDER_H
|
#define LL_LLFLOATERMESSAGEBUILDER_H
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
class LLFloaterMessageBuilder : public LLFloater
|
#include "lltemplatemessagereader.h"
|
||||||
|
#include "llmessagelog.h"
|
||||||
|
|
||||||
|
class LLNetListItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLNetListItem(LLUUID id);
|
||||||
|
LLUUID mID;
|
||||||
|
BOOL mAutoName;
|
||||||
|
std::string mName;
|
||||||
|
std::string mPreviousRegionName;
|
||||||
|
LLCircuitData* mCircuitData;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LLFloaterMessageBuilder : public LLFloater, public LLEventTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLFloaterMessageBuilder(std::string initial_text);
|
LLFloaterMessageBuilder(std::string initial_text);
|
||||||
~LLFloaterMessageBuilder();
|
~LLFloaterMessageBuilder();
|
||||||
static void show(std::string initial_text);
|
static void show(std::string initial_text);
|
||||||
|
static std::list<LLNetListItem*> sNetListItems;
|
||||||
BOOL postBuild();
|
BOOL postBuild();
|
||||||
|
BOOL tick();
|
||||||
static BOOL addField(e_message_variable_type var_type, const char* var_name, std::string input, BOOL hex);
|
static BOOL addField(e_message_variable_type var_type, const char* var_name, std::string input, BOOL hex);
|
||||||
static void onClickSend(void* user_data);
|
static void onClickSend(void* user_data);
|
||||||
static void onCommitPacketCombo(LLUICtrl* ctrl, void* user_data);
|
static void onCommitPacketCombo(LLUICtrl* ctrl, void* user_data);
|
||||||
@@ -27,6 +43,13 @@ public:
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::vector<parts_var> vars;
|
std::vector<parts_var> vars;
|
||||||
};
|
};
|
||||||
|
static LLNetListItem* findNetListItem(LLHost host);
|
||||||
|
static LLNetListItem* findNetListItem(LLUUID id);
|
||||||
|
void refreshNetList();
|
||||||
|
enum ENetInfoMode { NI_NET, NI_LOG };
|
||||||
|
ENetInfoMode mNetInfoMode;
|
||||||
|
static void onCommitMessageLog(LLUICtrl* ctrl, void* user_data);
|
||||||
|
static void onCommitFilter(LLUICtrl* ctrl, void* user_data);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|||||||
@@ -13,17 +13,6 @@
|
|||||||
#include "llfloatermessagebuilder.h"
|
#include "llfloatermessagebuilder.h"
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// LLNetListItem
|
|
||||||
////////////////////////////////
|
|
||||||
LLNetListItem::LLNetListItem(LLUUID id)
|
|
||||||
: mID(id),
|
|
||||||
mAutoName(TRUE),
|
|
||||||
mName("No name"),
|
|
||||||
mPreviousRegionName(""),
|
|
||||||
mCircuitData(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
////////////////////////////////
|
|
||||||
// LLFloaterMessageLogItem
|
// LLFloaterMessageLogItem
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
#define MAX_PACKET_LEN (0x2000)
|
#define MAX_PACKET_LEN (0x2000)
|
||||||
@@ -619,7 +608,7 @@ void LLFloaterMessageLog::refreshNetList()
|
|||||||
LLSD& text_column = element["columns"][0];
|
LLSD& text_column = element["columns"][0];
|
||||||
text_column["column"] = "text";
|
text_column["column"] = "text";
|
||||||
text_column["value"] = itemp->mName + (itemp->mCircuitData->getHost() == gAgent.getRegionHost() ? " (main)" : "");
|
text_column["value"] = itemp->mName + (itemp->mCircuitData->getHost() == gAgent.getRegionHost() ? " (main)" : "");
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
LLSD& icon_column = element["columns"][i + 1];
|
LLSD& icon_column = element["columns"][i + 1];
|
||||||
icon_column["column"] = llformat("icon%d", i);
|
icon_column["column"] = llformat("icon%d", i);
|
||||||
@@ -630,18 +619,18 @@ void LLFloaterMessageLog::refreshNetList()
|
|||||||
BOOL has_live_circuit = itemp->mCircuitData && itemp->mCircuitData->isAlive();
|
BOOL has_live_circuit = itemp->mCircuitData && itemp->mCircuitData->isAlive();
|
||||||
if(has_live_circuit)
|
if(has_live_circuit)
|
||||||
{
|
{
|
||||||
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2);
|
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
|
||||||
icon->setValue("icon_net_close_circuit.tga");
|
icon->setValue("icon_net_close_circuit.tga");
|
||||||
icon->setClickCallback(onClickCloseCircuit, itemp);
|
icon->setClickCallback(onClickCloseCircuit, itemp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2);
|
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
|
||||||
icon->setValue("icon_net_close_circuit_gray.tga");
|
icon->setValue("icon_net_close_circuit_gray.tga");
|
||||||
icon->setClickCallback(NULL, NULL);
|
icon->setClickCallback(NULL, NULL);
|
||||||
}
|
}
|
||||||
// Event queue isn't even supported yet... FIXME
|
// Event queue isn't even supported yet... FIXME
|
||||||
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(3);
|
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2);
|
||||||
icon->setValue("icon_net_close_eventpoll_gray.tga");
|
icon->setValue("icon_net_close_eventpoll_gray.tga");
|
||||||
icon->setClickCallback(NULL, NULL);
|
icon->setClickCallback(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,8 @@
|
|||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
#include "llmessagelog.h"
|
#include "llmessagelog.h"
|
||||||
#include "lltemplatemessagereader.h"
|
#include "lltemplatemessagereader.h"
|
||||||
class LLNetListItem
|
#include "llfloatermessagebuilder.h"
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLNetListItem(LLUUID id);
|
|
||||||
LLUUID mID;
|
|
||||||
BOOL mAutoName;
|
|
||||||
std::string mName;
|
|
||||||
std::string mPreviousRegionName;
|
|
||||||
LLCircuitData* mCircuitData;
|
|
||||||
};
|
|
||||||
class LLFloaterMessageLogItem : public LLMessageLogEntry
|
class LLFloaterMessageLogItem : public LLMessageLogEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
<scroll_list column_padding="0" draw_heading="false" follows="left|top|right" left="10" top="-25"
|
<scroll_list column_padding="0" draw_heading="false" follows="left|top|right" left="10" top="-25"
|
||||||
name="net_list" search_column="0" right="-10" bottom="450">
|
name="net_list" search_column="0" right="-10" bottom="450">
|
||||||
<column dynamicwidth="true" name="text" label="text" />
|
<column dynamicwidth="true" name="text" label="text" />
|
||||||
<column name="icon0" label="icon0" width="24" />
|
<column name="state" label="state" width="24" />
|
||||||
<column name="icon1" label="icon1" width="24" />
|
|
||||||
<column name="icon2" label="icon2" width="24" />
|
|
||||||
</scroll_list>
|
</scroll_list>
|
||||||
<combo_box name="untrusted_message_combo" allow_text_entry="false" follows="left|top" left="10" top="-150" right="-370" bottom="433" tool_tip="No trust">
|
<combo_box name="untrusted_message_combo" allow_text_entry="false" follows="left|top" left="10" top="-150" right="-370" bottom="433" tool_tip="No trust">
|
||||||
</combo_box>
|
</combo_box>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
<column dynamicwidth="true" name="text" label="text" />
|
<column dynamicwidth="true" name="text" label="text" />
|
||||||
<column name="icon0" label="icon0" width="24" />
|
<column name="icon0" label="icon0" width="24" />
|
||||||
<column name="icon1" label="icon1" width="24" />
|
<column name="icon1" label="icon1" width="24" />
|
||||||
<column name="icon2" label="icon2" width="24" />
|
|
||||||
</scroll_list>
|
</scroll_list>
|
||||||
<button name="filter_choice_btn" follows="left|top" left="10" top="-150" right="-370" bottom="430" label="…"/>
|
<button name="filter_choice_btn" follows="left|top" left="10" top="-150" right="-370" bottom="430" label="…"/>
|
||||||
<line_editor name="filter_edit" follows="left|top|right" left="30" top="-149" right="-28" bottom="430" max_length="65535"/>
|
<line_editor name="filter_edit" follows="left|top|right" left="30" top="-149" right="-28" bottom="430" max_length="65535"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user