diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloatersearch.cpp | 91 | ||||
-rw-r--r-- | indra/newview/llfloatersearch.h | 74 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_search.xml | 60 |
5 files changed, 229 insertions, 2 deletions
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<LLMediaCtrl>("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 <string> + +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<LLFloaterRunQueue>); 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_directory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDirectory>); + LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>); LLFloaterUIPreviewUtil::registerFloater(); LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "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 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + can_resize="true" + height="400" + layout="topleft" + min_height="140" + min_width="467" + name="floater_search" + help_topic="floater_search" + save_rect="true" + single_instance="true" + title="Search [SECOND_LIFE]" + width="620"> + <floater.string + name="search_url"> + http://eniac21.lindenlab.com:10001/viewer/search/ + </floater.string> + <floater.string + name="loading_text"> + Loading... + </floater.string> + <floater.string + name="done_text"> + Done + </floater.string> + <layout_stack + bottom="400" + follows="left|right|top|bottom" + layout="topleft" + left="10" + name="stack1" + top="20" + width="600"> + <layout_panel + height="12" + layout="topleft" + left_delta="0" + name="external_controls" + top_delta="0" + user_resize="false" + width="570"> + <web_browser + bottom="-10" + follows="left|right|top|bottom" + layout="topleft" + left="0" + name="browser" + top="0" + width="570" /> + <text + follows="bottom|left" + height="16" + layout="topleft" + left_delta="0" + name="status_text" + top_pad="4" + width="150" /> + </layout_panel> + </layout_stack> +</floater> |