Allow editing the media white/blacklists. Originally from Sione Lomu, adapted to Firestorm by Tonya Souther.

master
Tonya Souther 2011-03-02 21:59:17 -06:00
parent 3c8e3d66b1
commit bfe40d5ec3
10 changed files with 498 additions and 1 deletions

View File

@ -635,6 +635,9 @@ SignpostMarv Martin
VWR-8357
Simon Nolan
VWR-409
Sione Lomu
PHOE-2514
PHOE-2547
SpacedOut Frye
VWR-34
VWR-45

View File

@ -70,6 +70,7 @@ include_directories(
set(viewer_SOURCE_FILES
chatbar_as_cmdline.cpp
kcwlinterface.cpp
floatermedialists.cpp
fscontactsfloater.cpp
llagent.cpp
llagentaccess.cpp
@ -616,6 +617,7 @@ set(viewer_HEADER_FILES
ViewerInstall.cmake
chatbar_as_cmdline.h
kcwlinterface.h
floatermedialists.h
fscontactsfloater.h
llagent.h
llagentaccess.h

View File

@ -5716,6 +5716,22 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>MediaListRect</key>
<map>
<key>Comment</key>
<string>Rectangle for Media List window</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>100</integer>
<integer>100</integer>
<integer>100</integer>
</array>
</map>
<key>MediaOnAPrimUI</key>
<map>
<key>Comment</key>

View File

@ -0,0 +1,223 @@
/**
* @file floatermedialists.cpp
* @brief Floater to edit media white/blacklists - implementation
*
* $LicenseInfo:firstyear=2011&license=fsviewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (C) 2011, Sione Lomu
* Copyright (C) 2011, The Phoenix Viewer Project, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Viewer Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "floatermedialists.h"
#include "llviewerparcelmedia.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "lllineeditor.h"
bool FloaterMediaLists::sIsWhitelist;
FloaterMediaLists::FloaterMediaLists(const LLSD& key) :
LLFloater(key)
{
}
FloaterMediaLists::~FloaterMediaLists()
{
}
BOOL FloaterMediaLists::postBuild()
{
mWhitelistSLC = getChild<LLScrollListCtrl>("whitelist_list");
mBlacklistSLC = getChild<LLScrollListCtrl>("blacklist_list");
childSetAction("add_whitelist", onWhitelistAdd,this);
childSetAction("remove_whitelist", onWhitelistRemove,this);
childSetAction("add_blacklist", onBlacklistAdd,this);
childSetAction("remove_blacklist", onBlacklistRemove,this);
childSetAction("commit_domain", onCommitDomain,this);
if (!mWhitelistSLC || !mBlacklistSLC)
{
return true;
}
for(S32 i = 0;i<(S32)LLViewerParcelMedia::sMediaFilterList.size();i++)
{
if (LLViewerParcelMedia::sMediaFilterList[i]["action"].asString() == "allow")
{
LLSD element;
element["columns"][0]["column"] = "whitelist_col";
element["columns"][0]["value"] = LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString();
element["columns"][0]["font"] = "SANSSERIF";
mWhitelistSLC->addElement(element);
mWhitelistSLC->sortByColumn("whitelist_col",TRUE);
}
else if (LLViewerParcelMedia::sMediaFilterList[i]["action"].asString() == "deny")
{
LLSD element;
element["columns"][0]["column"] = "blacklist_col";
element["columns"][0]["value"] = LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString();
element["columns"][0]["font"] = "SANSSERIF";
mBlacklistSLC->addElement(element);
mBlacklistSLC->sortByColumn("blacklist_col",TRUE);
}
}
return TRUE;
}
void FloaterMediaLists::draw()
{
refresh();
LLFloater::draw();
}
void FloaterMediaLists::refresh()
{
}
//static
void FloaterMediaLists::onWhitelistAdd( void* data )
{
FloaterMediaLists* self = (FloaterMediaLists*)data;
self->getChildView("blacklist_list")->setEnabled(false);
self->getChildView("whitelist_list")->setEnabled(false);
self->getChildView("remove_whitelist")->setEnabled(false);
self->getChildView("add_whitelist")->setEnabled(false);
self->getChildView("remove_blacklist")->setEnabled(false);
self->getChildView("add_blacklist")->setEnabled(false);
self->getChildView("input_domain")->setVisible(true);
self->getChildView("commit_domain")->setVisible(true);
self->getChild<LLUICtrl>("add_text")->
setValue(std::string("Enter domain/url to add to domain whitelist:"));
self->getChildView("add_text")->setVisible(true);
sIsWhitelist = true;
}
void FloaterMediaLists::onWhitelistRemove( void* data )
{
FloaterMediaLists* self = (FloaterMediaLists*)data;
LLScrollListItem* selected = self->mWhitelistSLC->getFirstSelected();
if (selected)
{
std::string domain = self->mWhitelistSLC->getSelectedItemLabel();
for(S32 i = 0;i<(S32)LLViewerParcelMedia::sMediaFilterList.size();i++)
{
if (LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString() == domain)
{
LLViewerParcelMedia::sMediaFilterList.erase(i);
LLViewerParcelMedia::saveDomainFilterList();
break;
}
}
self->mWhitelistSLC->deleteSelectedItems();
}
}
void FloaterMediaLists::onBlacklistAdd( void* data )
{
FloaterMediaLists* self = (FloaterMediaLists*)data;
self->getChildView("blacklist_list")->setEnabled(false);
self->getChildView("whitelist_list")->setEnabled(false);
self->getChildView("remove_whitelist")->setEnabled(false);
self->getChildView("add_whitelist")->setEnabled(false);
self->getChildView("remove_blacklist")->setEnabled(false);
self->getChildView("add_blacklist")->setEnabled(false);
self->getChildView("input_domain")->setVisible(true);
self->getChildView("commit_domain")->setVisible(true);
self->getChild<LLUICtrl>("add_text")->
setValue(std::string("Enter domain/url to add to domain blacklist:"));
self->getChildView("add_text")->setVisible(true);
self->sIsWhitelist = false;
}
void FloaterMediaLists::onBlacklistRemove( void* data )
{
FloaterMediaLists* self = (FloaterMediaLists*)data;
LLScrollListItem* selected = self->mBlacklistSLC->getFirstSelected();
if (selected)
{
std::string domain = self->mBlacklistSLC->getSelectedItemLabel();
for(S32 i = 0;i<(S32)LLViewerParcelMedia::sMediaFilterList.size();i++)
{
if (LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString() == domain)
{
LLViewerParcelMedia::sMediaFilterList.erase(i);
LLViewerParcelMedia::saveDomainFilterList();
break;
}
}
self->mBlacklistSLC->deleteSelectedItems();
}
}
void FloaterMediaLists::onCommitDomain( void* data )
{
FloaterMediaLists* self = (FloaterMediaLists*)data;
std::string domain =
self->getChild<LLLineEditor>("input_domain")->getText();
domain = LLViewerParcelMedia::extractDomain(domain);
if (sIsWhitelist)
{
LLSD newmedia;
newmedia["domain"] = domain;
newmedia["action"] = "allow";
LLViewerParcelMedia::sMediaFilterList.append(newmedia);
LLViewerParcelMedia::saveDomainFilterList();
LLSD element;
element["columns"][0]["column"] = "whitelist_col";
element["columns"][0]["value"] = domain;
element["columns"][0]["font"] = "SANSSERIF";
self->mWhitelistSLC->addElement(element);
self->mWhitelistSLC->sortByColumn("whitelist_col",TRUE);
}
else
{
LLSD newmedia;
newmedia["domain"] = domain;
newmedia["action"] = "deny";
LLViewerParcelMedia::sMediaFilterList.append(newmedia);
LLViewerParcelMedia::saveDomainFilterList();
LLSD element;
element["columns"][0]["column"] = "blacklist_col";
element["columns"][0]["value"] = domain;
element["columns"][0]["font"] = "SANSSERIF";
self->mBlacklistSLC->addElement(element);
self->mBlacklistSLC->sortByColumn("blacklist_col",TRUE);
}
self->getChildView("blacklist_list")->setEnabled(true);
self->getChildView("whitelist_list")->setEnabled(true);
self->getChildView("remove_whitelist")->setEnabled(true);
self->getChildView("add_whitelist")->setEnabled(true);
self->getChildView("remove_blacklist")->setEnabled(true);
self->getChildView("add_blacklist")->setEnabled(true);
self->getChildView("input_domain")->setVisible(false);
self->getChildView("commit_domain")->setVisible(false);
self->getChildView("add_text")->setVisible(false);
}

View File

@ -0,0 +1,57 @@
/**
* @file floatermedialists.h
* @brief Floater to edit media white/blacklists - headers
*
* $LicenseInfo:firstyear=2011&license=fsviewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (C) 2011, Sione Lomu
* Copyright (C) 2011, The Phoenix Viewer Project, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Viewer Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERMEDIALISTS_H
#define LL_LLFLOATERMEDIALISTS_H
#include "llfloater.h"
class LLScrollListCtrl;
class LLButton;
class FloaterMediaLists : public LLFloater
{
public:
FloaterMediaLists(const LLSD &);
BOOL postBuild();
virtual ~FloaterMediaLists();
virtual void draw();
void refresh();
static void onWhitelistAdd(void*);
static void onWhitelistRemove(void*);
static void onBlacklistAdd(void*);
static void onBlacklistRemove(void*);
static void onCommitDomain(void*);
private:
static bool sIsWhitelist;
LLScrollListCtrl* mWhitelistSLC;
LLScrollListCtrl* mBlacklistSLC;
};
#endif

View File

@ -316,6 +316,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
// mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2));
// mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this));
mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this));
mCommitCallbackRegistrar.add("Pref.EditMediaLists", boost::bind(&LLFloaterPreference::onClickSetKey, this));
mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this));
// mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this));
// mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this));

View File

@ -129,6 +129,7 @@
#include "rlvfloaters.h"
// [/RLVa:KB]
#include "fscontactsfloater.h"
#include "floatermedialists.h"
void LLViewerFloaterReg::registerFloaters()
{
@ -202,6 +203,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMemLeak>);
LLFloaterReg::add("media_browser", "floater_media_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaBrowser>);
LLFloaterReg::add("media_lists", "floater_media_lists.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FloaterMediaLists>);
LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaSettings>);
LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);

View File

@ -120,7 +120,7 @@ Starlight UI by Hitomi Tiponi and:
Alexandrea Fride, psi Merlin, Hugh Helendale, Digital Scribe, Naomah Beaumont, Nadin, KirstenLee Cinquetti
Additional code contributed by:
Satomi Ahn, Katharine Berry, Lance Corrimal, Nicki Dasmijn, Ansariel Hiller, Zwagoth Klaar, Shyotl Kuhr, Mysty Saunders, Thickbrick Sleaford, Hitomi Tiponi, Armin WeatherHax, Chalice Yao, Nogardrevlis Lectar, and others.
Satomi Ahn, Katharine Berry, Lance Corrimal, Nicki Dasmijn, Ansariel Hiller, Zwagoth Klaar, Shyotl Kuhr, Sione Lomu, Mysty Saunders, Thickbrick Sleaford, Hitomi Tiponi, Armin WeatherHax, Chalice Yao, Nogardrevlis Lectar, and others.
Additional Artists:
New icons by Joseph Wain / glyphish.com

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
can_close="true"
can_drag_on_left="false"
can_minimize="true"
can_resize="false"
enabled="true"
height="300"
name="floatermedialists"
title="Media Lists"
width="460"
rect_control="MediaListRect">
<text
bottom="40"
enabled="true"
follows="left|right|top"
font="SansSerifSmall"
height="16"
initial_value="false"
left="20"
mouse_opaque="true"
name="whitelist_text"
radio_style="false"
width="195">
Whitelist Domains
</text>
<scroll_list
background_visible="true"
bottom="210"
column_padding="5"
draw_border="true"
draw_heading="false"
height="160"
left="20"
mouse_opaque="true"
multi_select="false"
name="whitelist_list"
width="195">
<column label="Whitelist" name="whitelist_col" width="195" />
</scroll_list>
<button
bottom_delta="20"
enabled="true"
follows="bottom"
font="SansSerifSmall"
halign="center"
height="16"
label="Add..."
label_selected="Add..."
left_delta="5"
mouse_opaque="true"
name="add_whitelist"
scale_image="true"
width="80" />
<button
bottom_delta="0"
enabled="true"
follows="bottom"
font="SansSerifSmall"
halign="center"
height="16"
label="Remove"
label_selected="Remove"
left_delta="100"
mouse_opaque="true"
name="remove_whitelist"
scale_image="true"
width="80" />
<text
bottom="40"
enabled="true"
follows="left|right|top"
font="SansSerifSmall"
height="16"
initial_value="false"
left="240"
mouse_opaque="true"
name="blacklist_text"
radio_style="false"
width="195">
Blacklist Domains
</text>
<scroll_list
background_visible="true"
bottom="210"
column_padding="5"
draw_border="true"
draw_heading="false"
height="160"
left="240"
mouse_opaque="true"
multi_select="false"
name="blacklist_list"
width="195">
<column label="Blacklist" name="blacklist_col" width="195" />
</scroll_list>
<button
bottom_delta="20"
enabled="true"
follows="bottom"
font="SansSerifSmall"
halign="center"
height="16"
label="Add..."
label_selected="Add..."
left_delta="5"
mouse_opaque="true"
name="add_blacklist"
scale_image="true"
width="80" />
<button
bottom_delta="0"
enabled="true"
follows="bottom"
font="SansSerifSmall"
halign="center"
height="16"
label="Remove"
label_selected="Remove"
left_delta="100"
mouse_opaque="true"
name="remove_blacklist"
scale_image="true"
width="80" />
<text
bottom="250"
enabled="true"
follows="left|right|top"
font="SansSerifSmall"
height="16"
initial_value="false"
left="20"
mouse_opaque="true"
name="add_text"
radio_style="false"
width="300"
visible="false" />
<line_editor
visible="false"
bevel_style="in"
border_style="line"
border_thickness="1"
bottom_delta="20"
follows="left|top|right"
font="SansSerifSmall"
height="16"
left="20"
max_length="255"
name="input_domain"
right="-120"
select_all_on_focus_received="true"
select_on_focus="true"/>
<button
visible="false"
bottom_delta="0"
enabled="true"
follows="bottom"
font="SansSerifSmall"
halign="center"
height="16"
label="Add"
label_selected="Add"
left_delta="326"
mouse_opaque="true"
name="commit_domain"
scale_image="true"
width="80" />
</floater>

View File

@ -323,6 +323,18 @@
label="Enable media filter (increased security)"
left="25"
width="230"/>
<button
layout="topleft"
follows="top|left"
height="23"
label="Edit lists..."
left_pad="5"
name="edit_media_lists_button"
width="100">
<button.commit_callback
function="Floater.Show"
parameter="media_lists" />
</button>
<text
type="string"