From 9f4779e09997e70246c3c0c5f831bf55d4ed6a4f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 6 Jun 2011 23:46:35 +0300 Subject: STORM-1255 WIP Made the check for region permissions reusable. --- indra/newview/llenvmanager.cpp | 11 +++++++++++ indra/newview/llenvmanager.h | 2 ++ indra/newview/llfloatereditdaycycle.cpp | 15 ++------------- indra/newview/llfloatereditdaycycle.h | 1 - 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 8e4b7197d6..58d1349a63 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -923,6 +923,17 @@ boost::signals2::connection LLEnvManagerNew::setRegionSettingsAppliedCallback(co return mRegionSettingsAppliedSignal.connect(cb); } +// static +bool LLEnvManagerNew::canEditRegionSettings() +{ + LLViewerRegion* region = gAgent.getRegion(); + BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); + BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); + + LL_DEBUGS("Windlight") << "Can edit region settings: " << (bool) owner_or_god_or_manager << LL_ENDL; + return owner_or_god_or_manager; +} + void LLEnvManagerNew::onRegionCrossing() { LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL; diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 7d4e647e90..de82787a08 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -328,6 +328,8 @@ public: boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); + static bool canEditRegionSettings(); /// @return true if we have access to editing region environment + // Public callbacks. void onRegionCrossing(); void onTeleport(); diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 28ff353369..f6bd4ad6b9 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -660,7 +660,7 @@ void LLFloaterEditDayCycle::onRegionInfoUpdate() if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION) { // check whether we have the access - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } enableEditing(can_edit); @@ -697,7 +697,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() return; } - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } // We may need to add or remove region skies from the list. @@ -799,14 +799,3 @@ std::string LLFloaterEditDayCycle::getRegionName() { return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); } - -// static -bool LLFloaterEditDayCycle::canEditRegionSettings() -{ - LLViewerRegion* region = gAgent.getRegion(); - BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); - BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - - LL_DEBUGS("Windlight") << "Can edit region settings: " << owner_or_god_or_manager << LL_ENDL; - return owner_or_god_or_manager; -} diff --git a/indra/newview/llfloatereditdaycycle.h b/indra/newview/llfloatereditdaycycle.h index 3b467b2939..6dc7333039 100644 --- a/indra/newview/llfloatereditdaycycle.h +++ b/indra/newview/llfloatereditdaycycle.h @@ -106,7 +106,6 @@ private: void onDayCycleListChange(); static std::string getRegionName(); - static bool canEditRegionSettings(); /// convenience class for holding keyframes mapped to sliders struct SliderKey -- cgit v1.2.3