Added simSupportsExport function
Hide E and export checked from regions without export support No longer allow PERM_EXPORT from being added to default everyone permission flags if it's not supported by the sim.
This commit is contained in:
@@ -97,6 +97,7 @@ set(viewer_SOURCE_FILES
|
||||
hippopanelgrids.cpp
|
||||
importtracker.cpp
|
||||
jcfloaterareasearch.cpp
|
||||
lfsimfeaturehandler.cpp
|
||||
lggdicdownload.cpp
|
||||
lgghunspell_wrapper.cpp
|
||||
llaccountingcostmanager.cpp
|
||||
@@ -597,6 +598,7 @@ set(viewer_HEADER_FILES
|
||||
hippopanelgrids.h
|
||||
importtracker.h
|
||||
jcfloaterareasearch.h
|
||||
lfsimfeaturehandler.h
|
||||
lggdicdownload.h
|
||||
lgghunspell_wrapper.h
|
||||
llaccountingcostmanager.h
|
||||
|
||||
66
indra/newview/lfsimfeaturehandler.cpp
Normal file
66
indra/newview/lfsimfeaturehandler.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 2013 Liru Færs
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "lfsimfeaturehandler.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
LFSimFeatureHandler::LFSimFeatureHandler()
|
||||
: mSupportsExport(false)
|
||||
{
|
||||
if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Remove this line if we ever handle SecondLife sim features
|
||||
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this));
|
||||
}
|
||||
|
||||
void LFSimFeatureHandler::handleRegionChange()
|
||||
{
|
||||
if (LLViewerRegion* region = gAgent.getRegion())
|
||||
{
|
||||
if (region->getFeaturesReceived())
|
||||
{
|
||||
setSupportedFeatures();
|
||||
}
|
||||
else
|
||||
{
|
||||
region->setFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LFSimFeatureHandler::setSupportedFeatures()
|
||||
{
|
||||
if (LLViewerRegion* region = gAgent.getRegion())
|
||||
{
|
||||
LLSD info;
|
||||
region->getSimulatorFeatures(info);
|
||||
//if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Non-SL specific sim features
|
||||
{
|
||||
mSupportsExport = info.has("ExportSupported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot)
|
||||
{
|
||||
return mSupportsExport.connect(slot);
|
||||
}
|
||||
|
||||
70
indra/newview/lfsimfeaturehandler.h
Normal file
70
indra/newview/lfsimfeaturehandler.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 2013 Liru Færs
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef LFSIMFEATUREHANDLER_H
|
||||
#define LFSIMFEATUREHANDLER_H
|
||||
|
||||
#include "llsingleton.h"
|
||||
|
||||
template<typename Type>
|
||||
class SignaledType
|
||||
{
|
||||
public:
|
||||
SignaledType(Type b) : mValue(b) {}
|
||||
|
||||
template<typename Slot>
|
||||
boost::signals2::connection connect(Slot slot) { return mSignal.connect(slot); }
|
||||
|
||||
SignaledType& operator =(Type val)
|
||||
{
|
||||
if (val != mValue)
|
||||
{
|
||||
mValue = val;
|
||||
mSignal();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
operator Type() const { return mValue; }
|
||||
|
||||
private:
|
||||
boost::signals2::signal<void()> mSignal;
|
||||
Type mValue;
|
||||
};
|
||||
|
||||
class LFSimFeatureHandler : public LLSingleton<LFSimFeatureHandler>
|
||||
{
|
||||
protected:
|
||||
friend class LLSingleton<LFSimFeatureHandler>;
|
||||
LFSimFeatureHandler();
|
||||
|
||||
public:
|
||||
void handleRegionChange();
|
||||
void setSupportedFeatures();
|
||||
|
||||
// Connection setters
|
||||
boost::signals2::connection setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot);
|
||||
|
||||
// Accessors
|
||||
bool simSupportsExport() const { return mSupportsExport; }
|
||||
|
||||
private:
|
||||
// SignaledTypes
|
||||
SignaledType<bool> mSupportsExport;
|
||||
};
|
||||
|
||||
#endif //LFSIMFEATUREHANDLER_H
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "lfsimfeaturehandler.h"
|
||||
#include "llalertdialog.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "llfloaterperms.h"
|
||||
@@ -63,8 +64,8 @@ namespace
|
||||
}
|
||||
if (!value) // If any of these are unchecked, export can no longer be checked.
|
||||
view->childSetEnabled("everyone_export", false);
|
||||
else // TODO: Implement Simulator Feature for Export.
|
||||
view->childSetEnabled("everyone_export", /*simSupportsExport() &&*/ (LLFloaterPerms::getNextOwnerPerms() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
|
||||
else
|
||||
view->childSetEnabled("everyone_export", LFSimFeatureHandler::instance().simSupportsExport() && (LLFloaterPerms::getNextOwnerPerms() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +79,7 @@ BOOL LLFloaterPerms::postBuild()
|
||||
{
|
||||
//handle_checkboxes
|
||||
{
|
||||
bool export_support = true; //simSupportsExport(); // TODO: Implement Simulator Feature for Export.
|
||||
bool export_support = LFSimFeatureHandler::instance().simSupportsExport();
|
||||
const U32 next_owner_perms = getNextOwnerPerms();
|
||||
childSetEnabled("everyone_export", export_support && (next_owner_perms & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
|
||||
if (!next_owner_perms & PERM_COPY)
|
||||
@@ -165,7 +166,7 @@ U32 LLFloaterPerms::getGroupPerms(std::string prefix)
|
||||
U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
|
||||
{
|
||||
U32 flags = PERM_NONE;
|
||||
if (prefix.empty() && gSavedPerAccountSettings.getBOOL("EveryoneExport")) // TODO: Bulk enable export?
|
||||
if (LFSimFeatureHandler::instance().simSupportsExport() && prefix.empty() && gSavedPerAccountSettings.getBOOL("EveryoneExport")) // TODO: Bulk enable export?
|
||||
flags |= PERM_EXPORT;
|
||||
if (gSavedSettings.getBOOL(prefix+"EveryoneCopy"))
|
||||
flags |= PERM_COPY;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
#include "lfsimfeaturehandler.h"
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
|
||||
@@ -198,6 +199,8 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect&
|
||||
childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this);
|
||||
childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this);
|
||||
childSetCommitCallback("CheckExport", &onCommitPermissions, this);
|
||||
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
|
||||
LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLFloaterProperties::refresh, this));
|
||||
// next owner permissions
|
||||
childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this);
|
||||
childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this);
|
||||
@@ -439,8 +442,10 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||
childSetValue("CheckOwnerCopy",LLSD((BOOL)(owner_mask & PERM_COPY)));
|
||||
childSetEnabled("CheckOwnerTransfer",FALSE);
|
||||
childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER)));
|
||||
|
||||
bool supports_export = LFSimFeatureHandler::instance().simSupportsExport();
|
||||
childSetEnabled("CheckOwnerExport",false);
|
||||
childSetValue("CheckOwnerExport", (bool)(owner_mask & PERM_EXPORT));
|
||||
childSetValue("CheckOwnerExport", supports_export && owner_mask & PERM_EXPORT);
|
||||
|
||||
///////////////////////
|
||||
// DEBUG PERMISSIONS //
|
||||
@@ -464,11 +469,15 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||
|
||||
perm_string = "B: ";
|
||||
perm_string += mask_to_string(base_mask);
|
||||
if (!supports_export && base_mask & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
childSetText("BaseMaskDebug",perm_string);
|
||||
childSetVisible("BaseMaskDebug",TRUE);
|
||||
|
||||
perm_string = "O: ";
|
||||
perm_string += mask_to_string(owner_mask);
|
||||
if (!supports_export && owner_mask & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
childSetText("OwnerMaskDebug",perm_string);
|
||||
childSetVisible("OwnerMaskDebug",TRUE);
|
||||
|
||||
@@ -481,6 +490,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||
perm_string = "E";
|
||||
perm_string += overwrite_everyone ? "*: " : ": ";
|
||||
perm_string += mask_to_string(everyone_mask);
|
||||
if (!supports_export && everyone_mask & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
childSetText("EveryoneMaskDebug",perm_string);
|
||||
childSetVisible("EveryoneMaskDebug",TRUE);
|
||||
|
||||
@@ -524,7 +535,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||
childSetEnabled("CheckEveryoneCopy",false);
|
||||
childSetEnabled("CheckEveryoneMove",false);
|
||||
}
|
||||
childSetEnabled("CheckExport", /*simSupportsExport() &&*/ item->getType() != LLAssetType::AT_OBJECT && gAgent.getID() == item->getCreatorUUID() //TODO: Implement Simulator Feature for Export.
|
||||
childSetEnabled("CheckExport", supports_export && item->getType() != LLAssetType::AT_OBJECT && gAgent.getID() == item->getCreatorUUID()
|
||||
&& !(base_mask & PERM_EXPORT && owner_mask & PERM_EXPORT && next_owner_mask & PERM_ITEM_UNRESTRICTED));
|
||||
|
||||
// Set values.
|
||||
@@ -538,7 +549,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
|
||||
|
||||
childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY)));
|
||||
childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE)));
|
||||
childSetValue("CheckExport", (bool)(everyone_mask & PERM_EXPORT));
|
||||
childSetValue("CheckExport", supports_export && everyone_mask & PERM_EXPORT);
|
||||
|
||||
///////////////
|
||||
// SALE INFO //
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include "roles_constants.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
#include "lfsimfeaturehandler.h"
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
|
||||
@@ -138,6 +139,9 @@ BOOL LLPanelPermissions::postBuild()
|
||||
mLabelGroupName = NULL;
|
||||
}
|
||||
|
||||
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
|
||||
LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -606,6 +610,7 @@ void LLPanelPermissions::refresh()
|
||||
&next_owner_mask_on,
|
||||
&next_owner_mask_off);
|
||||
|
||||
bool supports_export = LFSimFeatureHandler::instance().simSupportsExport();
|
||||
|
||||
if( gSavedSettings.getBOOL("DebugPermissions") )
|
||||
{
|
||||
@@ -615,6 +620,8 @@ void LLPanelPermissions::refresh()
|
||||
{
|
||||
perm_string = "B: ";
|
||||
perm_string += mask_to_string(base_mask_on);
|
||||
if (!supports_export && base_mask_on & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
if (U32 diff_mask = base_mask_on ^ owner_mask_on) // When different, show the user's potential permissions lowercase.
|
||||
{
|
||||
if (diff_mask & PERM_MOVE)
|
||||
@@ -633,6 +640,8 @@ void LLPanelPermissions::refresh()
|
||||
|
||||
perm_string = "O: ";
|
||||
perm_string += mask_to_string(owner_mask_on);
|
||||
if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
childSetText("O:",perm_string);
|
||||
childSetVisible("O:",true);
|
||||
|
||||
@@ -643,6 +652,8 @@ void LLPanelPermissions::refresh()
|
||||
|
||||
perm_string = "E: ";
|
||||
perm_string += mask_to_string(everyone_mask_on);
|
||||
if (!supports_export && everyone_mask_on & PERM_EXPORT) // Hide Export when not available
|
||||
perm_string.erase(perm_string.find_last_of("E"));
|
||||
childSetText("E:",perm_string);
|
||||
childSetVisible("E:",true);
|
||||
|
||||
@@ -708,7 +719,7 @@ void LLPanelPermissions::refresh()
|
||||
}
|
||||
|
||||
// Is this user allowed to toggle export on this object?
|
||||
if (self_owned && mCreatorID == mOwnerID/* && simSupportsExport()*/ //TODO: Implement Simulator Feature for Export.
|
||||
if (supports_export && self_owned && mCreatorID == mOwnerID
|
||||
&& (base_mask_on & PERM_EXPORT && owner_mask_on & PERM_EXPORT && (next_owner_mask_on & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)) //Base and Owner must have EXPORT, Next Owner must be UNRESTRICTED
|
||||
{
|
||||
bool can_export = true;
|
||||
@@ -736,7 +747,9 @@ void LLPanelPermissions::refresh()
|
||||
childSetEnabled("checkbox allow export", can_export);
|
||||
}
|
||||
else
|
||||
{
|
||||
childSetEnabled("checkbox allow export", false);
|
||||
}
|
||||
|
||||
if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
|
||||
{
|
||||
@@ -822,12 +835,14 @@ void LLPanelPermissions::refresh()
|
||||
}
|
||||
|
||||
// Export
|
||||
if (supports_export)
|
||||
{
|
||||
if(everyone_mask_on & PERM_EXPORT)
|
||||
{
|
||||
childSetValue("checkbox allow export", true);
|
||||
childSetTentative("checkbox allow export", false);
|
||||
}
|
||||
else if(everyone_mask_on & PERM_EXPORT)
|
||||
else if(everyone_mask_off & PERM_EXPORT)
|
||||
{
|
||||
childSetValue("checkbox allow export", false);
|
||||
childSetTentative("checkbox allow export", false);
|
||||
@@ -836,6 +851,12 @@ void LLPanelPermissions::refresh()
|
||||
{
|
||||
childSetValue("checkbox allow export", true);
|
||||
childSetTentative("checkbox allow export", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
childSetValue("checkbox allow export", false);
|
||||
childSetTentative("checkbox allow export", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user