From a7395832cd58596098e04882d29b8defa8ef905c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 9 Nov 2009 15:38:46 -0700 Subject: Media browser now compiles (TODO: rewrite this file again) --- ChangeLog.txt | 7 ++++ linden/indra/newview/llfloaterhtmlhelp.cpp | 47 +++++++++++++++++++++- linden/indra/newview/llfloaterhtmlhelp.h | 4 ++ .../skins/default/xui/en-us/notifications.xml | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 29598dc..8018ec2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,13 @@ 2009-11-09 McCabe Maxsted + * Media browser now compiles (TODO: rewrite this file again). + + modified: linden/indra/newview/llfloaterhtmlhelp.cpp + modified: linden/indra/newview/llfloaterhtmlhelp.h + modified: linden/indra/newview/skins/default/xui/en-us/notifications.x + + * Moved 1.2 alerts to the new notification system. modified: linden/indra/newview/llfloatertools.cpp diff --git a/linden/indra/newview/llfloaterhtmlhelp.cpp b/linden/indra/newview/llfloaterhtmlhelp.cpp index 9f07e0f..8de489a 100644 --- a/linden/indra/newview/llfloaterhtmlhelp.cpp +++ b/linden/indra/newview/llfloaterhtmlhelp.cpp @@ -62,7 +62,9 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& media_data) void LLFloaterMediaBrowser::draw() { - childSetEnabled("go", !mAddressCombo->getValue().asString().empty()); + BOOL url_exists = !mAddressCombo->getValue().asString().empty(); + childSetEnabled("go", url_exists); + childSetEnabled("set_home", url_exists); LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if(parcel) { @@ -88,6 +90,8 @@ BOOL LLFloaterMediaBrowser::postBuild() childSetAction("close", onClickClose, this); childSetAction("open_browser", onClickOpenWebBrowser, this); childSetAction("assign", onClickAssign, this); + childSetAction("home", onClickHome, this); + childSetAction("set_home", onClickSetHome, this); buildURLHistory(); return TRUE; @@ -150,6 +154,7 @@ void LLFloaterMediaBrowser::onLocationChange( const EventType& eventIn ) childSetEnabled("back", mBrowser->canNavigateBack()); childSetEnabled("forward", mBrowser->canNavigateForward()); childSetEnabled("reload", TRUE); + gSavedSettings.setString("BrowserLastVisited", truncated_url); } LLFloaterMediaBrowser* LLFloaterMediaBrowser::showInstance(const LLSD& media_url) @@ -160,6 +165,46 @@ LLFloaterMediaBrowser* LLFloaterMediaBrowser::showInstance(const LLSD& media_url return floaterp; } +//static +void LLFloaterMediaBrowser::toggle() +{ + LLFloaterMediaBrowser* self = LLFloaterMediaBrowser::getInstance(); + + if(self->getVisible()) + { + self->close(); + } + else + { + //Show home url if new session, last visited if not + std::string last_url = gSavedSettings.getString("BrowserLastVisited"); + if(last_url.empty()) + last_url = gSavedSettings.getString("BrowserHome"); + showInstance(last_url); + } +} + +//static +void LLFloaterMediaBrowser::helpF1() +{ + std::string url = gSavedSettings.getString("HelpSupportURL"); + LLSD payload; + payload["url"] = url; + + LLNotifications::instance().add("ClickOpenF1Help", LLSD(), payload, onClickF1HelpLoadURL); +} + +// static +bool LLFloaterMediaBrowser::onClickF1HelpLoadURL(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + if (option == 0) + { + LLWeb::loadURL(notification["payload"]["url"].asString()); + } + return false; +} + //static void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data) { diff --git a/linden/indra/newview/llfloaterhtmlhelp.h b/linden/indra/newview/llfloaterhtmlhelp.h index deb5c4c..5b09634 100644 --- a/linden/indra/newview/llfloaterhtmlhelp.h +++ b/linden/indra/newview/llfloaterhtmlhelp.h @@ -66,6 +66,9 @@ public: void buildURLHistory(); static LLFloaterMediaBrowser* showInstance(const LLSD& id); + + static void toggle(); + static void helpF1(); static void onEnterAddress(LLUICtrl* ctrl, void* user_data); static void onClickRefresh(void* user_data); static void onClickBack(void* user_data); @@ -76,6 +79,7 @@ public: static void onClickAssign(void* user_data); static void onClickHome(void* user_data); static void onClickSetHome(void* user_data); + static bool onClickF1HelpLoadURL(const LLSD& notification, const LLSD& response); private: LLWebBrowserCtrl* mBrowser; diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index 8fe2db0..665b972 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml @@ -4107,7 +4107,7 @@ Add this Ability to '[ROLE_NAME]'? type="alertmodal"> Visit the [SECOND_LIFE] Support Website? (note: this is not an Imprudence Help site) -- cgit v1.1