Skip to content
Snippets Groups Projects
Commit 4ac6e305 authored by Martin Reddy's avatar Martin Reddy
Browse files

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.
parent f8964b2b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
/**
* @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);
}
}
/**
* @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
......@@ -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");
......
<?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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment