diff options
author | William Todd Stinson <stinson@lindenlab.com> | 2012-08-31 14:24:42 -0700 |
---|---|---|
committer | William Todd Stinson <stinson@lindenlab.com> | 2012-08-31 14:24:42 -0700 |
commit | 55b388b1a3994643c206aa31b3c155a47da02bef (patch) | |
tree | 45a84f44f6acc7d506fb226b6b3dba013d1c79cd /indra | |
parent | 53058ea6e71719c28b3df132dcbc62ef0138d1f3 (diff) |
Adding a scroll list to report the response from the Put request.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterstinson.cpp | 103 | ||||
-rw-r--r-- | indra/newview/llfloaterstinson.h | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_stinson.xml | 38 |
3 files changed, 123 insertions, 28 deletions
diff --git a/indra/newview/llfloaterstinson.cpp b/indra/newview/llfloaterstinson.cpp index 5da1d9b242..52a4c41d0d 100644 --- a/indra/newview/llfloaterstinson.cpp +++ b/indra/newview/llfloaterstinson.cpp @@ -62,6 +62,7 @@ #define MATERIALS_CAP_FACE_FIELD "Face" #define MATERIALS_CAP_MATERIAL_FIELD "Material" #define MATERIALS_CAP_OBJECT_ID_FIELD "ID" +#define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" #define MATERIALS_CAP_NORMAL_MAP_FIELD "NormMap" #define MATERIALS_CAP_SPECULAR_MAP_FIELD "SpecMap" @@ -116,12 +117,15 @@ BOOL LLFloaterStinson::postBuild() llassert(mGetButton != NULL); mGetButton->setCommitCallback(boost::bind(&LLFloaterStinson::onGetClicked, this)); + mGetScrollList = findChild<LLScrollListCtrl>("get_scroll_list"); + llassert(mGetScrollList != NULL); + mPutButton = findChild<LLButton>("put_button"); llassert(mPutButton != NULL); mPutButton->setCommitCallback(boost::bind(&LLFloaterStinson::onPutClicked, this)); - mMaterialsScrollList = findChild<LLScrollListCtrl>("materials_scroll_list"); - llassert(mMaterialsScrollList != NULL); + mPutScrollList = findChild<LLScrollListCtrl>("put_scroll_list"); + llassert(mPutScrollList != NULL); mWarningColor = LLUIColorTable::instance().getColor("MaterialWarningColor"); mErrorColor = LLUIColorTable::instance().getColor("MaterialErrorColor"); @@ -151,12 +155,14 @@ void LLFloaterStinson::onOpen(const LLSD& pKey) } checkRegionMaterialStatus(); - clearMaterialsList(); + clearGetResults(); + clearPutResults(); } void LLFloaterStinson::onClose(bool pIsAppQuitting) { - clearMaterialsList(); + clearGetResults(); + clearPutResults(); if (mSelectionUpdateConnection.connected()) { @@ -247,7 +253,7 @@ void LLFloaterStinson::onPutResponse(bool pRequestStatus, const LLSD& pContent) if (pRequestStatus) { setState(kRequestCompleted); - printResponse("PUT", pContent); + parsePutResponse(pContent); } else { @@ -458,7 +464,7 @@ void LLFloaterStinson::requestPutMaterials(const LLUUID& regionId) void LLFloaterStinson::parseGetResponse(const LLSD& pContent) { printResponse("GET", pContent); - clearMaterialsList(); + clearGetResults(); LLScrollListCell::Params cellParams; LLScrollListItem::Params rowParams; @@ -471,16 +477,7 @@ void LLFloaterStinson::parseGetResponse(const LLSD& pContent) llassert(material.isMap()); llassert(material.has(MATERIALS_CAP_OBJECT_ID_FIELD)); llassert(material.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); - - const LLSD::Binary &materialIDValue = material.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary(); - unsigned int valueSize = materialIDValue.size(); - - std::string materialID(reinterpret_cast<const char *>(&materialIDValue[0]), valueSize); - std::string materialIDString; - for (unsigned int i = 0; i < valueSize; ++i) - { - materialIDString += llformat("%02x", materialID.c_str()[i]); - } + std::string materialIDString = convertToPrintableMaterialID(material.get(MATERIALS_CAP_OBJECT_ID_FIELD)); llassert(material.has(MATERIALS_CAP_MATERIAL_FIELD)); const LLSD &materialData = material.get(MATERIALS_CAP_MATERIAL_FIELD); @@ -553,7 +550,54 @@ void LLFloaterStinson::parseGetResponse(const LLSD& pContent) cellParams.value = (isDiffuseAlphaMask ? "True" : "False"); rowParams.columns.add(cellParams); - mMaterialsScrollList->addRow(rowParams); + mGetScrollList->addRow(rowParams); + } +} + +void LLFloaterStinson::parsePutResponse(const LLSD& pContent) +{ + printResponse("PUT", pContent); + clearPutResults(); + + LLScrollListCell::Params cellParams; + LLScrollListItem::Params rowParams; + + llassert(pContent.isArray()); + for (LLSD::array_const_iterator faceIter = pContent.beginArray(); faceIter != pContent.endArray(); + ++faceIter) + { + const LLSD &face = *faceIter; + llassert(face.isMap()); + + llassert(face.has(MATERIALS_CAP_FACE_FIELD)); + llassert(face.get(MATERIALS_CAP_FACE_FIELD).isInteger()); + S32 faceId = face.get(MATERIALS_CAP_FACE_FIELD).asInteger(); + + llassert(face.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(face.get(MATERIALS_CAP_OBJECT_ID_FIELD).isInteger()); + S32 objectId = face.get(MATERIALS_CAP_OBJECT_ID_FIELD).asInteger(); + + llassert(face.has(MATERIALS_CAP_MATERIAL_ID_FIELD)); + llassert(face.get(MATERIALS_CAP_MATERIAL_ID_FIELD).isBinary()); + std::string materialIDString = convertToPrintableMaterialID(face.get(MATERIALS_CAP_MATERIAL_ID_FIELD)); + + cellParams.font = LLFontGL::getFontMonospace(); + + cellParams.column = "material_id"; + cellParams.value = materialIDString; + rowParams.columns.add(cellParams); + + cellParams.font = LLFontGL::getFontSansSerif(); + + cellParams.column = "object_id"; + cellParams.value = llformat("%d", objectId); + rowParams.columns.add(cellParams); + + cellParams.column = "face_index"; + cellParams.value = llformat("%d", faceId); + rowParams.columns.add(cellParams); + + mPutScrollList->addRow(rowParams); } } @@ -571,9 +615,14 @@ void LLFloaterStinson::setState(EState pState) updateControls(); } -void LLFloaterStinson::clearMaterialsList() +void LLFloaterStinson::clearGetResults() { - mMaterialsScrollList->deleteAllItems(); + mGetScrollList->deleteAllItems(); +} + +void LLFloaterStinson::clearPutResults() +{ + mPutScrollList->deleteAllItems(); } void LLFloaterStinson::updateStatusMessage() @@ -646,6 +695,22 @@ void LLFloaterStinson::updateControls() } } +std::string LLFloaterStinson::convertToPrintableMaterialID(const LLSD& pBinaryHash) const +{ + llassert(pBinaryHash.isBinary()); + const LLSD::Binary &materialIDValue = pBinaryHash.asBinary(); + unsigned int valueSize = materialIDValue.size(); + + std::string materialID(reinterpret_cast<const char *>(&materialIDValue[0]), valueSize); + std::string materialIDString; + for (unsigned int i = 0; i < valueSize; ++i) + { + materialIDString += llformat("%02x", materialID.c_str()[i]); + } + + return materialIDString; +} + MaterialsGetResponder::MaterialsGetResponder(const std::string& pCapabilityURL, CallbackFunction pCallback) : LLHTTPClient::Responder(), mCapabilityURL(pCapabilityURL), diff --git a/indra/newview/llfloaterstinson.h b/indra/newview/llfloaterstinson.h index 5b8f157cd0..916f55c5ab 100644 --- a/indra/newview/llfloaterstinson.h +++ b/indra/newview/llfloaterstinson.h @@ -27,6 +27,8 @@ #ifndef LL_LLFLOATERSTINSON_H #define LL_LLFLOATERSTINSON_H +#include <string> + #include <boost/signals2.hpp> #include "llfloater.h" @@ -84,20 +86,24 @@ private: void requestPutMaterials(const LLUUID& regionId); void parseGetResponse(const LLSD& pContent); + void parsePutResponse(const LLSD& pContent); void printResponse(const std::string& pRequestType, const LLSD& pContent) const; void setState(EState pState); inline EState getState() const; - void clearMaterialsList(); + void clearGetResults(); + void clearPutResults(); void updateStatusMessage(); void updateControls(); + std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const; LLTextBase* mStatusText; LLButton* mGetButton; + LLScrollListCtrl* mGetScrollList; LLButton* mPutButton; - LLScrollListCtrl* mMaterialsScrollList; + LLScrollListCtrl* mPutScrollList; EState mState; LLColor4 mWarningColor; diff --git a/indra/newview/skins/default/xui/en/floater_stinson.xml b/indra/newview/skins/default/xui/en/floater_stinson.xml index 559e6eb48f..fc44615602 100644 --- a/indra/newview/skins/default/xui/en/floater_stinson.xml +++ b/indra/newview/skins/default/xui/en/floater_stinson.xml @@ -3,9 +3,9 @@ positioning="cascading" can_tear_off="false" can_resize="true" - height="315" + height="425" width="1194" - min_height="315" + min_height="450" min_width="1100" layout="topleft" name="floater_stinson" @@ -92,10 +92,10 @@ top_pad="10" tab_stop="false" multi_select="true" - name="materials_scroll_list" + name="get_scroll_list" width="1170"> <scroll_list.columns - label="ID" + label="Material ID" name="id" dynamic_width="true" /> <scroll_list.columns @@ -140,12 +140,12 @@ <panel border="false" bevel_style="none" - follows="left|top" + follows="left|top|right" layout="topleft" left="12" top_pad="10" - height="22" - width="214"> + height="132" + width="700"> <button follows="left|top" height="22" @@ -154,5 +154,29 @@ name="put_button" top_pad="0" width="214"/> + <scroll_list + column_padding="0" + draw_heading="true" + follows="left|top|right" + height="100" + layout="topleft" + top_pad="10" + tab_stop="false" + multi_select="true" + name="put_scroll_list" + width="700"> + <scroll_list.columns + label="Object ID" + name="object_id" + width="80" /> + <scroll_list.columns + label="Face Index" + name="face_index" + width="70" /> + <scroll_list.columns + label="MaterialID" + name="material_id" + dynamic_width="true" /> + </scroll_list> </panel> </floater> |