From 0e349736b71089dc55a50ff1854f11dafbf17d29 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 6 Feb 2016 10:52:56 -0500 Subject: [PATCH] All search on SL looks awful, let's just use the Web tab instead now. --- indra/newview/llfloaterdirectory.cpp | 62 +++++++++------ indra/newview/llfloaterdirectory.h | 6 +- indra/newview/llfloatersearch.cpp | 78 ++++++------------- indra/newview/llfloatersearch.h | 10 +-- indra/newview/llpaneldirfind.cpp | 26 ++++++- indra/newview/llpaneldirfind.h | 7 +- .../default/xui/de/floater_directory.xml | 12 +-- .../default/xui/en-us/floater_directory.xml | 28 +++---- .../default/xui/es/floater_directory.xml | 12 +-- .../default/xui/fr/floater_directory.xml | 1 + .../default/xui/it/floater_directory.xml | 1 + .../default/xui/pt/floater_directory.xml | 1 + 12 files changed, 119 insertions(+), 125 deletions(-) diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 25ee21f7d..5fabc254f 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -204,7 +204,6 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) { sInstance = this; - mFindAllPanel = NULL; mClassifiedPanel = NULL; mEventsPanel = NULL; mLandPanel = NULL; @@ -228,7 +227,6 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["people_panel"] = LLCallbackMap(createPeople, this); factory_map["groups_panel"] = LLCallbackMap(createGroups, this); factory_map[market_panel] = LLCallbackMap(LLPanelDirMarket::create, this); - factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); if (secondlife) { @@ -236,6 +234,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) } else { + factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this); } @@ -260,7 +259,9 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) LLTabContainer* container = getChild("Directory Tabs"); if (secondlife) { - container->removeTabPanel(getChild("find_all_old_panel")); // Not used + // Remove unused tabs + container->removeTabPanel(getChild("find_all_panel")); + container->removeTabPanel(getChild("find_all_old_panel")); } else { @@ -305,9 +306,7 @@ LLFloaterDirectory::~LLFloaterDirectory() // static void *LLFloaterDirectory::createFindAll(void* userdata) { - LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; - self->mFindAllPanel = LLPanelDirFindAllInterface::create(self); - return self->mFindAllPanel; + return LLPanelDirFindAllInterface::create(static_cast(userdata)); } // static @@ -452,24 +451,43 @@ void LLFloaterDirectory::requestClassifieds() } } -void LLFloaterDirectory::searchInAll(const std::string& search_text) +void LLFloaterDirectory::search(const LLFloaterSearch::SearchQuery& search) { start(); - LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); - performQueryOn2("classified_panel", search_text); - performQueryOn2("events_panel", search_text); - performQueryOn2("groups_panel", search_text); - performQueryOn2("people_panel", search_text); - performQueryOn2("places_panel", search_text); + const std::string category(search.category()); + const std::string search_text(search.query); + if (category.empty()) + { + LLPanelDirFindAllInterface::search(sInstance, search); + performQueryOn2("classified_panel", search_text); + performQueryOn2("events_panel", search_text); + performQueryOn2("groups_panel", search_text); + performQueryOn2("people_panel", search_text); + performQueryOn2("places_panel", search_text); + } + else if (category == "all") + LLPanelDirFindAllInterface::search(sInstance, search, true); + else if (category == "people") + showPeople(search.query); + else if (category == "places") + showPlaces(search.query); + else if (category == "events") + showEvents(search.query); + else if (category == "groups") + showGroups(search.query); + /* Singu TODO: Wiki tab in secondlife legacy search floater? + else if (category == "wiki") + LLFloaterDirectory::showWiki(search.query);*/ + else if (category == "destinations") + showDestinations(); + else if (category == "classifieds") + showClassified(search.query); + else if (gHippoGridManager->getConnectedGrid()->isSecondLife()) + LLPanelDirFindAllInterface::search(sInstance, search, true); + else + LLNotificationsUtil::add("UnsupportedCommandSLURL"); // Singu Note: Perhaps we should use a special notification here? } -void LLFloaterDirectory::showFindAll(const std::string& search_text) -{ - showPanel(LFSimFeatureHandler::instance().searchURL().empty() ? "find_all_old_panel" : "find_all_panel"); - LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); -} - - void LLFloaterDirectory::showClassified(const LLUUID& classified_id) { showPanel("classified_panel"); @@ -598,7 +616,7 @@ void LLFloaterDirectory::start() void LLFloaterDirectory::showPanel(const std::string& tabname) { start(); - sInstance->childShowTab("Directory Tabs", tabname); + sInstance->findChild("Directory Tabs")->selectTabByName(tabname); sInstance->focusCurrentPanel(); } @@ -616,7 +634,7 @@ void LLFloaterDirectory::toggleFind(void*) || (inst.destinationGuideURL().empty() && panel == "showcase_panel")) panel = "find_all_old_panel"; } - else if (panel == "find_all_old_panel") panel = "find_all_panel"; + else if (panel == "find_all_panel" || panel == "find_all_old_panel") panel = "web_panel"; showPanel(panel); diff --git a/indra/newview/llfloaterdirectory.h b/indra/newview/llfloaterdirectory.h index c36ce412b..e685b8d30 100644 --- a/indra/newview/llfloaterdirectory.h +++ b/indra/newview/llfloaterdirectory.h @@ -33,7 +33,7 @@ #ifndef LL_LLFLOATERDIRECTORY_H #define LL_LLFLOATERDIRECTORY_H -#include "llfloater.h" +#include "llfloatersearch.h" #include "lltabcontainer.h" class LLDirectoryCore; @@ -71,8 +71,7 @@ public: // Outside UI widgets can spawn this floater with various tabs // selected. - static void searchInAll(const std::string& search_text); - static void showFindAll(const std::string& search_text); + static void search(const LLFloaterSearch::SearchQuery& search); static void showClassified(const LLUUID& classified_id); static void showClassified(const std::string& search_text = ""); static void showEvents(S32 event_id); @@ -102,7 +101,6 @@ private: private: // Some special "showByID" functions use these cached pointers. // They could be replaced by getPanelByName(), perhaps. JC - LLPanelDirFindAll* mFindAllPanel; LLPanelDirClassified* mClassifiedPanel; LLPanelDirEvents* mEventsPanel; LLPanelDirLand* mLandPanel; diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 67e9421a5..f0fdc3444 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -113,20 +113,8 @@ LLFloaterSearch::_Params::_Params() } LLFloaterSearch::LLFloaterSearch(const Params& key) : - LLFloaterWebContent(key), - mSearchGodLevel(0) + LLFloaterWebContent(key) { - // declare a map that transforms a category name into - // the URL suffix that is used to search that category - mCategoryPaths = LLSD::emptyMap(); - mCategoryPaths["all"] = "search"; - mCategoryPaths["people"] = "search/people"; - mCategoryPaths["places"] = "search/places"; - mCategoryPaths["events"] = "search/events"; - mCategoryPaths["groups"] = "search/groups"; - mCategoryPaths["wiki"] = "search/wiki"; - mCategoryPaths["destinations"] = "destinations"; - mCategoryPaths["classifieds"] = "classifieds"; LLUICtrlFactory::getInstance()->buildFloater(this, "floater_web_content.xml"); } @@ -143,8 +131,8 @@ BOOL LLFloaterSearch::postBuild() getChildView("popexternal")->setEnabled(false); setRectControl("FloaterSearchRect"); applyRectControl(); - search(SearchQuery()); - gSavedSettings.getControl("SearchURL")->getSignal()->connect(boost::bind(&LLFloaterSearch::search, this, SearchQuery())); + search(SearchQuery(), mWebBrowser); + gSavedSettings.getControl("SearchURL")->getSignal()->connect(boost::bind(LLFloaterSearch::search, SearchQuery(), mWebBrowser)); return TRUE; } @@ -156,32 +144,11 @@ void LLFloaterSearch::showInstance(const SearchQuery& search, bool web) { LLFloaterSearch* floater = getInstance(); floater->open(); // May not be open - floater->search(search); + floater->search(search, floater->mWebBrowser); } else { - const std::string category(search.category()); - if (category.empty()) - LLFloaterDirectory::searchInAll(search.query); - else if (category == "all") - LLFloaterDirectory::showFindAll(search.query); - else if (category == "people") - LLFloaterDirectory::showPeople(search.query); - else if (category == "places") - LLFloaterDirectory::showPlaces(search.query); - else if (category == "events") - LLFloaterDirectory::showEvents(search.query); - else if (category == "groups") - LLFloaterDirectory::showGroups(search.query); - /* Singu TODO: Wiki tab in secondlife legacy search floater? - else if (category == "wiki") - LLFloaterDirectory::showWiki(search.query);*/ - else if (category == "destinations") - LLFloaterDirectory::showDestinations(); - else if (category == "classifieds") - LLFloaterDirectory::showClassified(search.query); - else - LLNotificationsUtil::add("UnsupportedCommandSLURL"); // Singu Note: Perhaps we should use a special notification here? + LLFloaterDirectory::search(search); } } @@ -192,7 +159,7 @@ void LLFloaterSearch::showInstance(const SearchQuery& search, bool web) p.allow_address_entry = false; LLFloaterWebContent::onOpen(p); - search(p.search); + search(p.search, mWebBrowser); }*/ void LLFloaterSearch::onClose(bool app_quitting) @@ -208,31 +175,30 @@ void LLFloaterSearch::onClose(bool app_quitting) destroy(); } -void LLFloaterSearch::godLevelChanged(U8 godlevel) -{ - // search results can change based upon god level - if the user - // changes god level, then give them a warning (we don't refresh - // the search as this might undo any page navigation or - // AJAX-driven changes since the last search). - - //FIXME: set status bar text - - //getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel)); -} - -void LLFloaterSearch::search(const SearchQuery &p) +// static +void LLFloaterSearch::search(const SearchQuery &p, LLMediaCtrl* mWebBrowser) { if (! mWebBrowser || !p.validateBlock()) { return; } - // reset the god level warning as we're sending the latest state - //getChildView("refresh_search")->setVisible(FALSE); - mSearchGodLevel = gAgent.getGodLevel(); - // work out the subdir to use based on the requested category LLSD subs; + // declare a map that transforms a category name into + // the URL suffix that is used to search that category + static LLSD mCategoryPaths = LLSD::emptyMap(); + if (mCategoryPaths.size() == 0) + { + mCategoryPaths["all"] = "search"; + mCategoryPaths["people"] = "search/people"; + mCategoryPaths["places"] = "search/places"; + mCategoryPaths["events"] = "search/events"; + mCategoryPaths["groups"] = "search/groups"; + mCategoryPaths["wiki"] = "search/wiki"; + mCategoryPaths["destinations"] = "destinations"; + mCategoryPaths["classifieds"] = "classifieds"; + } if (mCategoryPaths.has(p.category)) { subs["CATEGORY"] = mCategoryPaths[p.category].asString(); diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h index 8cba06a1e..96fbd35c1 100644 --- a/indra/newview/llfloatersearch.h +++ b/indra/newview/llfloatersearch.h @@ -79,18 +79,10 @@ public: /// - "id": specifies the text phrase to search for /// - "category": one of "all" (default), "people", "places", /// "events", "groups", "wiki", "destinations", "classifieds" - void search(const SearchQuery &query); - - /// changing godmode can affect the search results that are - /// returned by the search website - use this method to tell the - /// search floater that the user has changed god level. - void godLevelChanged(U8 godlevel); + static void search(const SearchQuery& query, LLMediaCtrl* mWebBrowser); private: /*virtual*/ BOOL postBuild(); - - LLSD mCategoryPaths; - U8 mSearchGodLevel; }; #endif // LL_LLFLOATERSEARCH_H diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index 1792d0c9d..7c7a7c21c 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -598,6 +598,7 @@ void LLPanelDirFind::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent even // LLPanelDirFindAllInterface //--------------------------------------------------------------------------- +static LLPanelDirFindAll* sFindAll = NULL; // static LLPanelDirFindAll* LLPanelDirFindAllInterface::create(LLFloaterDirectory* floater) { @@ -606,12 +607,29 @@ LLPanelDirFindAll* LLPanelDirFindAllInterface::create(LLFloaterDirectory* floate static LLPanelDirFindAllOld* sFindAllOld = NULL; // static -void LLPanelDirFindAllInterface::search(LLPanelDirFindAll* panel, - const std::string& search_text) +void LLPanelDirFindAllInterface::search(LLFloaterDirectory* inst, + const LLFloaterSearch::SearchQuery& search, bool show) { bool secondlife(gHippoGridManager->getConnectedGrid()->isSecondLife()); - if (secondlife || !getSearchUrl().empty()) panel->search(search_text); - if (!secondlife && sFindAllOld) sFindAllOld->search(search_text); + LLPanelDirFind* find_panel(secondlife ? inst->findChild("web_panel") : sFindAll); + LLPanel* panel(find_panel); + if (secondlife) + LLFloaterSearch::search(search, find_panel->mWebBrowser); + else + { + bool has_url(!getSearchUrl().empty()); + if (has_url) find_panel->search(search.query); + if (sFindAllOld) + { + sFindAllOld->search(search.query); + if (!has_url) panel = sFindAllOld; + } + } + if (show && panel) + { + inst->findChild("Directory Tabs")->selectTabPanel(panel); + panel->setFocus(true); + } } // static diff --git a/indra/newview/llpaneldirfind.h b/indra/newview/llpaneldirfind.h index 866c330a8..f5e4b690c 100644 --- a/indra/newview/llpaneldirfind.h +++ b/indra/newview/llpaneldirfind.h @@ -34,10 +34,8 @@ #define LL_LLPANELDIRFIND_H #include "llpaneldirbrowser.h" -#include "llmediactrl.h" +#include "llfloatersearch.h" -class LLUICtrl; -class LLLineEditor; class LLPanelDirFindAll; class LLFloaterDirectory; @@ -76,6 +74,7 @@ private: /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); protected: + friend class LLPanelDirFindAllInterface; LLMediaCtrl* mWebBrowser; std::string mBrowserName; }; @@ -84,7 +83,7 @@ class LLPanelDirFindAllInterface { public: static LLPanelDirFindAll* create(LLFloaterDirectory* floater); - static void search(LLPanelDirFindAll* panel, const std::string& search_text); + static void search(LLFloaterDirectory* inst, const LLFloaterSearch::SearchQuery& search, bool show = false); static void focus(LLPanelDirFindAll* panel); }; diff --git a/indra/newview/skins/default/xui/de/floater_directory.xml b/indra/newview/skins/default/xui/de/floater_directory.xml index 7dfa569bd..be4c32662 100644 --- a/indra/newview/skins/default/xui/de/floater_directory.xml +++ b/indra/newview/skins/default/xui/de/floater_directory.xml @@ -54,6 +54,12 @@ Fertig http://secondlife.com/app/search/notfound.html "http://secondlife.com/app/search/index.php?" + + + + + + Loading... + Done + [APP_SITE]/404 + http://search.secondlife.com/ Done [APP_SITE]/404 https://marketplace.secondlife.com/ - - - - - - Loading... - Done - [APP_SITE]/404 - http://search.secondlife.com/ + +