Solve Issue 521: Web profile support

Adds a checkbox "Use web profiles instead of legacy v1 profiles" to System->General preferences
Adds a button "Web Profile" to the first life tab of legacy profiles (only available on grids that provide a web profile url)

When connecting to an OSGrid, always set the WebProfileURL setting to whatever is in web_profile_url, this way we know if web profiles are not supported.

Borrowed translations of the preference checkbox from Firestorm, translators may want to tweak
Translators may want to update panel_avatar.xml as it now has a web profile button, and contents have shifted slightly.
This commit is contained in:
Lirusaito
2013-06-28 07:18:59 -04:00
parent 5cea153542
commit b7c4532766
22 changed files with 251 additions and 45 deletions

View File

@@ -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

View File

@@ -17025,6 +17025,22 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>WebProfileFloaterRect</key>
<map>
<key>Comment</key>
<string>Web profile floater dimensions</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>680</integer>
<integer>485</integer>
<integer>0</integer>
</array>
</map>
<key>SimulateFBOFailure</key>
<map>
<key>Comment</key>

View File

@@ -609,5 +609,16 @@
<key>Value</key>
<boolean>0</boolean>
</map>
<key>UseWebProfiles</key>
<map>
<key>Comment</key>
<string>Always use web profiles floaters instead of legacy profile floaters.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>0</boolean>
</map>
</map>
</llsd>

View File

@@ -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);

View File

@@ -72,6 +72,7 @@ protected:
BOOL mEnableClassicClouds;
BOOL mSpeedRez;
U32 mSpeedRezInterval;
bool mUseWebProfiles;
//Command Line ------------------------------------------------------------------------
BOOL mCmdLine;

View File

@@ -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<LLFloaterWebContent*>
(LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id)));
*/
else
browser =
LLFloaterWebProfile::getInstance(id.asString());
return browser;
}

View File

@@ -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);

View File

@@ -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())
{

View File

@@ -81,6 +81,7 @@ public:
/* virtual */ void draw();
protected:
friend class LLFloaterWebProfile;
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);

View File

@@ -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);
}

View File

@@ -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 <string>
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

View File

@@ -563,7 +563,7 @@ BOOL LLFloaterIMPanel::postBuild()
if (LLButton* btn = findChild<LLButton>("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<LLButton>("profile_tele_btn"))

View File

@@ -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)
{

View File

@@ -148,7 +148,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mListVisibleMembers = getChild<LLNameListCtrl>("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

View File

@@ -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())

View File

@@ -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">

View File

@@ -36,21 +36,15 @@
<string name="NotAgeVerified">
Not Age-verified
</string>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-24" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4"
mouse_opaque="true" name="Key:" v_pad="0" width="70">
Key:
</text>
<button bottom="-24" follows="left|top" halign="right" height="16" label="Copy Key:" left="4" font="SansSerifSmall" tool_tip="Copy key to clipboard" name="copy_key" width="70"/>
<name_editor bevel_style="in" border_style="line"
border_thickness="1" bottom="-24" enabled="false" follows="left|top"
font="SansSerifSmall" height="16" is_unicode="false" left_delta="75"
max_length="36" mouse_opaque="false" name="avatar_key"
width="256" />
<button bottom="-24" follows="left|top" halign="center"
height="16" label="Copy" left_delta="256"
tool_tip="Copy key to clipboard"
mouse_opaque="true" name="copy_key" width="70" />
width="204" />
<button bottom="-24" height="16" width="106" left_delta="204" name="web_profile" label="Web Profile">
<button.commit_callback function="Profile.Web"/>
</button>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-48" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="4"

View File

@@ -37,6 +37,7 @@
<spinner bottom_delta="-20" left="30" control_name="SpeedRezInterval" decimal_digits="0" follows="top" height="16" width="230"
label="Draw distance stepping interval:" label_width="180" max_val="60" min_val="5" initial_val="20" increment="5" name="speed_rez_interval" />
<text bottom_delta="0" left_delta="235" follows="left|top" height="16" name="speed_rez_seconds">seconds</text>
<check_box bottom_delta="-18" control_name="UseWebProfiles" follows="top" left="10" name="use_web_profiles" label="Use web profiles instead of legacy v1 profiles" tool_tip="May not be available on certain grids"/>
</panel>
<panel border="true" bottom="-580" height="525" label="Command Line" left="1" name="Command Line" width="418">

View File

@@ -34,10 +34,7 @@
<string name="NotAgeVerified">
Edad No Verificada
</string>
<text name="Key:">
Key:
</text>
<button label="Copiar" tool_tip="Copyiar key al portapapeles" name="copy_key"/>
<button label="Copiar Key:" tool_tip="Copyiar key al portapapeles" name="copy_key"/>
<text name="Name:" >
Nombre:
</text>

View File

@@ -25,6 +25,7 @@
<text name="speed_rez_seconds">
segundos
</text>
<check_box name="use_web_profiles" label="Usar perfiles web por defecto" tool_tip="Muestra los perfiles como una página web en vez de usar los paneles de estilo V1"/>
</panel>
<!-- ====================================== -->
<panel label="Línea de Comandos" name="Command Line">

View File

@@ -181,12 +181,7 @@ vous avez écrit.
</text>
<text_editor bottom_delta="-260" height="240" name="notes edit" width="430"/>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-26" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="right" height="16" left="10"
mouse_opaque="true" name="key_label" v_pad="0" width="95">
Clef-Key :
</text>
<button name="copy_key" label="Copy Clef-Key :"/>
<name_editor bevel_style="in" bg_readonly_color="0, 0, 0, 0" border_style="line"
border_thickness="1" bottom_delta="1" enabled="false" follows="left|top"
font="SansSerifSmall" height="18" is_unicode="false" left_delta="95"

View File

@@ -23,6 +23,7 @@
<check_box label="Activer le rezz rapide par rapport &#xE0; une distance progressive" name="speed_rez_check" tool_tip="Active, cette fonction charge progressivement les textures du plus pr&#xE8;s au plus loin"/>
<spinner label="Intervalle distance/affichage:" name="speed_rez_interval"/>
<text name="speed_rez_seconds">secondes</text>
<check_box name="use_web_profiles" label="Utiliser le profil web par défaut" tool_tip="Affiche les profils comme une page web plutôt que comme une fenêtre style v1"/>
</panel>
<panel label="Commandes Texte" name="Command Line">