diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterevent.cpp | 331 | ||||
-rw-r--r-- | indra/newview/llfloaterevent.h | 94 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_event.xml | 230 |
6 files changed, 662 insertions, 4 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index cd7c002096..b74530e49a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -161,6 +161,7 @@ set(viewer_SOURCE_FILES llfloatercustomize.cpp llfloaterdaycycle.cpp llfloaterenvsettings.cpp + llfloaterevent.cpp llfloaterfonttest.cpp llfloatergesture.cpp llfloatergodtools.cpp @@ -300,7 +301,6 @@ set(viewer_SOURCE_FILES llpanelclassified.cpp llpanelcontents.cpp llpaneleditwearable.cpp - llpanelevent.cpp llpanelface.cpp llpanelgroup.cpp llpanelgroupgeneral.cpp @@ -661,6 +661,7 @@ set(viewer_HEADER_FILES llfloatercustomize.h llfloaterdaycycle.h llfloaterenvsettings.h + llfloaterevent.h llfloaterfonttest.h llfloatergesture.h llfloatergodtools.h @@ -795,7 +796,6 @@ set(viewer_HEADER_FILES llpanelclassified.h llpanelcontents.h llpaneleditwearable.h - llpanelevent.h llpanelface.h llpanelgroup.h llpanelgroupgeneral.h diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp new file mode 100644 index 0000000000..91c2810026 --- /dev/null +++ b/indra/newview/llfloaterevent.cpp @@ -0,0 +1,331 @@ +/** + * @file llfloaterevent.cpp + * @brief Display for events in the finder + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-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 "llfloaterevent.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 "lleventnotifier.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llinventorymodel.h" +#include "llsecondlifeurls.h" +#include "lltextbox.h" +#include "lltexteditor.h" +#include "lluiconstants.h" +#include "llviewercontrol.h" +#include "llweb.h" +#include "llworldmap.h" +#include "lluictrlfactory.h" +#include "lltrans.h" + + +class LLEventHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { } + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() < 1) + { + return false; + } + + LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event"); + if (floater) + { + floater->setEventID(params[0].asInteger()); + LLFloaterReg::showTypedInstance<LLFloaterEvent>("event"); + return true; + } + + return false; + } +}; +LLEventHandler gEventHandler; + +LLFloaterEvent::LLFloaterEvent(const LLSD& key) + : LLFloater(key), + + mEventID(0) +{ +} + + +LLFloaterEvent::~LLFloaterEvent() +{ +} + + +BOOL LLFloaterEvent::postBuild() +{ + mTBName = getChild<LLTextBox>("event_name"); + + mTBCategory = getChild<LLTextBox>("event_category"); + + mTBDate = getChild<LLTextBox>("event_date"); + + mTBDuration = getChild<LLTextBox>("event_duration"); + + mTBDesc = getChild<LLTextEditor>("event_desc"); + mTBDesc->setEnabled(FALSE); + + mTBRunBy = getChild<LLTextBox>("event_runby"); + mTBLocation = getChild<LLTextBox>("event_location"); + mTBCover = getChild<LLTextBox>("event_cover"); + + mTeleportBtn = getChild<LLButton>( "teleport_btn"); + mTeleportBtn->setClickedCallback(onClickTeleport, this); + + mMapBtn = getChild<LLButton>( "map_btn"); + mMapBtn->setClickedCallback(onClickMap, this); + + mNotifyBtn = getChild<LLButton>( "notify_btn"); + mNotifyBtn->setClickedCallback(onClickNotify, this); + + mCreateEventBtn = getChild<LLButton>( "create_event_btn"); + mCreateEventBtn->setClickedCallback(onClickCreateEvent, this); + + return TRUE; +} + +void LLFloaterEvent::setEventID(const U32 event_id) +{ + mEventID = event_id; + // Should reset all of the panel state here + resetInfo(); + + if (event_id != 0) + { + sendEventInfoRequest(); + } +} + + +void LLFloaterEvent::sendEventInfoRequest() +{ + LLMessageSystem *msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_EventInfoRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); + msg->nextBlockFast(_PREHASH_EventData); + msg->addU32Fast(_PREHASH_EventID, mEventID); + gAgent.sendReliableMessage(); +} + + +//static +void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **) +{ + // extract the agent id + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); + + LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event"); + + if(floater) + { + floater->mEventInfo.unpack(msg); + floater->mTBName->setText(floater->mEventInfo.mName); + floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr); + floater->mTBDate->setText(floater->mEventInfo.mTimeStr); + floater->mTBDesc->setText(floater->mEventInfo.mDesc); + + floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60)); + + if (!floater->mEventInfo.mHasCover) + { + floater->mTBCover->setText(floater->getString("none")); + } + else + { + floater->mTBCover->setText(llformat("%d", floater->mEventInfo.mCover)); + } + + F32 global_x = (F32)floater->mEventInfo.mPosGlobal.mdV[VX]; + F32 global_y = (F32)floater->mEventInfo.mPosGlobal.mdV[VY]; + + S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; + S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; + S32 region_z = llround((F32)floater->mEventInfo.mPosGlobal.mdV[VZ]); + + std::string desc = floater->mEventInfo.mSimName + llformat(" (%d, %d, %d)", region_x, region_y, region_z); + floater->mTBLocation->setText(desc); + + if (floater->mEventInfo.mEventFlags & EVENT_FLAG_MATURE) + { + floater->childSetVisible("event_mature_yes", TRUE); + floater->childSetVisible("event_mature_no", FALSE); + } + else + { + floater->childSetVisible("event_mature_yes", FALSE); + floater->childSetVisible("event_mature_no", TRUE); + } + + if (floater->mEventInfo.mUnixTime < time_corrected()) + { + floater->mNotifyBtn->setEnabled(FALSE); + } + else + { + floater->mNotifyBtn->setEnabled(TRUE); + } + + if (gEventNotifier.hasNotification(floater->mEventInfo.mID)) + { + floater->mNotifyBtn->setLabel(floater->getString("dont_notify")); + } + else + { + floater->mNotifyBtn->setLabel(floater->getString("notify")); + } + } +} + + +void LLFloaterEvent::draw() +{ + std::string name; + gCacheName->getFullName(mEventInfo.mRunByID, name); + + mTBRunBy->setText(name); + + LLPanel::draw(); +} + +void LLFloaterEvent::resetInfo() +{ + // Clear all of the text fields. +} + +// static +void LLFloaterEvent::onClickTeleport(void* data) +{ + LLFloaterEvent* self = (LLFloaterEvent*)data; + LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); + if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance) + { + gAgent.teleportViaLocation(self->mEventInfo.mPosGlobal); + worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal); + } +} + + +// static +void LLFloaterEvent::onClickMap(void* data) +{ + LLFloaterEvent* self = (LLFloaterEvent*)data; + LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); + + if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance) + { + worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal); + LLFloaterReg::showInstance("world_map", "center"); + } +} + + +// static +/* +void LLPanelEvent::onClickLandmark(void* data) +{ + LLPanelEvent* self = (LLPanelEvent*)data; + //create_landmark(self->mTBName->getText(), "", self->mEventInfo.mPosGlobal); + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("CreateLandmarkForEvent"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_EventData); + msg->addU32Fast(_PREHASH_EventID, self->mEventID); + msg->nextBlockFast(_PREHASH_InventoryBlock); + LLUUID folder_id; + folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); + msg->addUUIDFast(_PREHASH_FolderID, folder_id); + msg->addStringFast(_PREHASH_Name, self->mTBName->getText()); + gAgent.sendReliableMessage(); +} +*/ + +// static +void LLFloaterEvent::onClickCreateEvent(void* data) +{ + LLNotificationsUtil::add("PromptGoToEventsPage");//, LLSD(), LLSD(), callbackCreateEventWebPage); +} + +// static +void LLFloaterEvent::onClickNotify(void *data) +{ + LLFloaterEvent* self = (LLFloaterEvent*)data; + + if (!gEventNotifier.hasNotification(self->mEventID)) + { + gEventNotifier.add(self->mEventInfo); + self->mNotifyBtn->setLabel(self->getString("dont_notify")); + } + else + { + gEventNotifier.remove(self->mEventInfo.mID); + self->mNotifyBtn->setLabel(self->getString("notify")); + } +} +/* +// static +bool LLPanelEvent::callbackCreateEventWebPage(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + llinfos << "Loading events page " << LLNotifications::instance().getGlobalString("EVENTS_URL") << llendl; + + LLWeb::loadURL( LLNotifications::instance().getGlobalString("EVENTS_URL")); + } + return false; +} +*/ + diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h new file mode 100644 index 0000000000..c93e3f73ca --- /dev/null +++ b/indra/newview/llfloaterevent.h @@ -0,0 +1,94 @@ +/** + * @file llfloaterevent.h + * @brief Display for events in the finder + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-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_LLFLOATEREVENT_H +#define LL_LLFLOATEREVENT_H + +#include "llfloater.h" + +#include "lleventinfo.h" +#include "lluuid.h" +#include "v3dmath.h" + +class LLTextBox; +class LLTextEditor; +class LLButton; +class LLMessageSystem; + +class LLFloaterEvent : public LLFloater +{ +public: + LLFloaterEvent(const LLSD& key); + /*virtual*/ ~LLFloaterEvent(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + + void setEventID(const U32 event_id); + void sendEventInfoRequest(); + + static void processEventInfoReply(LLMessageSystem *msg, void **); + + U32 getEventID() { return mEventID; } + +protected: + void resetInfo(); + + static void onClickTeleport(void*); + static void onClickMap(void*); + //static void onClickLandmark(void*); + static void onClickCreateEvent(void*); + static void onClickNotify(void*); + +// static bool callbackCreateEventWebPage(const LLSD& notification, const LLSD& response); + +protected: + U32 mEventID; + LLEventInfo mEventInfo; + + LLTextBox* mTBName; + LLTextBox* mTBCategory; + LLTextBox* mTBDate; + LLTextBox* mTBDuration; + LLTextEditor* mTBDesc; + + LLTextBox* mTBRunBy; + LLTextBox* mTBLocation; + LLTextBox* mTBCover; + + LLButton* mTeleportBtn; + LLButton* mMapBtn; + LLButton* mCreateEventBtn; + LLButton* mNotifyBtn; +}; + +#endif // LL_LLFLOATEREVENT_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d1b91df6e9..63f5883a70 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -123,7 +123,7 @@ #include "llmutelist.h" #include "llpanelavatar.h" #include "llavatarpropertiesprocessor.h" -#include "llpanelevent.h" +#include "llfloaterevent.h" #include "llpanelclassified.h" #include "llpanelpick.h" #include "llpanelplace.h" @@ -2484,7 +2484,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply); msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply); - msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply); + msg->setHandlerFunc("EventInfoReply", LLFloaterEvent::processEventInfoReply); msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply); // msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply); msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 29114c33c5..eb070fb3ef 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -55,6 +55,7 @@ #include "llfloaterbump.h" #include "llfloatercamera.h" #include "llfloaterdaycycle.h" +#include "llfloaterevent.h" #include "llfloatersearch.h" #include "llfloaterenvsettings.h" #include "llfloaterfonttest.h" @@ -160,6 +161,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvSettings>); LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWater>); LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWindLight>); + + LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>); LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFontTest>); diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml new file mode 100644 index 0000000000..3d579f56be --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_event.xml @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + follows="all" + height="350" + label="Event" + layout="topleft" + name="Event" + width="330"> + <floater.string + name="none"> + none + </floater.string> + <floater.string + name="notify"> + Notify + </floater.string> + <floater.string + name="dont_notify"> + Don't Notify + </floater.string> + <layout_stack + name="layout" + orientation="vertical" + follows="all" + layout="topleft" + left="0" + top="0" + height="350" + width="330" + border_size="0"> + <layout_panel + name="profile_stack" + follows="all" + layout="topleft" + top="0" + left="0" + height="305" + width="330"> + <text + follows="top|left|right" + font="SansSerifLarge" + text_color="white" + height="17" + layout="topleft" + left="10" + name="event_name" + top="5" + use_ellipses="true" + width="310"> + Nameless Event...of Doom! De doom! Doom doom. + </text> + <text + type="string" + length="1" + follows="top|left" + height="13" + text_color="LtGray_50" + layout="topleft" + left="25" + name="event_category" + width="300"> + (no category) + </text> + + <text + type="string" + length="1" + follows="top|left" + layout="topleft" + left="10" + top_pad="7" + name="event_runby_label" + width="310"> + Run by: + </text> + <name_box + follows="left|top" + height="20" + initial_value="(retrieving)" + layout="topleft" + left="10" + link="true" + name="event_runby" + top_pad="2" + use_ellipses="true" + width="310" /> + <text + type="string" + length="1" + left="10" + height="17" + font="SansSerifMedium" + text_color="EmphasisColor" + top_pad="5" + follows="top|left" + layout="topleft" + name="event_date" + width="310"> + 10/10/2010 + </text> + <text + type="string" + height="14" + length="1" + left="10" + follows="top|left" + layout="topleft" + name="event_duration" + width="310"> + 1 hour + </text> + <text + font="SansSerifMedium" + text_color="EmphasisColor" + type="string" + follows="left|top" + height="16" + layout="topleft" + left="10" + name="event_cover" + visible="true" + width="310"> + Free + </text> + <text + type="string" + length="1" + follows="top|left" + layout="topleft" + left="10" + top_pad="5" + name="event_location_label"> + Location: + </text> + <text + type="string" + length="1" + height="20" + left="10" + follows="top|left" + layout="topleft" + name="event_location" + use_ellipses="true" + value="SampleParcel, Name Long (145, 228, 26)" + width="310" /> + <icon + follows="top|left" + height="16" + image_name="Parcel_PG_Dark" + layout="topleft" + left="10" + name="rating_icon" + width="18" /> + <text + follows="left|top" + height="16" + layout="topleft" + left_pad="12" + name="rating_label" + top_delta="3" + value="Rating:" + width="60" /> + <text + follows="left|right|top" + height="16" + layout="topleft" + left_pad="0" + name="rating_value" + top_delta="0" + value="unknown" + width="200" /> + <expandable_text + follows="left|top|right" + height="106" + layout="topleft" + left="6" + name="event_desc" + value="Du waltz die spritz" + width="313" /> + </layout_panel> + <layout_panel + follows="left|right" + height="24" + layout="topleft" + mouse_opaque="false" + name="button_panel" + top="0" + left="0" + user_resize="false"> + <button + follows="left|top" + height="18" + image_selected="AddItem_Press" + image_unselected="AddItem_Off" + image_disabled="AddItem_Disabled" + layout="topleft" + left="6" + name="create_event_btn" + picture_style="true" + tool_tip="Create Event" + width="18" /> + <button + follows="left|top" + height="23" + label="Notify Me" + layout="topleft" + left_pad="3" + top_delta="-1" + name="notify_btn" + width="100" /> + <button + follows="left|top" + height="23" + label="Teleport" + layout="topleft" + left_pad="5" + name="teleport_btn" + width="100" /> + <button + follows="left|top" + height="23" + label="Map" + layout="topleft" + left_pad="5" + name="map_btn" + width="85" /> + </layout_panel> + </layout_stack> + </floater> + |