コード例 #1
0
ファイル: llfloaterkeytool.cpp プロジェクト: Kiera/Sausages
void LLFloaterKeyTool::showType(LLKeyTool::LLKeyType key_type, LLAssetType::EType asset_type, isness result)
{
	std::string name = LLKeyTool::aWhat(key_type, asset_type);
	if((key_type == LLKeyTool::KT_ASSET) && (asset_type == LLAssetType::AT_COUNT))
		name = "other assets";
	LLTextBox* text = getChild<LLTextBox>(name, FALSE, FALSE);
	if(!text)
	{
		text = new LLTextBox(name, LLRect(10, mListBottom + 20, getRect().mRight, mListBottom));
		text->setFollowsTop();
		text->setColor(LLColor4::white);
		text->setHoverColor(LLColor4::white);
		mListBottom -= 20;
		addChild(text);

		clickData* data = new clickData;
		data->floater = this;
		data->key_type = key_type;
		data->asset_type = asset_type;
		text->setCallbackUserData((void*)data);
		//text->setClickedCallback(onClickType);
	}
	switch(result)
	{
	case YES:
		if(gSavedSettings.getBOOL("KeyToolAutomaticOpen"))
		{
			LLKeyTool::openKey(mKey, key_type, asset_type);
		}
		if(gSavedSettings.getBOOL("KeyToolAutomaticClose"))
		{
			this->close(FALSE);
		}
		text->setColor(LLColor4::green);
		break;
	case NO:
		text->setColor(LLColor4::grey);
		break;
	default:
		text->setColor(LLColor4::white);
		break;
	}
}
コード例 #2
0
	void setup(const LLChat& chat,const LLStyle::Params& style_params) 
	{
		mAvatarID = chat.mFromID;
		mSessionID = chat.mSessionID;
		mSourceType = chat.mSourceType;
		gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4));

		//*TODO overly defensive thing, source type should be maintained out there
		if (chat.mFromID.isNull() && (chat.mFromName.empty() || chat.mFromName == SYSTEM_FROM))
		{
			mSourceType = CHAT_SOURCE_SYSTEM;
		}

		LLTextBox* userName = getChild<LLTextBox>("user_name");

		userName->setReadOnlyColor(style_params.readonly_color());
		userName->setColor(style_params.color());
		
		userName->setValue(chat.mFromName);
		mFrom = chat.mFromName;
		if (chat.mFromName.empty() || CHAT_SOURCE_SYSTEM == mSourceType)
		{
			mFrom = LLTrans::getString("SECOND_LIFE");
			userName->setValue(mFrom);
		}


		mMinUserNameWidth = style_params.font()->getWidth(userName->getWText().c_str()) + PADDING;

		setTimeField(chat);
		
		LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");

		if(mSourceType != CHAT_SOURCE_AGENT)
			icon->setDrawTooltip(false);

		switch (mSourceType)
		{
			case CHAT_SOURCE_AGENT:
				icon->setValue(chat.mFromID);
				break;
			case CHAT_SOURCE_OBJECT:
				icon->setValue(LLSD("OBJECT_Icon"));
				break;
			case CHAT_SOURCE_SYSTEM:
				icon->setValue(LLSD("SL_Logo"));
				break;
			case CHAT_SOURCE_UNKNOWN: 
				icon->setValue(LLSD("Unknown_Icon"));
		}
	}
コード例 #3
0
ファイル: llgroupnotify.cpp プロジェクト: Boy/netbook
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(&timestamp);
	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);
	}
}