From 4ac6e30595d51f873fc21d8ab8b4cc199758492f Mon Sep 17 00:00:00 2001 From: Martin Reddy Date: Mon, 19 Oct 2009 11:59:57 +0000 Subject: DEV-41359: Added a new web-based Search floater, LLFloaterSearch. This new Search floater replaces the current XUI-based search interface with one that is implemented entirely as a web service. This is currently pointing toward a temporary search URL. The URL will be updated when the stable version is available. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatersearch.cpp | 91 ++++++++++++++++++++++ indra/newview/llfloatersearch.h | 74 ++++++++++++++++++ indra/newview/llviewerfloaterreg.cpp | 4 +- .../skins/default/xui/en/floater_search.xml | 60 ++++++++++++++ 5 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 indra/newview/llfloatersearch.cpp create mode 100644 indra/newview/llfloatersearch.h create mode 100644 indra/newview/skins/default/xui/en/floater_search.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 51840bf696..abf0b085cd 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -195,6 +195,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterscriptdebug.cpp + llfloatersearch.cpp llfloatersellland.cpp llfloatersettingsdebug.cpp llfloatersnapshot.cpp @@ -669,6 +670,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterscriptdebug.h + llfloatersearch.h llfloatersellland.h llfloatersettingsdebug.h llfloatersnapshot.h diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp new file mode 100644 index 0000000000..904263e2c2 --- /dev/null +++ b/indra/newview/llfloatersearch.cpp @@ -0,0 +1,91 @@ +/** + * @file llfloatersearch.cpp + * @author Martin Reddy + * @brief Search floater - uses an embedded web browser control + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloatersearch.h" +#include "llmediactrl.h" + + +LLFloaterSearch::LLFloaterSearch(const LLSD& key) : + LLFloater(key), + mBrowser(NULL) +{ +} + +BOOL LLFloaterSearch::postBuild() +{ + mBrowser = getChild("browser"); + if (mBrowser) + { + mBrowser->addObserver(this); + mBrowser->setTrusted(true); + mBrowser->setHomePageUrl(getString("search_url")); + } + + return TRUE; +} + +void LLFloaterSearch::onOpen(const LLSD& key) +{ + search(key); +} + +void LLFloaterSearch::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) +{ + switch (event) + { + case MEDIA_EVENT_NAVIGATE_BEGIN: + childSetText("status_text", getString("loading_text")); + break; + + case MEDIA_EVENT_NAVIGATE_COMPLETE: + childSetText("status_text", getString("done_text")); + break; + + default: + break; + } +} + +void LLFloaterSearch::search(const LLSD &key) +{ + if (mBrowser) + { + std::string query = getString("search_url"); + if (key.has("id")) + { + query += std::string("?q=") + key["id"].asString(); + } + mBrowser->navigateTo(query); + } +} diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h new file mode 100644 index 0000000000..46af53b154 --- /dev/null +++ b/indra/newview/llfloatersearch.h @@ -0,0 +1,74 @@ +/** + * @file llfloatersearch.h + * @author Martin Reddy + * @brief Search floater - uses an embedded web browser control + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERSEARCH_H +#define LL_LLFLOATERSEARCH_H + +#include "llfloater.h" +#include "llviewermediaobserver.h" + +#include + +class LLMediaCtrl; + +/// +/// The search floater allows users to perform all search operations. +/// All search functionality is now implemented via web services and +/// so this floater simply embeds a web view and displays the search +/// web page. The browser control is explicitly marked as "trusted" +/// so that the user can click on teleport links in search results. +/// +class LLFloaterSearch : + public LLFloater, + public LLViewerMediaObserver +{ +public: + LLFloaterSearch(const LLSD& key); + + /// show the search floater with a new search + /*virtual*/ void onOpen(const LLSD& key); + + /// perform a search with the specific search term + void search(const LLSD &key); + +private: + /*virtual*/ BOOL postBuild(); + + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event); + + LLMediaCtrl *mBrowser; +}; + +#endif // LL_LLFLOATERSEARCH_H + diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 26498ffc9b..81917ec76e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -57,7 +57,7 @@ #include "llfloaterchat.h" #include "llfloaterchatterbox.h" #include "llfloaterdaycycle.h" -#include "llfloaterdirectory.h" +#include "llfloatersearch.h" #include "llfloaterenvsettings.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" @@ -232,7 +232,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("search", "floater_directory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterUIPreviewUtil::registerFloater(); LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml new file mode 100644 index 0000000000..4ac0edca5a --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_search.xml @@ -0,0 +1,60 @@ + + + + http://eniac21.lindenlab.com:10001/viewer/search/ + + + Loading... + + + Done + + + + + + + + -- cgit v1.2.3