void LLPanelGroup::update(LLGroupChange gc)
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
	if(gdatap)
	{
		std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
		childSetValue("group_name", group_name);
		childSetToolTip("group_name",group_name);
		
		LLGroupData agent_gdatap;
		bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike();
		bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
		
		mButtonJoin->setVisible(join_btn_visible);
		mJoinText->setVisible(join_btn_visible);

		if(join_btn_visible)
		{
			LLStringUtil::format_map_t string_args;
			std::string fee_buff;
			if(gdatap->mMembershipFee)
			{
				string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
				fee_buff = getString("group_join_btn", string_args);
				
			}
			else
			{
				fee_buff = getString("group_join_free", string_args);
			}
			mJoinText->setValue(fee_buff);
		}
	}
}
void LLPanelGroup::update(LLGroupChange gc)
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
	if(gdatap)
	{
		// <FS:Ansariel> Standalone group floaters
		//std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
		//childSetValue("group_name", group_name);
		//childSetToolTip("group_name",group_name);
		if (gSavedSettings.getBOOL("FSUseStandaloneGroupFloater"))
		{
			FSFloaterGroup* parent = dynamic_cast<FSFloaterGroup*>(getParent());
			if (parent)
			{
				parent->setGroupName(gdatap->mName);
			}
		}
		else
		{
			std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
			childSetValue("group_name", group_name);
			childSetToolTip("group_name",group_name);
		}
		// </FS:Ansariel>
		
		LLGroupData agent_gdatap;
		bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike();
		bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
		
		mButtonJoin->setVisible(join_btn_visible);
		mJoinText->setVisible(join_btn_visible);

		if(join_btn_visible)
		{
			LLStringUtil::format_map_t string_args;
			std::string fee_buff;
			if(gdatap->mMembershipFee)
			{
				string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
				fee_buff = getString("group_join_btn", string_args);
				
			}
			else
			{
				fee_buff = getString("group_join_free", string_args);
			}
			mJoinText->setValue(fee_buff);
		}
	}
}
Пример #3
0
void LLVoiceRemoteCtrl::draw()
{
    BOOL voice_active = FALSE;
    LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
    if (channelp)
    {
        voice_active = channelp->isActive();
    }

    mTalkBtn->setEnabled(voice_active);
    mTalkLockBtn->setEnabled(voice_active);

    // propagate ptt state to button display,
    if (!mTalkBtn->hasMouseCapture())
    {
        // not in push to talk mode, or push to talk is active means I'm talking
        mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState());
    }
    mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
    mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled"));

    std::string talk_blip_image;
    if (gVoiceClient->getIsSpeaking(gAgent.getID()))
    {
        F32 voice_power = gVoiceClient->getCurrentPower(gAgent.getID());

        if (voice_power > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
        {
            talk_blip_image = "icn_voice_ptt-on-lvl3.tga";
        }
        else
        {
            F32 power = gVoiceClient->getCurrentPower(gAgent.getID());
            S32 icon_image_idx = llmin(2, llfloor((power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f));

            switch(icon_image_idx)
            {
            case 0:
                talk_blip_image = "icn_voice_ptt-on.tga";
                break;
            case 1:
                talk_blip_image = "icn_voice_ptt-on-lvl1.tga";
                break;
            case 2:
                talk_blip_image = "icn_voice_ptt-on-lvl2.tga";
                break;
            }
        }
    }
    else
    {
        talk_blip_image = "icn_voice_ptt-off.tga";
    }

    LLIconCtrl* icon = getChild<LLIconCtrl>("voice_volume");
    if (icon)
    {
        icon->setImage(talk_blip_image);
    }

    LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
    std::string active_channel_name;
    if (voice_floater)
    {
        active_channel_name = voice_floater->getShortTitle();
    }

    LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
    childSetEnabled("end_call_btn", LLVoiceClient::voiceEnabled()
                    && current_channel
                    && current_channel->isActive()
                    && current_channel != LLVoiceChannelProximal::getInstance());

    childSetValue("channel_label", active_channel_name);
    childSetToolTip("voice_channel_bg", active_channel_name);

    if (current_channel)
    {
        LLIconCtrl* voice_channel_icon = getChild<LLIconCtrl>("voice_channel_icon");
        if (voice_channel_icon && voice_floater)
        {
            voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
        }

        LLButton* voice_channel_bg = getChild<LLButton>("voice_channel_bg");
        if (voice_channel_bg)
        {
            LLColor4 bg_color;
            if (current_channel->isActive())
            {
                bg_color = lerp(LLColor4::green, LLColor4::white, 0.7f);
            }
            else if (current_channel->getState() == LLVoiceChannel::STATE_ERROR)
            {
                bg_color = lerp(LLColor4::red, LLColor4::white, 0.7f);
            }
            else // active, but not connected
            {
                bg_color = lerp(LLColor4::yellow, LLColor4::white, 0.7f);
            }
            voice_channel_bg->setImageColor(bg_color);
        }
    }

    LLButton* expand_button = getChild<LLButton>("show_channel");
    if (expand_button)
    {
        if (expand_button->getToggleState())
        {
            expand_button->setImageOverlay(std::string("arrow_down.tga"));
        }
        else
        {
            expand_button->setImageOverlay(std::string("arrow_up.tga"));
        }
    }

    LLPanel::draw();
}
Пример #4
0
void LLPanelGroup::setGroupID(const LLUUID& group_id)
{
    std::string str_group_id;
    group_id.toString(str_group_id);

    bool is_same_id = group_id == mID;

    LLGroupMgr::getInstance()->removeObserver(this);
    mID = group_id;
    LLGroupMgr::getInstance()->addObserver(this);

    for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin(); it!=mTabs.end(); ++it)
        (*it)->setGroupID(group_id);

    LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
    if(gdatap)
    {
        std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
        childSetValue("group_name", group_name);
        childSetToolTip("group_name",group_name);
    }

    LLButton* button_apply = findChild<LLButton>("btn_apply");
    LLButton* button_refresh = findChild<LLButton>("btn_refresh");
    LLButton* button_create = findChild<LLButton>("btn_create");

    LLButton* button_cancel = findChild<LLButton>("btn_cancel");
    LLButton* button_call = findChild<LLButton>("btn_call");
    LLButton* button_chat = findChild<LLButton>("btn_chat");


    bool is_null_group_id = group_id == LLUUID::null;
    if(button_apply)
        button_apply->setVisible(!is_null_group_id);
    if(button_refresh)
        button_refresh->setVisible(!is_null_group_id);

    if(button_create)
        button_create->setVisible(is_null_group_id);
    if(button_cancel)
        button_cancel->setVisible(!is_null_group_id);

    if(button_call)
        button_call->setVisible(!is_null_group_id);
    if(button_chat)
        button_chat->setVisible(!is_null_group_id);

    getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);

    LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion");
    tab_ctrl->reset();

    LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab");
    LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab");
    LLAccordionCtrlTab* tab_notices = getChild<LLAccordionCtrlTab>("group_notices_tab");
    LLAccordionCtrlTab* tab_land = getChild<LLAccordionCtrlTab>("group_land_tab");

    if(mButtonJoin)
        mButtonJoin->setVisible(false);


    if(is_null_group_id)//creating new group
    {
        if(!tab_general->getDisplayChildren())
            tab_general->changeOpenClose(tab_general->getDisplayChildren());

        if(tab_roles->getDisplayChildren())
            tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
        if(tab_notices->getDisplayChildren())
            tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
        if(tab_land->getDisplayChildren())
            tab_land->changeOpenClose(tab_land->getDisplayChildren());

        tab_roles->setVisible(false);
        tab_notices->setVisible(false);
        tab_land->setVisible(false);

        getChild<LLUICtrl>("group_name")->setVisible(false);
        getChild<LLUICtrl>("group_name_editor")->setVisible(true);

        if(button_call)
            button_call->setVisible(false);
        if(button_chat)
            button_chat->setVisible(false);
    }
    else
    {
        if(!is_same_id)
        {
            if(!tab_general->getDisplayChildren())
                tab_general->changeOpenClose(tab_general->getDisplayChildren());
            if(tab_roles->getDisplayChildren())
                tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
            if(tab_notices->getDisplayChildren())
                tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
            if(tab_land->getDisplayChildren())
                tab_land->changeOpenClose(tab_land->getDisplayChildren());
        }

        LLGroupData agent_gdatap;
        bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike();

        tab_roles->setVisible(is_member);
        tab_notices->setVisible(is_member);
        tab_land->setVisible(is_member);

        getChild<LLUICtrl>("group_name")->setVisible(true);
        getChild<LLUICtrl>("group_name_editor")->setVisible(false);

        if(button_apply)
            button_apply->setVisible(is_member);
        if(button_call)
            button_call->setVisible(is_member);
        if(button_chat)
            button_chat->setVisible(is_member);
    }

    tab_ctrl->arrange();

    reposButtons();
    update(GC_ALL);//show/hide "join" button if data is already ready
}