EXP-1310 FIX Profile button should open Web Profile floater
removed unused LLWeb functions for opening non-web media moved logic inside floaters and away from auxiliary functionsmeow-7.2.2
parent
7e13856df2
commit
ec23ec68ea
|
|
@ -110,7 +110,11 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
|
|||
int index = list.size();
|
||||
|
||||
res = build_func(key);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
llwarns << "Failed to build floater type: '" << name << "'." << llendl;
|
||||
return NULL;
|
||||
}
|
||||
bool success = res->buildFromFile(xui_file, NULL);
|
||||
if (!success)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class LLHelp
|
|||
{
|
||||
public:
|
||||
virtual void showTopic(const std::string &topic) = 0;
|
||||
virtual std::string getURL(const std::string &topic) = 0;
|
||||
// return default (fallback) topic name suitable for showTopic()
|
||||
virtual std::string defaultTopic() = 0;
|
||||
// return topic to use before the user logs in
|
||||
|
|
|
|||
|
|
@ -187,10 +187,8 @@
|
|||
icon="Command_Profile_Icon"
|
||||
label_ref="Command_Profile_Label"
|
||||
tooltip_ref="Command_Profile_Tooltip"
|
||||
execute_function="Floater.ToolbarToggle"
|
||||
execute_parameters="my_profile"
|
||||
is_running_function="Floater.IsOpen"
|
||||
is_running_parameters="my_profile"
|
||||
execute_function="Avatar.ToggleMyProfile"
|
||||
is_running_function="Avatar.IsMyProfileOpen"
|
||||
/>
|
||||
<command name="search"
|
||||
available_in_toybox="true"
|
||||
|
|
|
|||
|
|
@ -316,12 +316,13 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa
|
|||
// PROFILES: open in webkit window
|
||||
const bool show_chrome = false;
|
||||
static LLCachedControl<LLRect> profile_rect(gSavedSettings, "WebProfileRect");
|
||||
LLFloaterWebContent::create(LLFloaterWebContent::Params().
|
||||
url(url).
|
||||
id(agent_id.asString()).
|
||||
show_chrome(show_chrome).
|
||||
window_class("profile").
|
||||
preferred_media_size(profile_rect));
|
||||
LLFloaterWebContent::Params p;
|
||||
p.url(url).
|
||||
id(agent_id.asString()).
|
||||
show_chrome(show_chrome).
|
||||
window_class("profile").
|
||||
preferred_media_size(profile_rect);
|
||||
LLFloaterReg::showInstance("profile", p);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
@ -342,6 +343,12 @@ bool LLAvatarActions::profileVisible(const LLUUID& id)
|
|||
return browser && browser->isShown();
|
||||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id)
|
||||
{
|
||||
LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::findInstance("profile", LLSD().with("id", id)));
|
||||
return browser;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLAvatarActions::hideProfile(const LLUUID& id)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include <vector>
|
||||
|
||||
class LLInventoryPanel;
|
||||
|
||||
class LLFloater;
|
||||
|
||||
/**
|
||||
* Friend-related actions (add, remove, offer teleport, etc)
|
||||
|
|
@ -96,6 +96,7 @@ public:
|
|||
static void showProfile(const LLUUID& id);
|
||||
static void hideProfile(const LLUUID& id);
|
||||
static bool profileVisible(const LLUUID& id);
|
||||
static LLFloater* getProfileFloater(const LLUUID& id);
|
||||
|
||||
/**
|
||||
* Show avatar on world map.
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "llurlhistory.h"
|
||||
#include "llmediactrl.h"
|
||||
#include "llviewermedia.h"
|
||||
#include "llviewerhelp.h"
|
||||
|
||||
|
||||
LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key)
|
||||
|
|
@ -74,6 +75,17 @@ void LLFloaterHelpBrowser::buildURLHistory()
|
|||
void LLFloaterHelpBrowser::onOpen(const LLSD& key)
|
||||
{
|
||||
gSavedSettings.setBOOL("HelpFloaterOpen", TRUE);
|
||||
|
||||
std::string topic = key.asString();
|
||||
|
||||
if (topic == "__local")
|
||||
{
|
||||
mBrowser->navigateToLocalPage( "help-offline" , "index.html" );
|
||||
}
|
||||
else
|
||||
{
|
||||
mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic));
|
||||
}
|
||||
}
|
||||
|
||||
//virtual
|
||||
|
|
@ -148,8 +160,3 @@ void LLFloaterHelpBrowser::openMedia(const std::string& media_url)
|
|||
mBrowser->navigateTo(media_url, "text/html");
|
||||
setCurrentURL(media_url);
|
||||
}
|
||||
|
||||
void LLFloaterHelpBrowser::navigateToLocalPage( const std::string& subdir, const std::string& filename_in )
|
||||
{
|
||||
mBrowser->navigateToLocalPage(subdir, filename_in);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ class LLFloaterHelpBrowser :
|
|||
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
|
||||
|
||||
void openMedia(const std::string& media_url);
|
||||
|
||||
void navigateToLocalPage( const std::string& subdir, const std::string& filename_in );
|
||||
|
||||
private:
|
||||
void buildURLHistory();
|
||||
|
|
|
|||
|
|
@ -88,20 +88,6 @@ BOOL LLFloaterWebContent::postBuild()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
bool LLFloaterWebContent::matchesKey(const LLSD& key)
|
||||
{
|
||||
LLUUID id = key["id"];
|
||||
if (id.notNull())
|
||||
{
|
||||
return id == mKey["id"].asUUID();
|
||||
}
|
||||
else
|
||||
{
|
||||
return key["target"].asString() == mKey["target"].asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLFloaterWebContent::initializeURLHistory()
|
||||
{
|
||||
// start with an empty list
|
||||
|
|
@ -123,6 +109,20 @@ void LLFloaterWebContent::initializeURLHistory()
|
|||
}
|
||||
}
|
||||
|
||||
bool LLFloaterWebContent::matchesKey(const LLSD& key)
|
||||
{
|
||||
Params p(mKey);
|
||||
Params other_p(key);
|
||||
if (!other_p.target().empty() && other_p.target() != "_blank")
|
||||
{
|
||||
return other_p.target() == p.target();
|
||||
}
|
||||
else
|
||||
{
|
||||
return other_p.id() == p.id();
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterWebContent::create( Params p)
|
||||
{
|
||||
|
|
@ -139,14 +139,7 @@ LLFloater* LLFloaterWebContent::create( Params p)
|
|||
}
|
||||
|
||||
S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
|
||||
|
||||
LLSD sd;
|
||||
sd["target"] = p.target;
|
||||
if(LLFloaterReg::findInstance(p.window_class, sd) != NULL)
|
||||
{
|
||||
// There's already a web browser for this tag, so we won't be opening a new window.
|
||||
}
|
||||
else if(browser_window_limit != 0)
|
||||
if(browser_window_limit != 0)
|
||||
{
|
||||
// showInstance will open a new window. Figure out how many web browsers are already open,
|
||||
// and close the least recently opened one if this will put us over the limit.
|
||||
|
|
@ -166,7 +159,7 @@ LLFloater* LLFloaterWebContent::create( Params p)
|
|||
}
|
||||
}
|
||||
|
||||
return LLFloaterReg::showInstance(p.window_class, p);
|
||||
return new LLFloaterWebContent(p);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
|
|||
|
|
@ -1122,16 +1122,7 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response)
|
|||
lldebugs << "No gFloaterView for onPopuup()" << llendl;
|
||||
};
|
||||
|
||||
// (for now) open web content floater if that's our parent, otherwise, open the current media floater
|
||||
// (this will change soon)
|
||||
if ( floater_name == "web_content" )
|
||||
{
|
||||
LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]);
|
||||
}
|
||||
LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
std::string agent_name = params[0];
|
||||
llinfos << "Profile, agent_name " << agent_name << llendl;
|
||||
std::string url = getProfileURL(agent_name);
|
||||
LLWeb::loadWebURLInternal(url);
|
||||
LLWeb::loadURLInternal(url);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ void LLViewerFloaterReg::registerFloaters()
|
|||
LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
|
||||
LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
|
||||
LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
|
||||
LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWebContent>);
|
||||
LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
|
||||
|
||||
|
||||
LLFloaterUIPreviewUtil::registerFloater();
|
||||
|
|
@ -301,7 +301,7 @@ void LLViewerFloaterReg::registerFloaters()
|
|||
LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLCallFloater>);
|
||||
LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>);
|
||||
|
||||
LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWebContent>);
|
||||
LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
|
||||
LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>);
|
||||
LLFloaterWindowSizeUtil::registerFloater();
|
||||
LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>);
|
||||
|
|
|
|||
|
|
@ -69,15 +69,12 @@ LLHelpHandler gHelpHandler;
|
|||
//////////////////////////////
|
||||
// implement LLHelp interface
|
||||
|
||||
void LLViewerHelp::showTopic(const std::string &topic)
|
||||
std::string LLViewerHelp::getURL(const std::string &topic)
|
||||
{
|
||||
// allow overriding the help server with a local help file
|
||||
if( gSavedSettings.getBOOL("HelpUseLocal") )
|
||||
{
|
||||
showHelp();
|
||||
LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser"));
|
||||
helpbrowser->navigateToLocalPage( "help-offline" , "index.html" );
|
||||
return;
|
||||
return "__local";
|
||||
}
|
||||
|
||||
// if the help topic is empty, use the default topic
|
||||
|
|
@ -99,11 +96,12 @@ void LLViewerHelp::showTopic(const std::string &topic)
|
|||
}
|
||||
}
|
||||
|
||||
// work out the URL for this topic and display it
|
||||
showHelp();
|
||||
|
||||
std::string helpURL = LLViewerHelpUtil::buildHelpURL( help_topic );
|
||||
setRawURL(helpURL);
|
||||
return LLViewerHelpUtil::buildHelpURL( help_topic );
|
||||
}
|
||||
|
||||
void LLViewerHelp::showTopic(const std::string& topic)
|
||||
{
|
||||
LLFloaterReg::showInstance("help_browser", topic);
|
||||
}
|
||||
|
||||
std::string LLViewerHelp::defaultTopic()
|
||||
|
|
@ -146,23 +144,4 @@ std::string LLViewerHelp::getTopicFromFocus()
|
|||
return defaultTopic();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLViewerHelp::showHelp()
|
||||
{
|
||||
LLFloaterReg::showInstance("help_browser");
|
||||
}
|
||||
|
||||
// static
|
||||
void LLViewerHelp::setRawURL(std::string url)
|
||||
{
|
||||
LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser"));
|
||||
if (helpbrowser)
|
||||
{
|
||||
helpbrowser->openMedia(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Eep, help_browser floater not found" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class LLViewerHelp : public LLHelp, public LLSingleton<LLViewerHelp>
|
|||
/// display the specified help topic in the help viewer
|
||||
/*virtual*/ void showTopic(const std::string &topic);
|
||||
|
||||
std::string getURL(const std::string& topic);
|
||||
|
||||
// return topic derived from viewer UI focus, else default topic
|
||||
std::string getTopicFromFocus();
|
||||
|
||||
|
|
@ -56,10 +58,6 @@ class LLViewerHelp : public LLHelp, public LLSingleton<LLViewerHelp>
|
|||
|
||||
// return topic to use for the top-level help, invoked by F1
|
||||
/*virtual*/ std::string f1HelpTopic();
|
||||
|
||||
private:
|
||||
static void showHelp(); // make sure help UI is visible & raised
|
||||
static void setRawURL(std::string url); // send URL to help UI
|
||||
};
|
||||
|
||||
#endif // header guard
|
||||
|
|
|
|||
|
|
@ -5370,6 +5370,34 @@ class LLAvatarAddFriend : public view_listener_t
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
class LLAvatarToggleMyProfile : public view_listener_t
|
||||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID());
|
||||
if (LLFloater::isMinimized(instance))
|
||||
{
|
||||
instance->setMinimized(FALSE);
|
||||
instance->setFocus(TRUE);
|
||||
}
|
||||
else if (!LLFloater::isShown(instance))
|
||||
{
|
||||
LLAvatarActions::showProfile(gAgent.getID());
|
||||
}
|
||||
else if (!instance->hasFocus() && !instance->getIsChrome())
|
||||
{
|
||||
instance->setFocus(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->closeFloater();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class LLAvatarAddContact : public view_listener_t
|
||||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
|
|
@ -7229,7 +7257,7 @@ void handle_web_browser_test(const LLSD& param)
|
|||
void handle_web_content_test(const LLSD& param)
|
||||
{
|
||||
std::string url = param.asString();
|
||||
LLWeb::loadWebURLInternal(url);
|
||||
LLWeb::loadURLInternal(url);
|
||||
}
|
||||
|
||||
void handle_buy_currency_test(void*)
|
||||
|
|
@ -8165,6 +8193,8 @@ void initialize_menus()
|
|||
view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call");
|
||||
enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
|
||||
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
|
||||
view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
|
||||
enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::profileVisible, gAgent.getID()));
|
||||
|
||||
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
|
||||
enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
|
||||
|
|
|
|||
|
|
@ -125,7 +125,9 @@ void LLWeb::loadURLInternal(const std::string &url, const std::string& target, c
|
|||
// Explicitly open a Web URL using the Web content floater
|
||||
void LLWeb::loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
|
||||
{
|
||||
LLFloaterWebContent::create(LLFloaterWebContent::Params().url(url).target(target).id(uuid));
|
||||
LLFloaterWebContent::Params p;
|
||||
p.url(url).target(target).id(uuid);
|
||||
LLFloaterReg::showInstance("web_content", p);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
|||
|
|
@ -46,21 +46,19 @@ public:
|
|||
static void loadURL(const std::string& url, const std::string& target, const std::string& uuid = LLStringUtil::null);
|
||||
static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); }
|
||||
/// Load the given url in the user's preferred web browser
|
||||
static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); }
|
||||
static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); }
|
||||
static void loadURL(const char* url, const std::string& target = LLStringUtil::null) { loadURL( ll_safe_string(url), target); }
|
||||
/// Load the given url in the Second Life internal web browser
|
||||
static void loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
|
||||
static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); }
|
||||
static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null, LLStringUtil::null);}
|
||||
/// Load the given url in the operating system's web browser, async if we want to return immediately
|
||||
/// before browser has spawned
|
||||
static void loadURLExternal(const std::string& url) { loadURLExternal(url, LLStringUtil::null); };
|
||||
static void loadURLExternal(const std::string& url) {loadURLExternal(url, LLStringUtil::null);}
|
||||
static void loadURLExternal(const std::string& url, const std::string& uuid);
|
||||
static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null);
|
||||
|
||||
// Explicitly open a Web URL using the Web content floater vs. the more general media browser
|
||||
static void loadWebURL(const std::string& url, const std::string& target, const std::string& uuid);
|
||||
static void loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid);
|
||||
static void loadWebURLInternal(const std::string &url) { loadWebURLInternal(url, LLStringUtil::null, LLStringUtil::null); }
|
||||
static void loadWebURLInternal(const std::string &url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null);
|
||||
|
||||
/// Returns escaped url (eg, " " to "%20") - used by all loadURL methods
|
||||
static std::string escapeURL(const std::string& url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue