summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-06 23:46:35 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-06 23:46:35 +0300
commit9f4779e09997e70246c3c0c5f831bf55d4ed6a4f (patch)
tree29301dbec6cb55f921911146730df7fb5250dc85
parent88407a0f0c19f1ee36c176f2fdc2117646d65b80 (diff)
STORM-1255 WIP Made the check for region permissions reusable.
-rw-r--r--indra/newview/llenvmanager.cpp11
-rw-r--r--indra/newview/llenvmanager.h2
-rw-r--r--indra/newview/llfloatereditdaycycle.cpp15
-rw-r--r--indra/newview/llfloatereditdaycycle.h1
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