Skip to content
Snippets Groups Projects
Commit 56af0588 authored by ¡Cinder! ㊝'s avatar ¡Cinder! ㊝ :speech_balloon:
Browse files

Better event floater

parent 8cc37990
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
* @brief Display for events in the finder * @brief Display for events in the finder
* *
* $LicenseInfo:firstyear=2004&license=viewerlgpl$ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code * Alchemy Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2014, Cinder Roxley @ Second Life
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -27,92 +28,20 @@ ...@@ -27,92 +28,20 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llfloaterevent.h" #include "llfloaterevent.h"
#include "llpaneleventinfo.h"
#include "message.h"
#include "llnotificationsutil.h"
#include "llui.h"
#include "llagent.h"
#include "llviewerwindow.h"
#include "llbutton.h"
#include "llcachename.h"
#include "llcommandhandler.h" // secondlife:///app/chat/ support
#include "lleventflags.h"
#include "llmediactrl.h"
#include "llexpandabletextbox.h"
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llmediactrl.h"
#include "llfloaterworldmap.h"
#include "llinventorymodel.h"
#include "llslurl.h"
#include "lltextbox.h"
#include "lltexteditor.h"
#include "lluiconstants.h"
#include "llviewercontrol.h"
#include "llweb.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
#include "lluictrlfactory.h"
#include "lltrans.h"
LLFloaterEvent::LLFloaterEvent(const LLSD& key) LLFloaterEvent::LLFloaterEvent(const LLSD& key)
: LLFloater(key), : LLFloater(key)
LLViewerMediaObserver(), , mEventId(0)
mBrowser(NULL),
mEventID(0)
{
}
LLFloaterEvent::~LLFloaterEvent()
{ {
}
BOOL LLFloaterEvent::postBuild()
{
mBrowser = getChild<LLMediaCtrl>("browser");
if (mBrowser)
{
mBrowser->addObserver(this);
}
return TRUE;
}
void LLFloaterEvent::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event)
{
switch (event)
{
case MEDIA_EVENT_NAVIGATE_BEGIN:
getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
break;
case MEDIA_EVENT_NAVIGATE_COMPLETE:
getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
break;
default:
break;
}
} }
void LLFloaterEvent::setEventID(const U32 event_id) void LLFloaterEvent::setEventID(const U32 event_id)
{ {
mEventID = event_id; mEventId = event_id;
if (event_id == 0) closeFloater();
if (event_id != 0)
{ getChild<LLPanel>("event_panel")->onOpen(mEventId);
LLSD subs;
subs["EVENT_ID"] = (S32)event_id;
// get the search URL and expand all of the substitutions
// (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
std::ostringstream url;
url << gSavedSettings.getString("EventURL") << event_id << std::endl;
// and load the URL in the web view
mBrowser->navigateTo(url.str());
}
} }
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
* @brief Display for events in the finder * @brief Display for events in the finder
* *
* $LicenseInfo:firstyear=2004&license=viewerlgpl$ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code * Alchemy Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* Copyright (C) 2014, Cinder Roxley @ Second Life
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -28,35 +29,17 @@ ...@@ -28,35 +29,17 @@
#define LL_LLFLOATEREVENT_H #define LL_LLFLOATEREVENT_H
#include "llfloater.h" #include "llfloater.h"
#include "llviewermediaobserver.h"
class LLFloaterEvent final : public LLFloater
class LLMediaCtrl;
class LLButton;
class LLFloaterEvent final : public LLFloater,
public LLViewerMediaObserver
{ {
public: public:
LLFloaterEvent(const LLSD& key); LLFloaterEvent(const LLSD& key);
/*virtual*/ ~LLFloaterEvent(); /*virtual*/ ~LLFloaterEvent() = default;
/*virtual*/ BOOL postBuild();
void setEventID(const U32 event_id); void setEventID(const U32 event_id);
U32 getEventID() { return mEventID; }
protected:
/*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
U32 mEventID; private:
S32 mEventId;
LLMediaCtrl* mBrowser;
}; };
#endif // LL_LLFLOATEREVENT_H #endif // LL_LLFLOATEREVENT_H
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater <floater
height="400" height="590"
can_resize="true" can_resize="true"
help_topic="event_details" help_topic="event_details"
label="Event" label="Event"
layout="topleft" layout="topleft"
name="Event" name="Event"
save_rect="true"
save_visibility="false" save_visibility="false"
title="EVENT DETAILS" title="EVENT DETAILS"
width="600"> max_width="320"
<floater.string width="313">
name="loading_text"> <panel
Loading... follows="all"
</floater.string> name="event_panel"
<floater.string top="0"
name="done_text"> bottom="590"
Done left="0"
</floater.string> right="313"
<web_browser class="panel_event_info"
trusted_content="true" filename="panel_event_info.xml" />
follows="left|right|top|bottom"
layout="topleft"
left="10"
name="browser"
height="365"
width="580"
top="0"/>
<text
follows="bottom|left"
height="16"
layout="topleft"
left_delta="0"
name="status_text"
top_pad="10"
width="150" />
</floater> </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