Stream list xml import/export added by request

Cinders 2013-03-15 11:48:47 -06:00
parent b2a14f6ed0
commit 9029331cc3
4 changed files with 90 additions and 1 deletions

View File

@ -246,6 +246,7 @@ void LLPanelLandAudio::onBtnStreamAdd(LLUICtrl*, void *userdata)
if (!music_url.empty())
{
LLSD streamlist = gSavedSettings.getLLSD("FSStreamList");
streamlist["version"] = 1;
streamlist["audio"].append(music_url);
gSavedSettings.setLLSD("FSStreamList", streamlist);
self->refresh();

View File

@ -131,14 +131,16 @@
#include "fslslbridge.h"
#include "fscommon.h"
#include "fscontactsfloater.h" // <FS:Zi> Display group list in contacts floater
#include "fspose.h" // <FS:CR> FIRE-4345: Undeform
#include "fswsassetblacklist.h"
#include "llavatarpropertiesprocessor.h" // ## Zi: Texture Refresh
#include "llsdserialize.h"
#include "lltexturecache.h" // ## Zi: Texture Refresh
#include "lllogininstance.h" // <FS:AW opensim destinations and avatar picker>
#include "llvovolume.h"
#include "particleeditor.h"
#include "piemenu.h" // ## Zi: Pie Menu
#include "fspose.h" // <FS:CR> FIRE-4345: Undeform
using namespace LLAvatarAppearanceDefines;
@ -8678,6 +8680,57 @@ class FSToolsUndeform : public view_listener_t
};
// </FS:CR> FIRE-4345: Undeform
// <FS:CR> Stream list import/export
class FSStreamListExportXML :public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getSaveFile(LLFilePicker::FFSAVE_XML, LLDir::getScrubbedFileName("stream_list.xml")))
{
std::string filename = file_picker.getFirstFile();
llofstream export_file(filename);
LLSDSerialize::toPrettyXML(gSavedSettings.getLLSD("FSStreamList"), export_file);
export_file.close();
LLSD args;
args["FILENAME"] = filename;
LLNotificationsUtil::add("StreamListExportSuccess", args);
}
else
llinfos << "User closed the filepicker. Aborting!" << llendl;
return true;
}
};
class FSStreamListImportXML :public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getOpenFile(LLFilePicker::FFLOAD_XML))
{
std::string filename = file_picker.getFirstFile();
llifstream stream_list(filename);
if(!stream_list.is_open())
{
llwarns << "Couldn't open the xml file for reading. Aborting import!" << llendl;
return true;
}
LLSD stream_data;
if(LLSDSerialize::fromXML(stream_data, stream_list) >= 1)
{
gSavedSettings.setLLSD("FSStreamList", stream_data);
LLNotificationsUtil::add("StreamListImportSuccess");
}
stream_list.close();
}
return true;
}
};
// </FS:CR> Stream list import/export
class LLToolsSelectOnlyMyObjects : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -10354,4 +10407,8 @@ void initialize_menus()
// <FS:Ansariel> Script debug floater
commit.add("ShowScriptDebug", boost::bind(&LLFloaterScriptDebug::show, LLUUID::null));
// <FS:CR> Stream list import/export
view_listener_t::addMenu(new FSStreamListExportXML(), "Streamlist.xml_export");
view_listener_t::addMenu(new FSStreamListImportXML(), "Streamlist.xml_import");
}

View File

@ -2495,6 +2495,23 @@
name="RLVa Embedded"
tear_off="true"
visible="true" />
<menu
label="Media Streams Backup"
name="media_stream_import_export"
tear_off="true">
<menu_item_call
label="Import Stream List XML..."
name="media_stream_import">
<menu_item_call.on_click
function="Streamlist.xml_import" />
</menu_item_call>
<menu_item_call
label="Export Stream List XML..."
name="media_stream_export">
<menu_item_call.on_click
function="Streamlist.xml_export" />
</menu_item_call>
</menu>
<menu_item_check
label="Use Plugin Read Thread"
name="Use Plugin Read Thread">

View File

@ -11085,6 +11085,20 @@ Error in the regular expression:
Successfully saved appearance to XML.
</notification>
<notification
icon="notify.tga"
name="StreamListExportSuccess"
type="notify">
Successfully exported stream list to XML to [FILENAME].
</notification>
<notification
icon="notify.tga"
name="StreamListImportSuccess"
type="notify">
Successfully imported stream list from XML.
</notification>
<!-- <FS:Zi> Backup Settings -->
<notification
icon="alertmodal.tga"