diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5f1f6311b..efb2c1f2f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -262,6 +262,7 @@ set(viewer_SOURCE_FILES llfloatervoiceeffect.cpp llfloaterwater.cpp llfloaterwebcontent.cpp + llfloaterwebprofile.cpp llfloaterwhitelistentry.cpp llfloaterwindlight.cpp llfloaterworldmap.cpp @@ -772,6 +773,7 @@ set(viewer_HEADER_FILES llfloatervoiceeffect.h llfloaterwater.h llfloaterwebcontent.h + llfloaterwebprofile.h llfloaterwhitelistentry.h llfloaterwindlight.h llfloaterworldmap.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8df4ae10d..e6c86b8fb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -17025,6 +17025,22 @@ This should be as low as possible, but too low may break functionality Value 0 + WebProfileFloaterRect + + Comment + Web profile floater dimensions + Persist + 1 + Type + Rect + Value + + 0 + 680 + 485 + 0 + + SimulateFBOFailure Comment diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index e3d288568..dc52afbf3 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -609,5 +609,16 @@ Value 0 + UseWebProfiles + + Comment + Always use web profiles floaters instead of legacy profile floaters. + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 0dba5124c..cb37291f5 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -224,6 +224,7 @@ void LLPrefsAscentSys::refreshValues() mEnableClassicClouds = gSavedSettings.getBOOL("SkyUseClassicClouds"); mSpeedRez = gSavedSettings.getBOOL("SpeedRez"); mSpeedRezInterval = gSavedSettings.getU32("SpeedRezInterval"); + mUseWebProfiles = gSavedSettings.getBOOL("UseWebProfiles"); //Command Line ------------------------------------------------------------------------ mCmdLine = gSavedSettings.getBOOL("AscentCmdLine"); @@ -374,6 +375,7 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("SkyUseClassicClouds", mEnableClassicClouds); gSavedSettings.setBOOL("SpeedRez", mSpeedRez); gSavedSettings.setU32("SpeedRezInterval", mSpeedRezInterval); + gSavedSettings.setBOOL("UseWebProfiles", mUseWebProfiles); //Command Line ------------------------------------------------------------------------ gSavedSettings.setBOOL("AscentCmdLine", mCmdLine); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 8a7341481..8bc0f0d7f 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -72,6 +72,7 @@ protected: BOOL mEnableClassicClouds; BOOL mSpeedRez; U32 mSpeedRezInterval; + bool mUseWebProfiles; //Command Line ------------------------------------------------------------------------ BOOL mCmdLine; diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index a242a029b..1851e389b 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -39,11 +39,13 @@ #include "llfloateravatarinfo.h" #include "llfloatergroupinvite.h" #include "llfloatergroups.h" +#include "llfloaterwebprofile.h" #include "llfloaterworldmap.h" #include "llgivemoney.h" #include "llimview.h" // for gIMMgr #include "llinventoryobserver.h" #include "llmutelist.h" +#include "llpanelprofile.h" #include "lltrans.h" #include "llvoiceclient.h" #include "llweb.h" @@ -324,18 +326,16 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids) make_ui_sound("UISndStartIM"); } -/* Singu TODO: Web Profiles static const char* get_profile_floater_name(const LLUUID& avatar_id) { // Use different floater XML for our profile to be able to save its rect. return avatar_id == gAgentID ? "my_profile" : "profile"; } -*/ -static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name) +static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name, bool web) { - //if (!gSavedSettings.getBOOL("UseWebProfiles") - //{ + if (gSavedSettings.getString("WebProfileURL").empty() || !(web || gSavedSettings.getBOOL("UseWebProfiles"))) + { LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id); if(!floater) { @@ -345,8 +345,7 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa // ...bring that window to front floater->open(); /*Flawfinder: ignore*/ - //} - /* + } else { std::string username = av_name.mUsername; @@ -362,21 +361,20 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa LLFloaterWebContent::Params p; p.url(url). id(agent_id.asString()); - LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p); + LLFloaterWebProfile::showInstance(get_profile_floater_name(agent_id), p); } - */ } // static -void LLAvatarActions::showProfile(const LLUUID& id) +void LLAvatarActions::showProfile(const LLUUID& id, bool web) { if (id.notNull()) { LLAvatarName av_name; if (LLAvatarNameCache::get(id, &av_name)) // Bypass expiration, open NOW! - on_avatar_name_show_profile(id, av_name); + on_avatar_name_show_profile(id, av_name, web); else - LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2)); + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2, web)); } } @@ -391,12 +389,11 @@ bool LLAvatarActions::profileVisible(const LLUUID& id) LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) { LLFloater* browser; - //if (!gSavedSettings.getBOOL("UseWebProfiles") + if (gSavedSettings.getString("WebProfileURL").empty() || !gSavedSettings.getBOOL("UseWebProfiles")) browser = LLFloaterAvatarInfo::getInstance(id); - /*else - browser = dynamic_cast - (LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id))); - */ + else + browser = + LLFloaterWebProfile::getInstance(id.asString()); return browser; } diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 64511e60e..b0ac68df0 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -85,7 +85,7 @@ public: /** * Show avatar profile. */ - static void showProfile(const LLUUID& id); + static void showProfile(const LLUUID& id, bool web = false); static void hideProfile(const LLUUID& id); static bool profileVisible(const LLUUID& id); static LLFloater* getProfileFloater(const LLUUID& id); diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index c47a893ff..6d2a2ae3e 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -74,7 +74,6 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params ) mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this )); mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this )); mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind( &LLFloaterWebContent::onPopExternal, this )); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_web_content.xml"); mAgeTimer.reset(); } @@ -175,7 +174,7 @@ void LLFloaterWebContent::showInstance(const std::string& window_class, Params& assert(!old_inst); if(!old_inst) - LLFloaterWebContent::create(p); + LLUICtrlFactory::getInstance()->buildFloater(LLFloaterWebContent::create(p), "floater_web_content.xml"); } //static @@ -305,6 +304,12 @@ void LLFloaterWebContent::open_media(const Params& p) { setResizeLimits(100, 100); } + else + { + // Singu Note: currently only true with normal browser floater, if this changes, this workaround breaks + setRectControl("FloaterMediaRect"); + applyRectControl(); + } if (!p.preferred_media_size().isEmpty()) { diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 00d8c9532..9fabe42ac 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -81,6 +81,7 @@ public: /* virtual */ void draw(); protected: + friend class LLFloaterWebProfile; // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); diff --git a/indra/newview/llfloaterwebprofile.cpp b/indra/newview/llfloaterwebprofile.cpp new file mode 100755 index 000000000..c506c72fa --- /dev/null +++ b/indra/newview/llfloaterwebprofile.cpp @@ -0,0 +1,121 @@ +/** + * @file llfloaterwebprofile.cpp + * @brief Avatar profile floater. + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterwebprofile.h" + +#include "lluictrlfactory.h" +#include "llviewercontrol.h" + +LLFloaterWebProfile::LLFloaterWebProfile(const Params& key) : + LLFloaterWebContent(key) +{ +} + +void LLFloaterWebProfile::onOpen() +{ + Params p(mKey); + p.show_chrome(false). + window_class("profile"); + mKey = p; + LLFloaterWebContent::onOpen(); + applyPreferredRect(); +} + +// virtual +void LLFloaterWebProfile::handleReshape(const LLRect& new_rect, bool by_user) +{ + lldebugs << "handleReshape: " << new_rect << llendl; + + if (by_user && !isMinimized()) + { + lldebugs << "Storing new rect" << llendl; + gSavedSettings.setRect("WebProfileFloaterRect", new_rect); + } + + LLFloaterWebContent::handleReshape(new_rect, by_user); +} + +// Singu Note: this was copied from LLFloaterWebContent::showInstance +//static +void LLFloaterWebProfile::showInstance(const std::string& window_class, Params& p) +{ + p.window_class(window_class); + + LLSD key = p; + + instance_iter it = beginInstances(); + for(;it!=endInstances();++it) + { + if(it->mKey["window_class"].asString() == window_class) + { + if(it->matchesKey(key)) + { + it->mKey = key; + it->setKey(p.id()); + it->mAgeTimer.reset(); + it->open(); + return; + } + } + } + LLFloaterWebContent* old_inst = getInstance(p.id()); + if(old_inst) + { + llwarns << "Replacing unexpected duplicate floater: " << p.id() << llendl; + old_inst->mKey = key; + old_inst->mAgeTimer.reset(); + old_inst->open(); + } + assert(!old_inst); + + if(!old_inst) + LLUICtrlFactory::getInstance()->buildFloater(LLFloaterWebProfile::create(p), "floater_web_content.xml"); +} + +LLFloater* LLFloaterWebProfile::create(const LLSD& key) +{ + LLFloaterWebContent::Params p(key); + preCreate(p); + return new LLFloaterWebProfile(p); +} + +void LLFloaterWebProfile::applyPreferredRect() +{ + const LLRect preferred_rect = gSavedSettings.getRect("WebProfileFloaterRect"); + lldebugs << "Applying preferred rect: " << preferred_rect << llendl; + + // Don't override position that may have been set by floater stacking code. + // Singu Note: We do floater stacking here, actually + int left, top; + gFloaterView->getNewFloaterPosition(&left, &top); + LLRect new_rect = getRect(); + new_rect.setLeftTopAndSize( + left, top, //new_rect.mLeft, new_rect.mTop, + preferred_rect.getWidth(), preferred_rect.getHeight()); + setShape(new_rect); +} diff --git a/indra/newview/llfloaterwebprofile.h b/indra/newview/llfloaterwebprofile.h new file mode 100755 index 000000000..8944ddbc4 --- /dev/null +++ b/indra/newview/llfloaterwebprofile.h @@ -0,0 +1,60 @@ +/** + * @file llfloaterwebprofile.h + * @brief Avatar profile floater. + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERWEBPROFILE_H +#define LL_LLFLOATERWEBPROFILE_H + +#include "llfloaterwebcontent.h" +#include "llviewermediaobserver.h" + +#include + +class LLMediaCtrl; + +/** + * Displays avatar profile web page. + */ +class LLFloaterWebProfile +: public LLFloaterWebContent +{ + LOG_CLASS(LLFloaterWebProfile); +public: + typedef LLFloaterWebContent::Params Params; + + LLFloaterWebProfile(const Params& key); + + /*virtual*/ void onOpen(); + /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); + + static void showInstance(const std::string& window_class, Params& p); + static LLFloater* create(const LLSD& key); + +private: + void applyPreferredRect(); +}; + +#endif // LL_LLFLOATERWEBPROFILE_H + diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 88d8467df..6fc325481 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -563,7 +563,7 @@ BOOL LLFloaterIMPanel::postBuild() if (LLButton* btn = findChild("profile_callee_btn")) { - btn->setCommitCallback(boost::bind(LLAvatarActions::showProfile, mOtherParticipantUUID)); + btn->setCommitCallback(boost::bind(LLAvatarActions::showProfile, mOtherParticipantUUID, false)); if (!mProfileButtonEnabled) btn->setEnabled(false); } if (LLButton* btn = findChild("profile_tele_btn")) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index bbf57a1b5..26e2f356f 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1392,6 +1392,7 @@ LLPanelAvatar::LLPanelAvatar( factory_map["1st Life"] = LLCallbackMap(createPanelAvatarFirstLife, this); factory_map["My Notes"] = LLCallbackMap(createPanelAvatarNotes, this); + mCommitCallbackRegistrar.add("Profile.Web", boost::bind(LLAvatarActions::showProfile, boost::bind(&LLPanelAvatar::getAvatarID, this), true)); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar.xml", &factory_map); selectTab(0); @@ -1408,6 +1409,7 @@ BOOL LLPanelAvatar::postBuild(void) childSetAction("Cancel", onClickCancel, this); childSetAction("copy_key",onClickGetKey,this); + getChildView("web_profile")->setVisible(!gSavedSettings.getString("WebProfileURL").empty()); if(mTab && !sAllowFirstLife) { diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 31482d15e..73af57ac7 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -148,7 +148,7 @@ BOOL LLPanelGroupGeneral::postBuild() mListVisibleMembers = getChild("visible_members", recurse); if (mListVisibleMembers) { - mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers))); + mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers), false)); } // Options diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2f3b7e33a..85f7e673e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -4061,7 +4061,7 @@ bool process_login_success_response(std::string& password) if(gHippoGridManager->getConnectedGrid()->isOpenSimulator()) { std::string web_profile_url = response["web_profile_url"]; - if(!web_profile_url.empty()) + //if(!web_profile_url.empty()) // Singu Note: We're using this to check if this grid supports web profiles at all, so set empty if empty. gSavedSettings.setString("WebProfileURL", web_profile_url); } else if(!gHippoGridManager->getConnectedGrid()->isInProductionGrid()) diff --git a/indra/newview/skins/default/xui/en-us/floater_web_content.xml b/indra/newview/skins/default/xui/en-us/floater_web_content.xml index 05f088ae7..a3c9f50e5 100644 --- a/indra/newview/skins/default/xui/en-us/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en-us/floater_web_content.xml @@ -8,7 +8,6 @@ min_height="140" min_width="467" name="floater_web_content" - rect_control="FloaterMediaRect" title="Web Browser" initial_mime_type="text/html" width="820"> diff --git a/indra/newview/skins/default/xui/en-us/panel_avatar.xml b/indra/newview/skins/default/xui/en-us/panel_avatar.xml index 8498c507b..3637ee8af 100644 --- a/indra/newview/skins/default/xui/en-us/panel_avatar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_avatar.xml @@ -36,21 +36,15 @@ Not Age-verified - - Key: - + seconds + diff --git a/indra/newview/skins/default/xui/es/panel_avatar.xml b/indra/newview/skins/default/xui/es/panel_avatar.xml index 2260bb77c..f58328f33 100644 --- a/indra/newview/skins/default/xui/es/panel_avatar.xml +++ b/indra/newview/skins/default/xui/es/panel_avatar.xml @@ -34,10 +34,7 @@ Edad No Verificada - - Key: - -