diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e99c0850cbb11b1c26b8ee53863c49cc63eae0ba..e11af8ae6c619958c0beb5403c6ce348474c7938 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -308,6 +308,7 @@ set(viewer_SOURCE_FILES llfloatergridstatus.cpp llfloatergroupbulkban.cpp llfloatergroupinvite.cpp + llfloatergroupprofile.cpp llfloatergroups.cpp llfloaterhandler.cpp llfloaterhelpbrowser.cpp @@ -1020,6 +1021,7 @@ set(viewer_HEADER_FILES llfloatergridstatus.h llfloatergroupbulkban.h llfloatergroupinvite.h + llfloatergroupprofile.h llfloatergroups.h llfloaterhandler.h llfloaterhelpbrowser.h diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index adfd318f0868b42f82d571748a27e6e739045a65..73e0e089af83ce6f0eab546526b7aa8b23ee410f 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -1270,6 +1270,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>ShowGroupFloaters</key> + <map> + <key>Comment</key> + <string>Show group profiles in floaters rather than the sidebar</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <boolean>1</boolean> + </map> <key>ShowPropertiesFloaters</key> <map> <key>Comment</key> diff --git a/indra/newview/llfloatergroupprofile.cpp b/indra/newview/llfloatergroupprofile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..09462ff197980963f96054e6a8b4d2a1823ad1bb --- /dev/null +++ b/indra/newview/llfloatergroupprofile.cpp @@ -0,0 +1,113 @@ +/* +* @file llfloatergroupprofile.h +* @brief Floater that holds panel +* +* Copyright (c) 2017, Cinder Roxley <cinder@sdf.org> +* +* Permission is hereby granted, free of charge, to any person or organization +* obtaining a copy of the software and accompanying documentation covered by +* this license (the "Software") to use, reproduce, display, distribute, +* execute, and transmit the Software, and to prepare derivative works of the +* Software, and to permit third-parties to whom the Software is furnished to +* do so, all subject to the following: +* +* The copyright notices in the Software and this entire statement, including +* the above license grant, this restriction and the following disclaimer, +* must be included in all copies of the Software, in whole or in part, and +* all derivative works of the Software, unless such copies or derivative +* works are solely in the form of machine-executable object code generated by +* a source language processor. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloatergroupprofile.h" + +#include "llfloaterreg.h" +#include "lltrans.h" + +#include "llpanelgroup.h" + +LLFloaterGroupProfile::LLFloaterGroupProfile(LLSD const& key) + : LLFloater(key) +{ +} + +LLFloaterGroupProfile::~LLFloaterGroupProfile() +{ +} + +BOOL LLFloaterGroupProfile::postBuild() +{ + mGroupPanel = getChild<LLPanel>("panel_group_info_sidetray"); + mCreateGroupPanel = getChild<LLPanel>("panel_group_creation_sidetray"); + return TRUE; +} + +void LLFloaterGroupProfile::onOpen(const LLSD& key) +{ + if (key.isMap()) + { + setKey(key["group_id"].asUUID()); + } + + mCreatingGroup = (key.has("action") && key.get("action").asString() == "create"); + if (mCreatingGroup) + { + mCreateGroupPanel->onOpen(key); + mCreateGroupPanel->setVisible(true); + mGroupPanel->setVisible(false); + setTitle(getString("title_create_group")); + } + else + { + mGroupPanel->onOpen(key); + mGroupPanel->setVisible(true); + mCreateGroupPanel->setVisible(false); + } +} + +void LLFloaterGroupProfile::setGroupName(const std::string& group_name) +{ + if (mCreatingGroup) + { + setTitle(getString("title_create_group")); + } + else + { + setTitle(group_name.empty() ? LLTrans::getString("LoadingData") : group_name); + } +} + +void LLFloaterGroupProfile::createGroup() const +{ + LLSD params; + params["group_id"] = LLUUID::null; + params["action"] = "create"; + getChild<LLPanel>("panel_group_info_sidetray")->onOpen(params); +} + +//static +LLFloater* LLFloaterGroupProfile::showInstance(const LLSD& key, BOOL focus) +{ + // [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Modified: RLVa-1.2.0a + if (!LLFloaterReg::canShowInstance("group_profile", key["group_id"].asUUID())) + // [/RLVa:KB] + return nullptr;// + LLFloater* instance = LLFloaterReg::getInstance("group_profile", key["group_id"].asUUID()); + if (instance) + { + instance->openFloater(key); + if (focus) + instance->setFocus(TRUE); + } + return instance; +} \ No newline at end of file diff --git a/indra/newview/llfloatergroupprofile.h b/indra/newview/llfloatergroupprofile.h new file mode 100644 index 0000000000000000000000000000000000000000..0cf00fd406bdfa120b544405bd634fb6e20ed902 --- /dev/null +++ b/indra/newview/llfloatergroupprofile.h @@ -0,0 +1,62 @@ +/* +* @file llfloatergroupprofile.h +* @brief Floater that holds panel +* +* Copyright (c) 2017, Cinder Roxley <cinder@sdf.org> +* +* Permission is hereby granted, free of charge, to any person or organization +* obtaining a copy of the software and accompanying documentation covered by +* this license (the "Software") to use, reproduce, display, distribute, +* execute, and transmit the Software, and to prepare derivative works of the +* Software, and to permit third-parties to whom the Software is furnished to +* do so, all subject to the following: +* +* The copyright notices in the Software and this entire statement, including +* the above license grant, this restriction and the following disclaimer, +* must be included in all copies of the Software, in whole or in part, and +* all derivative works of the Software, unless such copies or derivative +* works are solely in the form of machine-executable object code generated by +* a source language processor. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef LL_FLOATERGROUPPROFILE_H +#define LL_FLOATERGROUPPROFILE_H + +#include "llfloater.h" +#include "llgroupmgr.h" + +class LLPanelGroup; + +class LLFloaterGroupProfile final : public LLFloater +{ +public: + LLFloaterGroupProfile(LLSD const& key); + BOOL postBuild() override; + void onOpen(const LLSD& key) override; + + void setGroupName(const std::string& group_name); + void createGroup() const; + + static LLFloater* showInstance(const LLSD& key, BOOL focus); + + LLPanelGroup* getGroupPanel() const { return (LLPanelGroup*)mGroupPanel; }; + +private: + ~LLFloaterGroupProfile(); + + LLPanel* mGroupPanel = nullptr; + LLPanel* mCreateGroupPanel = nullptr; + + bool mCreatingGroup = false; +}; + +#endif // LL_FLOATERGROUPPROFILE_H diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index ae5c5e9b550e13d56fc33be60f1744bdd38fdb15..bc3da61c8fa4e395d64bc39c23bd5425692224bb 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -36,6 +36,7 @@ #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llgroupmgr.h" +#include "llfloatergroupprofile.h" #include "llfloaterimcontainer.h" #include "llimview.h" // for gIMMgr #include "llnotificationsutil.h" @@ -409,16 +410,23 @@ void LLGroupActions::show(const LLUUID& group_id) LLSD params; params["group_id"] = group_id; - params["open_tab_name"] = "panel_group_info_sidetray"; - - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); - LLFloater *floater = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("people"); - if (!floater->isFrontmost()) - { - floater->setVisibleAndFrontmost(TRUE, params); - } + + if (gSavedSettings.getBool("ShowGroupFloaters")) + { + LLFloaterGroupProfile::showInstance(params, TRUE); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + LLFloater *floater = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("people"); + if (!floater->isFrontmost()) + { + floater->setVisibleAndFrontmost(TRUE, params); + } + } } + // [SL:KB] - Patch: Notification-GroupCreateNotice | Checked: 2012-02-16 (Catznip-3.2) // static void LLGroupActions::showNotices(const LLUUID& group_id) @@ -430,9 +438,14 @@ void LLGroupActions::showNotices(const LLUUID& group_id) sdParams["group_id"] = group_id; sdParams["action"] = "view_notices"; - sdParams["open_tab_name"] = "panel_group_info_sidetray"; - - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", sdParams); + if (gSavedSettings.getBool("ShowGroupFloaters")) + { + LLFloaterGroupProfile::showInstance(sdParams, TRUE); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", sdParams); + } } // static @@ -442,31 +455,49 @@ void LLGroupActions::viewChatHistory(const LLUUID& group_id) } // [/SL:KB] -void LLGroupActions::refresh_notices() +void LLGroupActions::refresh_notices(const LLUUID& group_id) { - if(!isGroupUIVisible()) - return; - LLSD params; - params["group_id"] = LLUUID::null; - params["open_tab_name"] = "panel_group_info_sidetray"; + params["group_id"] = group_id; params["action"] = "refresh_notices"; - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + if (gSavedSettings.getBool("ShowGroupFloaters")) + { + if (LLFloaterReg::instanceVisible("group_profile", LLSD(group_id))) + { + LLFloaterGroupProfile::showInstance(params, FALSE); + } + } + else + { + if (isGroupUIVisible()) + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + } + } } //static void LLGroupActions::refresh(const LLUUID& group_id) { - if(!isGroupUIVisible()) - return; - LLSD params; params["group_id"] = group_id; - params["open_tab_name"] = "panel_group_info_sidetray"; params["action"] = "refresh"; - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + if (gSavedSettings.getBool("ShowGroupFloaters")) + { + if (LLFloaterReg::instanceVisible("group_profile", LLSD(group_id))) + { + LLFloaterGroupProfile::showInstance(params, TRUE); + } + } + else + { + if (isGroupUIVisible()) + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + } + } } //static @@ -474,24 +505,29 @@ void LLGroupActions::createGroup() { LLSD params; params["group_id"] = LLUUID::null; - params["open_tab_name"] = "panel_group_creation_sidetray"; params["action"] = "create"; - LLFloaterSidePanelContainer::showPanel("people", "panel_group_creation_sidetray", params); - + if (gSavedSettings.getBool("ShowGroupFloaters")) + { + LLFloaterGroupProfile::showInstance(params, TRUE); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_creation_sidetray", params); + } } //static void LLGroupActions::closeGroup(const LLUUID& group_id) { - if(!isGroupUIVisible()) - return; - - LLSD params; - params["group_id"] = group_id; - params["open_tab_name"] = "panel_group_info_sidetray"; - params["action"] = "close"; + LLFloaterReg::hideInstance("group_profile", LLSD(group_id)); - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + if (isGroupUIVisible()) + { + LLSD params; + params["group_id"] = group_id; + params["action"] = "close"; + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + } } diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index 8147f86650e5b134489303cff58fed3ceb7448ec..3f4db6364a0ac99d5d4346e4b837e9d0612c3317 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -84,7 +84,7 @@ class LLGroupActions /** * Refresh group notices panel. */ - static void refresh_notices(); + static void refresh_notices(const LLUUID& group_id); /** * Refresh group information panel. diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index f87ebf219b616aed672bf11d694cb3303d8eac51..7a3bd8337a2252627f2e38b6e40283b79fef0d98 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -88,7 +88,7 @@ bool LLGroupHandler::processNotification(const LLNotificationPtr& notification, if(channel) channel->addToast(p); - LLGroupActions::refresh_notices(); + LLGroupActions::refresh_notices(notification->getPayload()["group_id"].asUUID()); return false; } diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 392276312dfcfa0f8f2c96e18e4a257c0f50ba21..c31386d21990d4bf8d5dc7a4a3cd3bec5dda89b9 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -42,6 +42,7 @@ #include "llfloaterreg.h" #include "llfloater.h" #include "llgroupactions.h" +#include "llfloatergroupprofile.h" #include "llagent.h" @@ -237,10 +238,18 @@ void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent ) void LLPanelGroup::onBackBtnClick() { - LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); - if(parent) + LLFloaterGroupProfile* parent = dynamic_cast<LLFloaterGroupProfile*>(getParent()); + if (parent) { - parent->openPreviousPanel(); + parent->closeHostedFloater(); + } + else + { + LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); + if (parent) + { + parent->openPreviousPanel(); + } } } @@ -303,10 +312,22 @@ void LLPanelGroup::update(LLGroupChange gc) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID); if(gdatap) { - std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + + { + LLFloaterGroupProfile* parent = dynamic_cast<LLFloaterGroupProfile*>(getParent()); + if (parent) + { + parent->setGroupName(gdatap->mName); + } + } + + { + std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; + LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); + group_name_ctrl->setValue(group_name); + group_name_ctrl->setToolTip(group_name); + } + LLGroupData agent_gdatap; bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery(); @@ -537,7 +558,7 @@ void LLPanelGroup::draw() for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) enable = enable || (*it)->needsApply(mesg); - childSetEnabled("btn_apply", enable); + button_apply->setEnabled(enable); } } @@ -598,7 +619,16 @@ void LLPanelGroup::showNotice(const std::string& subject, const std::string& inventory_name, LLOfferInfo* inventory_offer) { - LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray"); + LLPanelGroup* panel(NULL); + if (auto* floater = LLFloaterReg::findTypedInstance<LLFloaterGroupProfile>("group_profile", LLSD(group_id))) + { + panel = floater->getGroupPanel(); + } + else + { + panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray"); + } + if(!panel) return; diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index 2a262fc6efb52819dfc467db4cf0978812d609df..164460388c57362bc3bd40c54292316431e94e30 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -46,11 +46,13 @@ #include "llagentbenefits.h" #include "llfloaterreg.h" #include "llfloater.h" +#include "llfloatergroupprofile.h" #include "llgroupmgr.h" #include "llstatusbar.h" // to re-request balance #include "lltrans.h" #include "llnotificationsutil.h" #include "lluicolortable.h" +#include "llviewercontrol.h" const S32 MATURE_CONTENT = 1; @@ -116,10 +118,23 @@ void LLPanelGroupCreate::onOpen(const LLSD& key) //static void LLPanelGroupCreate::refreshCreatedGroup(const LLUUID& group_id) { - LLSD params; - params["group_id"] = group_id; - params["open_tab_name"] = "panel_group_info_sidetray"; - LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + LLSD params; + params["group_id"] = group_id; + + auto* floater = LLFloaterReg::findTypedInstance<LLFloaterGroupProfile>("group_profile", LLSD(LLUUID::null)); + if (floater) + { + floater->openFloater(params); + floater->setFocus(TRUE); + } + else if(gSavedSettings.getBool("ShowGroupFloaters")) + { + LLFloaterGroupProfile::showInstance(params, TRUE); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + } LLStatusBar::sendMoneyBalanceRequest(); } @@ -159,10 +174,18 @@ void LLPanelGroupCreate::addMembershipRow(const std::string &name) void LLPanelGroupCreate::onBackBtnClick() { - LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); + LLFloaterGroupProfile* parent = dynamic_cast<LLFloaterGroupProfile*>(getParent()); if(parent) { - parent->openPreviousPanel(); + parent->closeHostedFloater(); + } + else + { + LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); + if(parent) + { + parent->openPreviousPanel(); + } } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 6cc3f7e73c0bc467e1ba8566bbfecf4917fc33a5..39dbe7e24ffca63b38251850fa5c306853bc0f43 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -90,6 +90,7 @@ #include "llfloatergesture.h" #include "llfloatergodtools.h" #include "llfloatergridstatus.h" +#include "llfloatergroupprofile.h" #include "llfloatergroups.h" #include "llfloaterhelpbrowser.h" #include "llfloaterhexeditor.h" @@ -442,6 +443,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("asset_hex_editor", "floater_hex_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHexEditor>); LLFloaterReg::add("delete_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteQueue>); LLFloaterReg::add("generic_text", "floater_generic_text.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGenericText>); + LLFloaterReg::add("group_profile", "floater_group_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupProfile>); LLFloaterReg::add("legacy_profile", "floater_profile_legacy.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<LLFloaterProfileLegacy>); LLFloaterReg::add("legacy_notification_well_window", "floater_legacy_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLLegacyNotificationWellWindow>); LLFloaterReg::add("lightbox", "floater_lightbox_settings.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<ALFloaterLightBox>); diff --git a/indra/newview/skins/default/xui/en/floater_group_profile.xml b/indra/newview/skins/default/xui/en/floater_group_profile.xml new file mode 100644 index 0000000000000000000000000000000000000000..d7a874afc9132356d74c483997624eade9f3a304 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_group_profile.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + positioning="cascading" + can_close="true" + can_resize="true" + height="580" + min_height="350" + min_width="260" + layout="topleft" + name="floater_group_profile" + save_rect="true" + title="GROUP" + width="370"> + <floater.string name="title_create_group"> + CREATE NEW GROUP... + </floater.string> + <panel + class="panel_group_info_sidetray" + name="panel_group_info_sidetray" + filename="panel_group_info_sidetray.xml" + visible="true" + background_visible="false" + follows="all" + layout="topleft" + left="0" + top="0" + width="373" + height="577"/> + <panel + class="panel_group_creation_sidetray" + name="panel_group_creation_sidetray" + filename="panel_group_creation_sidetray.xml" + visible="false" + background_visible="false" + follows="all" + layout="topleft" + top="0" + width="369"/> +</floater>