LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, const char* message, const char* from_name, const LLUUID& group_id, const LLUUID& group_insignia, const char* group_name, const U32& t, const bool& has_inventory, const char* inventory_name, LLOfferInfo* inventory_offer) : LLPanel("groupnotify", LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(inventory_offer) { mIsFocusRoot = TRUE; time_t timestamp = (time_t)t; if (!timestamp) time(×tamp); std::string timestr; timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), timestr); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); // TODO: add a color for group notices setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; const S32 VPAD = 2; const S32 TOP = mRect.getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = mRect.getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; S32 y = TOP; S32 x = HPAD + HPAD; // Title LLTextBox* line; line = new LLTextBox("title",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),"Group Notice",LLFontGL::sSansSerifHuge); line->setHAlign(LLFontGL::RIGHT); line->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); line->setBorderVisible(FALSE); line->setColor(LLColor4::white); line->setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); addChild(line); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << "Sent by " << from_name << ", " << group_name; line = new LLTextBox("group",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str().c_str(),LLFontGL::sSansSerif); line->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); line->setHAlign(LLFontGL::RIGHT); line->setBorderVisible(FALSE); line->setColor(LLColor4::white); line->setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); addChild(line); y -= (LINE_HEIGHT + VPAD); LLUUID icon_id(gViewerArt.getString("notify_box_icon.tga")); // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon_id = group_insignia; } x = HPAD + HPAD; icon = new LLIconCtrl("icon", LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), icon_id); icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor("box", LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, "", LLFontGL::sSansSerif, FALSE); LLStyle headerstyle(true,LLColor4::black,"SansSerifBig"); LLStyle datestyle(true,LLColor4::black,"serif"); text->appendStyledText(subject,false,false,&headerstyle); text->appendStyledText(timestr.c_str(),false,false,&datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(" ",false,false,LLColor4::grey4); text->appendColoredText(message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setTabToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { line = new LLTextBox("subjecttitle",LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),"Attached: ",LLFontGL::sSansSerif); line->setBorderVisible(FALSE); line->setColor(LLColor4::white); line->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); line->setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); addChild(line); LLViewerImage* item_icon = get_item_icon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; line = new LLTextBox("object_name",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str().c_str(),LLFontGL::sSansSerif); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl("icon", LLRect(x, y, x+16, y-16), item_icon->getID()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton("next", LLRect(mRect.getWidth()-24, BOTTOM_PAD+16, mRect.getWidth()-8, BOTTOM_PAD), "notify_next.tga", "notify_next.tga", "", onClickNext, this, LLFontGL::sSansSerif); btn->setToolTip(LLString("Next")); // *TODO: Translate addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton("OK", btn_rect, "", onClickOk, this); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton("Group Notices", btn_rect, "", onClickGroupInfo, this); btn->setToolTip(LLString("View past notices or opt-out of receiving these messages here.")); // TODO: Translate addChild(btn, -1); if (mHasInventory && mInventoryOffer) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); LLString btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = "Open Attachment"; } else { btn_lbl = "Save Attachment"; } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, "", onClickSaveInventory, this); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }
void LLFloaterInspect::refresh() { LLUUID creator_id; std::string creator_name; S32 pos = mObjectList->getScrollPos(); getChildView("button owner")->setEnabled(false); getChildView("button creator")->setEnabled(false); LLUUID selected_uuid; S32 selected_index = mObjectList->getFirstSelectedIndex(); if(selected_index > -1) { LLScrollListItem* first_selected = mObjectList->getFirstSelected(); if (first_selected) { selected_uuid = first_selected->getUUID(); } } mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE); //List all transient objects, then all linked objects for (LLObjectSelection::valid_iterator iter = mObjectSelection->valid_begin(); iter != mObjectSelection->valid_end(); iter++) { LLSelectNode* obj = *iter; LLSD row; std::string owner_name, creator_name, time, last_owner_name; if (obj->mCreationDate == 0) { // Don't have valid information from the server, so skip this one continue; } time_t timestamp = (time_t) (obj->mCreationDate/1000000); timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time); const LLUUID& idOwner = obj->mPermissions->getOwner(); const LLUUID& idCreator = obj->mPermissions->getCreator(); // <edit> const LLUUID& idLastOwner = obj->mPermissions->getLastOwner(); // </edit> LLAvatarName av_name; // Only work with the names if we actually get a result // from the name cache. If not, defer setting the // actual name and set a placeholder. if (LLAvatarNameCache::get(idOwner, &av_name)) { // owner_name = av_name.getCompleteName(); // [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a bool fRlvFilterOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idOwner != gAgent.getID()) && (!obj->mPermissions->isGroupOwned()); owner_name = (!fRlvFilterOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] } else { owner_name = LLTrans::getString("RetrievingData"); LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); } if (LLAvatarNameCache::get(idCreator, &av_name)) { // creator_name = av_name.getCompleteName(); // [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a const LLUUID& idCreator = obj->mPermissions->getCreator(); LLAvatarNameCache::get(idCreator, &av_name); bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idCreator != gAgent.getID()) && ( (obj->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator)) ); creator_name = (!fRlvFilterCreator) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] } else { creator_name = LLTrans::getString("RetrievingData"); LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); } // <edit> if (LLAvatarNameCache::get(idLastOwner, &av_name)) { // last_owner_name = av_name.getCompleteName(); // [RLVa:LF] - Copied from the above creator check Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a LLAvatarNameCache::get(idLastOwner, &av_name); bool fRlvFilterLastOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idLastOwner != gAgent.getID()) && ( (obj->mPermissions->getOwner() == idLastOwner) || (RlvUtil::isNearbyAgent(idLastOwner)) ); last_owner_name = (!fRlvFilterLastOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:LF] } else { last_owner_name = LLTrans::getString("RetrievingData"); LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); } // </edit> row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; // make sure we're either at the top of the link chain // or top of the editable chain, for attachments if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit())) { row["columns"][0]["value"] = std::string(" ") + obj->mName; } else { row["columns"][0]["value"] = obj->mName; } row["columns"][1]["column"] = "owner_name"; row["columns"][1]["type"] = "text"; row["columns"][1]["value"] = owner_name; // <edit> row["columns"][2]["column"] = "last_owner_name"; row["columns"][2]["type"] = "text"; row["columns"][2]["value"] = last_owner_name; // </edit> row["columns"][3]["column"] = "creator_name"; row["columns"][3]["type"] = "text"; row["columns"][3]["value"] = creator_name; // <edit> row["columns"][4]["column"] = "face_num"; row["columns"][4]["type"] = "text"; row["columns"][4]["value"] = llformat("%d",obj->getObject()->getNumFaces()); row["columns"][5]["column"] = "vertex_num"; row["columns"][5]["type"] = "text"; row["columns"][5]["value"] = llformat("%d",obj->getObject()->getNumVertices()); // inventory silliness S32 scripts,total_inv; std::map<LLUUID,std::pair<S32,S32> >::iterator itr = mInventoryNums.find(obj->getObject()->getID()); if(itr != mInventoryNums.end()) { scripts = itr->second.first; total_inv = itr->second.second; } else { scripts = 0; total_inv = 0; if(std::find(mQueue.begin(),mQueue.end(),obj->getObject()->getID()) == mQueue.end()) { mQueue.push_back(obj->getObject()->getID()); registerVOInventoryListener(obj->getObject(),NULL); requestVOInventory(); } } row["columns"][6]["column"] = "script_num"; row["columns"][6]["type"] = "text"; row["columns"][6]["value"] = llformat("%d",scripts); row["columns"][7]["column"] = "inv_num"; row["columns"][7]["type"] = "text"; row["columns"][7]["value"] = llformat("%d",total_inv); // </edit> row["columns"][8]["column"] = "creation_date"; row["columns"][8]["type"] = "text"; row["columns"][8]["value"] = time; mObjectList->addElement(row, ADD_TOP); } if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) { mObjectList->selectNthItem(selected_index); } else { mObjectList->selectNthItem(0); } onSelectObject(); mObjectList->setScrollPos(pos); }
void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) { // <edit> childSetText("EditItemID", item->getUUID().asString()); childSetText("EditFolderID", item->getParentUUID().asString()); childSetText("EditGroup", item->getPermissions().getGroup().asString()); childSetText("EditAssetID", item->getAssetUUID().asString()); std::string type_str = LLAssetType::lookup(item->getType()); if(type_str.c_str() == NULL) type_str = llformat("%d", item->getType()); childSetText("EditType", type_str); std::string invtype_str = LLInventoryType::lookup(item->getInventoryType()); if(invtype_str.c_str() == NULL) invtype_str = llformat("%d", item->getInventoryType()); childSetText("EditInvType", invtype_str); childSetText("EditFlags", llformat("%d", item->getFlags())); std::ostringstream strm; item->exportLegacyStream(strm, TRUE); std::string str(strm.str()); LLStringUtil::replaceTabsWithSpaces(str, 4); childSetText("item_text", str); // </edit> //////////////////////// // PERMISSIONS LOOKUP // //////////////////////// // do not enable the UI for incomplete items. LLViewerInventoryItem* i = (LLViewerInventoryItem*)item; BOOL is_complete = i->isComplete(); const LLPermissions& perm = item->getPermissions(); BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_SET_SALE); // You need permission to modify the object to modify an inventory // item in it. LLViewerObject* object = NULL; if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID); BOOL is_obj_modify = TRUE; if(object) { is_obj_modify = object->permOwnerModify(); } ////////////////////// // ITEM NAME & DESC // ////////////////////// BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) && is_obj_modify && is_complete; childSetEnabled("LabelItemNameTitle",TRUE); childSetEnabled("LabelItemName",is_modifiable); childSetText("LabelItemName",item->getName()); childSetEnabled("LabelItemDescTitle",TRUE); childSetEnabled("LabelItemDesc",is_modifiable); childSetVisible("IconLocked",!is_modifiable); childSetText("LabelItemDesc",item->getDescription()); ////////////////// // CREATOR NAME // ////////////////// if(!gCacheName) return; if(!gAgent.getRegion()) return; if (item->getCreatorUUID().notNull()) { std::string name; gCacheName->getFullName(item->getCreatorUUID(), name); childSetEnabled("BtnCreator",TRUE); childSetEnabled("LabelCreatorTitle",TRUE); childSetEnabled("LabelCreatorName",TRUE); childSetText("LabelCreatorName",name); } else { childSetEnabled("BtnCreator",FALSE); childSetEnabled("LabelCreatorTitle",FALSE); childSetEnabled("LabelCreatorName",FALSE); childSetText("LabelCreatorName",getString("unknown")); } //////////////// // OWNER NAME // //////////////// if(perm.isOwned()) { std::string name; if (perm.isGroupOwned()) { gCacheName->getGroupName(perm.getGroup(), name); } else { gCacheName->getFullName(perm.getOwner(), name); } childSetEnabled("BtnOwner",TRUE); childSetEnabled("LabelOwnerTitle",TRUE); childSetEnabled("LabelOwnerName",TRUE); childSetText("LabelOwnerName",name); } else { childSetEnabled("BtnOwner",FALSE); childSetEnabled("LabelOwnerTitle",FALSE); childSetEnabled("LabelOwnerName",FALSE); childSetText("LabelOwnerName",getString("public")); } ////////////////// // ACQUIRE DATE // ////////////////// // *TODO: Localize / translate this time_t time_utc = item->getCreationDate(); if (0 == time_utc) { childSetText("LabelAcquiredDate",getString("unknown")); } else { std::string timestr; timeToFormattedString(time_utc, gSavedSettings.getString("TimestampFormat"), timestr); childSetText("LabelAcquiredDate", timestr); } /////////////////////// // OWNER PERMISSIONS // /////////////////////// if(can_agent_manipulate) { childSetText("OwnerLabel",getString("you_can")); } else { childSetText("OwnerLabel",getString("owner_can")); } U32 base_mask = perm.getMaskBase(); U32 owner_mask = perm.getMaskOwner(); U32 group_mask = perm.getMaskGroup(); U32 everyone_mask = perm.getMaskEveryone(); U32 next_owner_mask = perm.getMaskNextOwner(); childSetEnabled("OwnerLabel",TRUE); childSetEnabled("CheckOwnerModify",FALSE); childSetValue("CheckOwnerModify",LLSD((BOOL)(owner_mask & PERM_MODIFY))); childSetEnabled("CheckOwnerCopy",FALSE); childSetValue("CheckOwnerCopy",LLSD((BOOL)(owner_mask & PERM_COPY))); childSetEnabled("CheckOwnerTransfer",FALSE); childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER))); /////////////////////// // DEBUG PERMISSIONS // /////////////////////// if( gSavedSettings.getBOOL("DebugPermissions") ) { BOOL slam_perm = FALSE; BOOL overwrite_group = FALSE; BOOL overwrite_everyone = FALSE; if (item->getType() == LLAssetType::AT_OBJECT) { U32 flags = item->getFlags(); slam_perm = flags & LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; overwrite_everyone = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; overwrite_group = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } std::string perm_string; perm_string = "B: "; perm_string += mask_to_string(base_mask); childSetText("BaseMaskDebug",perm_string); childSetVisible("BaseMaskDebug",TRUE); perm_string = "O: "; perm_string += mask_to_string(owner_mask); childSetText("OwnerMaskDebug",perm_string); childSetVisible("OwnerMaskDebug",TRUE); perm_string = "G"; perm_string += overwrite_group ? "*: " : ": "; perm_string += mask_to_string(group_mask); childSetText("GroupMaskDebug",perm_string); childSetVisible("GroupMaskDebug",TRUE); perm_string = "E"; perm_string += overwrite_everyone ? "*: " : ": "; perm_string += mask_to_string(everyone_mask); childSetText("EveryoneMaskDebug",perm_string); childSetVisible("EveryoneMaskDebug",TRUE); perm_string = "N"; perm_string += slam_perm ? "*: " : ": "; perm_string += mask_to_string(next_owner_mask); childSetText("NextMaskDebug",perm_string); childSetVisible("NextMaskDebug",TRUE); } else { childSetVisible("BaseMaskDebug",FALSE); childSetVisible("OwnerMaskDebug",FALSE); childSetVisible("GroupMaskDebug",FALSE); childSetVisible("EveryoneMaskDebug",FALSE); childSetVisible("NextMaskDebug",FALSE); } ///////////// // SHARING // ///////////// // Check for ability to change values. if (is_obj_modify && can_agent_manipulate) { childSetEnabled("CheckShareWithGroup",TRUE); childSetEnabled("CheckEveryoneCopy",(owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER)); } else { childSetEnabled("CheckShareWithGroup",FALSE); childSetEnabled("CheckEveryoneCopy",FALSE); } // Set values. BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; if (is_group_copy && is_group_modify && is_group_move) { childSetValue("CheckShareWithGroup",LLSD((BOOL)TRUE)); LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); } } else if (!is_group_copy && !is_group_modify && !is_group_move) { childSetValue("CheckShareWithGroup",LLSD((BOOL)FALSE)); LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); } } else { LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(TRUE); ctl->set(TRUE); } } childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); /////////////// // SALE INFO // /////////////// const LLSaleInfo& sale_info = item->getSaleInfo(); BOOL is_for_sale = sale_info.isForSale(); // Check for ability to change values. if (is_obj_modify && can_agent_sell && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE)) { childSetEnabled("SaleLabel",is_complete); childSetEnabled("CheckPurchase",is_complete); childSetEnabled("NextOwnerLabel",TRUE); childSetEnabled("CheckNextOwnerModify",base_mask & PERM_MODIFY); childSetEnabled("CheckNextOwnerCopy",base_mask & PERM_COPY); childSetEnabled("CheckNextOwnerTransfer",next_owner_mask & PERM_COPY); childSetEnabled("RadioSaleType",is_complete && is_for_sale); childSetEnabled("TextPrice",is_complete && is_for_sale); childSetEnabled("EditPrice",is_complete && is_for_sale); } else { childSetEnabled("SaleLabel",FALSE); childSetEnabled("CheckPurchase",FALSE); childSetEnabled("NextOwnerLabel",FALSE); childSetEnabled("CheckNextOwnerModify",FALSE); childSetEnabled("CheckNextOwnerCopy",FALSE); childSetEnabled("CheckNextOwnerTransfer",FALSE); childSetEnabled("RadioSaleType",FALSE); childSetEnabled("TextPrice",FALSE); childSetEnabled("EditPrice",FALSE); } // Set values. childSetValue("CheckPurchase", is_for_sale); childSetValue("CheckNextOwnerModify",LLSD(BOOL(next_owner_mask & PERM_MODIFY))); childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY))); childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType"); if (is_for_sale) { radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); S32 numerical_price; numerical_price = sale_info.getSalePrice(); childSetText("EditPrice",llformat("%d",numerical_price)); } else { radioSaleType->setSelectedIndex(-1); childSetText("EditPrice",llformat("%d",0)); } }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const LLDate& time_stamp, const bool& has_inventory, const std::string& inventory_name, const LLSD& inventory_offer) : LLPanel("groupnotify", LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(NULL) { const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; time_t timestamp = (time_t)time_stamp.secondsSinceEpoch(); if (!timestamp) time(×tamp); std::string time_buf; timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time_buf); if (mHasInventory) { mInventoryOffer = new LLOfferInfo(inventory_offer); } setFocusRoot(TRUE); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontShadow(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyGroupNotice"),LLFontGL::getFontSansSerifHuge())); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << LLTrans::getString("GroupNotifySentBy") << " " + from_name << LLTrans::getString(",") + " " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::getFontSansSerif())); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia.asString()); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::getFontSansSerif(), FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject + "\n",false,false,headerstyle); text->appendStyledText(time_buf,false,false,datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->setParseHTML(TRUE); text->appendColoredText(std::string("\n\n") + message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyAttached"),LLFontGL::getFontSansSerif())); LLUIImagePtr item_icon = LLInventoryIcon::getIcon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::getFontSansSerif()); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(LLTrans::getString("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickNext, this), LLFontGL::getFontSansSerif()); btn->setToolTip(LLTrans::getString("next")); btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickOk,this)); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); if (mHasInventory) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = LLTrans::getString("GroupNotifyOpenAttachment"); } else { btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickSaveInventory,this)); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }