summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/app_settings/settings.xml8
-rwxr-xr-xindra/newview/llavataractions.cpp20
-rw-r--r--indra/newview/llfloaterwebcontent.cpp71
-rw-r--r--indra/newview/llfloaterwebcontent.h1
-rw-r--r--indra/newview/llfloaterwebprofile.cpp79
-rw-r--r--indra/newview/llfloaterwebprofile.h59
-rw-r--r--indra/newview/llviewerfloaterreg.cpp5
8 files changed, 187 insertions, 58 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9368433a9f..6b2fe1e45a 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -244,6 +244,7 @@ set(viewer_SOURCE_FILES
llfloaterurlentry.cpp
llfloatervoiceeffect.cpp
llfloaterwebcontent.cpp
+ llfloaterwebprofile.cpp
llfloaterwhitelistentry.cpp
llfloaterwindowsize.cpp
llfloaterworldmap.cpp
@@ -797,6 +798,7 @@ set(viewer_HEADER_FILES
llfloaterurlentry.h
llfloatervoiceeffect.h
llfloaterwebcontent.h
+ llfloaterwebprofile.h
llfloaterwhitelistentry.h
llfloaterwindowsize.h
llfloaterworldmap.h
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 1e07ed8a27..8a0ed47bc3 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -13424,10 +13424,10 @@
<key>Value</key>
<integer>1</integer>
</map>
- <key>WebProfileRect</key>
+ <key>WebProfileFloaterRect</key>
<map>
<key>Comment</key>
- <string>Web profile dimensions</string>
+ <string>Web profile floater dimensions</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -13435,8 +13435,8 @@
<key>Value</key>
<array>
<integer>0</integer>
- <integer>650</integer>
- <integer>490</integer>
+ <integer>730</integer>
+ <integer>485</integer>
<integer>0</integer>
</array>
</map>
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 2f331bdab1..8ca621538f 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -308,20 +308,6 @@ static const char* get_profile_floater_name(const LLUUID& avatar_id)
return avatar_id == gAgentID ? "my_profile" : "profile";
}
-static const LLRect& get_preferred_profile_rect(const LLUUID& avatar_id)
-{
- if (avatar_id == gAgentID &&
- LLFloaterReg::getInstance(get_profile_floater_name(avatar_id))->hasSavedRect())
- {
- return LLRect::null; // no preference, use saved rect
- }
-
- // Preferred size for all residents' profiles
- // and default size for our own profile.
- static LLCachedControl<LLRect> profile_rect(gSavedSettings, "WebProfileRect");
- return profile_rect;
-}
-
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name)
{
std::string username = av_name.mUsername;
@@ -334,13 +320,9 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa
std::string url = getProfileURL(username);
// PROFILES: open in webkit window
- const bool show_chrome = false;
LLFloaterWebContent::Params p;
p.url(url).
- id(agent_id.asString()).
- show_chrome(show_chrome).
- window_class("profile").
- preferred_media_size(get_preferred_profile_rect(agent_id));
+ id(agent_id.asString());
LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p);
}
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index d6db7aa6ad..f3beacea4f 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -128,39 +128,7 @@ bool LLFloaterWebContent::matchesKey(const LLSD& key)
//static
LLFloater* LLFloaterWebContent::create( Params p)
{
- lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;
-
- if (!p.id.isProvided())
- {
- p.id = LLUUID::generateNewID().asString();
- }
-
- if(p.target().empty() || p.target() == "_blank")
- {
- p.target = p.id();
- }
-
- S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
- 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.
-
- LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
- lldebugs << "total instance count is " << instances.size() << llendl;
-
- for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
- {
- lldebugs << " " << (*iter)->getKey()["target"] << llendl;
- }
-
- if(instances.size() >= (size_t)browser_window_limit)
- {
- // Destroy the least recently opened instance
- (*instances.begin())->closeFloater();
- }
- }
-
+ preCreate(p);
return new LLFloaterWebContent(p);
}
@@ -211,6 +179,43 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
setShape(new_rect);
}
+// static
+void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
+{
+ lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;
+
+ if (!p.id.isProvided())
+ {
+ p.id = LLUUID::generateNewID().asString();
+ }
+
+ if(p.target().empty() || p.target() == "_blank")
+ {
+ p.target = p.id();
+ }
+
+ S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
+ 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.
+
+ LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
+ lldebugs << "total instance count is " << instances.size() << llendl;
+
+ for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
+ {
+ lldebugs << " " << (*iter)->getKey()["target"] << llendl;
+ }
+
+ if(instances.size() >= (size_t)browser_window_limit)
+ {
+ // Destroy the least recently opened instance
+ (*instances.begin())->closeFloater();
+ }
+ }
+}
+
void LLFloaterWebContent::open_media(const Params& p)
{
// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 9d90306a9c..2a2a9e110b 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -90,6 +90,7 @@ protected:
void onEnterAddress();
void onPopExternal();
+ static void preCreate(Params& p);
void open_media(const Params& );
void set_current_url(const std::string& url);
diff --git a/indra/newview/llfloaterwebprofile.cpp b/indra/newview/llfloaterwebprofile.cpp
new file mode 100644
index 0000000000..7ee7b5172c
--- /dev/null
+++ b/indra/newview/llfloaterwebprofile.cpp
@@ -0,0 +1,79 @@
+/**
+ * @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 "llviewercontrol.h"
+
+LLFloaterWebProfile::LLFloaterWebProfile(const Params& key) :
+ LLFloaterWebContent(key)
+{
+}
+
+void LLFloaterWebProfile::onOpen(const LLSD& key)
+{
+ Params p(key);
+ LLFloaterWebContent::onOpen(p);
+ 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);
+}
+
+LLFloater* LLFloaterWebProfile::create(const LLSD& key)
+{
+ LLFloaterWebContent::Params p(key);
+ preCreate(p);
+ p.show_chrome(false).
+ window_class("profile");
+ 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.
+ LLRect new_rect = getRect();
+ new_rect.setLeftTopAndSize(
+ 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 100644
index 0000000000..4c355e401b
--- /dev/null
+++ b/indra/newview/llfloaterwebprofile.h
@@ -0,0 +1,59 @@
+/**
+ * @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(const LLSD& key);
+ /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
+
+ static LLFloater* create(const LLSD& key);
+
+private:
+ void applyPreferredRect();
+};
+
+#endif // LL_LLFLOATERWEBPROFILE_H
+
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index acbc5f8fb6..8406f639df 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -65,6 +65,7 @@
#include "llfloaterhardwaresettings.h"
#include "llfloaterhelpbrowser.h"
#include "llfloaterwebcontent.h"
+#include "llfloaterwebprofile.h"
#include "llfloatermediasettings.h"
#include "llfloaterhud.h"
#include "llfloaterimagepreview.h"
@@ -285,8 +286,8 @@ 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("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
- LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
+ LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
+ LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);