Merge branch 'master' of git://github.com/Lirusaito/SingularityViewer

This commit is contained in:
Siana Gearz
2012-11-15 02:30:01 +01:00
6 changed files with 170 additions and 56 deletions

View File

@@ -705,6 +705,18 @@ Found in Advanced->Rendering->Info Displays</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MarketImporterUpdateFreq</key>
<map>
<key>Comment</key>
<string>How fast, in seconds, the Merchant Outbox will update through all phases
This should be as low as possible, but too low may break functionality</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>60.0</real>
</map>
<key>ResetFocusOnSelfClick</key>
<map>
<key>Comment</key>

View File

@@ -327,6 +327,18 @@ void LLInvFVBridge::cutToClipboard()
LLInventoryClipboard::instance().cut(mUUID);
}
}
BOOL LLInvFVBridge::copyToClipboard() const
{
const LLInventoryObject* obj = gInventory.getObject(mUUID);
if (obj && isItemCopyable())
{
LLInventoryClipboard::instance().add(mUUID);
return true;
}
return FALSE;
}
// *TODO: make sure this does the right thing
void LLInvFVBridge::showProperties()
{
@@ -566,8 +578,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
return FALSE;
}
const LLUUID &agent_id = gAgent.getID();
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
LLDynamicArray<LLUUID> objects;
LLInventoryClipboard::instance().retrieve(objects);
S32 count = objects.count();
@@ -575,21 +586,21 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
{
const LLUUID &item_id = objects.get(i);
// Can't paste folders
// Folders are pasteable if all items in there are copyable
const LLInventoryCategory *cat = model->getCategory(item_id);
if (cat)
{
return FALSE;
LLFolderBridge cat_br(panel, mRoot, item_id);
if (!cat_br.isItemCopyable())
return FALSE;
// Skip to the next item in the clipboard
continue;
}
const LLInventoryItem *item = model->getItem(item_id);
if (item)
{
if (!item->getPermissions().allowCopyBy(agent_id))
{
return FALSE;
}
}
// Each item must be copyable to be pasteable
LLItemBridge item_br(panel, mRoot, item_id);
if (!item_br.isItemCopyable())
return FALSE;
}
return TRUE;
}
@@ -919,7 +930,7 @@ void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags,
items.push_back(std::string("Marketplace Separator"));
items.push_back(std::string("Marketplace Send"));
if ((flags & FIRST_SELECTED_ITEM) == 0)
if (!canListOnMarketplaceNow() || (flags & FIRST_SELECTED_ITEM) == 0)
{
disabled_items.push_back(std::string("Marketplace Send"));
}
@@ -1855,16 +1866,6 @@ BOOL LLItemBridge::isItemCopyable() const
return FALSE;
}
BOOL LLItemBridge::copyToClipboard() const
{
if(isItemCopyable())
{
LLInventoryClipboard::instance().add(mUUID);
return TRUE;
}
return FALSE;
}
LLViewerInventoryItem* LLItemBridge::getItem() const
{
LLViewerInventoryItem* item = NULL;
@@ -1963,18 +1964,36 @@ BOOL LLFolderBridge::isUpToDate() const
BOOL LLFolderBridge::isItemCopyable() const
{
// Can copy folders to paste-as-link, but not for straight paste.
return InventoryLinksEnabled();
}
// Folders are copyable if items in them are, recursively, copyable.
BOOL LLFolderBridge::copyToClipboard() const
{
if(isItemCopyable())
// Get the content of the folder
LLInventoryModel::cat_array_t* cat_array;
LLInventoryModel::item_array_t* item_array;
gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array);
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
// Check the items
LLInventoryModel::item_array_t item_array_copy = *item_array;
for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
{
LLInventoryClipboard::instance().add(mUUID);
return TRUE;
LLInventoryItem* item = *iter;
LLItemBridge item_br(panel, mRoot, item->getUUID());
if (!item_br.isItemCopyable())
return FALSE;
}
return FALSE;
// Check the folders
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
LLViewerInventoryCategory* category = *iter;
LLFolderBridge cat_br(panel, mRoot, category->getUUID());
if (!cat_br.isItemCopyable())
return FALSE;
}
return TRUE;
}
BOOL LLFolderBridge::isClipboardPasteable() const
@@ -3026,6 +3045,7 @@ void LLFolderBridge::pasteFromClipboard()
{
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
@@ -3080,7 +3100,8 @@ void LLFolderBridge::pasteFromClipboard()
{
const LLUUID& item_id = (*iter);
LLInventoryItem *item = model->getItem(item_id);
if (item)
LLInventoryObject *obj = model->getObject(item_id);
if (obj)
{
if (move_is_into_current_outfit || move_is_into_outfit)
{
@@ -3091,29 +3112,54 @@ void LLFolderBridge::pasteFromClipboard()
}
else if(LLInventoryClipboard::instance().isCutMode())
{
// move_inventory_item() is not enough,
//we have to update inventory locally too
LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
llassert(viitem);
if (viitem)
// Do a move to "paste" a "cut"
// move_inventory_item() is not enough, as we have to update inventory locally too
if (LLAssetType::AT_CATEGORY == obj->getType())
{
changeItemParent(model, viitem, parent_id, FALSE);
LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
llassert(vicat);
if (vicat)
{
changeCategoryParent(model, vicat, parent_id, FALSE);
}
}
else
{
LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
llassert(viitem);
if (viitem)
{
changeItemParent(model, viitem, parent_id, FALSE);
}
}
}
else
{
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
parent_id,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
// Do a "copy" to "paste" a regular copy clipboard
if (LLAssetType::AT_CATEGORY == obj->getType())
{
LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
llassert(vicat);
if (vicat)
{
copy_inventory_category(model, vicat, parent_id);
}
}
else
{
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
parent_id,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
}
}
}
}
}
}
}
void LLFolderBridge::pasteLinkFromClipboard()
{
@@ -3121,8 +3167,17 @@ void LLFolderBridge::pasteLinkFromClipboard()
if(model)
{
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
if (move_is_into_outbox)
{
// Notify user of failure somehow -- play error sound? modal dialog?
return;
}
const LLUUID parent_id(mUUID);

View File

@@ -45,7 +45,7 @@ class LLViewerJointAttachment;
typedef std::vector<std::string> menuentry_vec_t;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInvFVBridge (& it's derived classes)
// Class LLInvFVBridge (& its derived classes)
//
// Short for Inventory-Folder-View-Bridge. This is an
// implementation class to be able to view inventory items.
@@ -105,7 +105,7 @@ public:
virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
virtual BOOL isItemCopyable() const { return FALSE; }
virtual BOOL copyToClipboard() const { return FALSE; }
virtual BOOL copyToClipboard() const;
virtual void cutToClipboard();
virtual BOOL isClipboardPasteable() const;
virtual BOOL isClipboardPasteableAsLink() const;
@@ -212,11 +212,10 @@ public:
virtual BOOL renameItem(const std::string& new_name);
virtual BOOL removeItem();
virtual BOOL isItemCopyable() const;
virtual BOOL copyToClipboard() const;
virtual BOOL hasChildren() const { return FALSE; }
virtual BOOL isUpToDate() const { return TRUE; }
static void showFloaterImagePreview(LLInventoryItem* item, AIFilePicker* filepicker);
static void showFloaterImagePreview(LLInventoryItem* item, AIFilePicker* filepicker);
/*virtual*/ void clearDisplayName() { mDisplayName.clear(); }
@@ -240,8 +239,10 @@ public:
mCallingCards(FALSE),
mWearables(FALSE)
{}
BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop);
BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop);
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void openItem();
virtual void closeItem();
@@ -274,7 +275,6 @@ public:
virtual BOOL isItemCopyable() const;
virtual BOOL isClipboardPasteable() const;
virtual BOOL isClipboardPasteableAsLink() const;
virtual BOOL copyToClipboard() const;
static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
@@ -639,6 +639,7 @@ public:
const LLUUID& uuid,
U32 flags = 0x00) const;
};
void rez_attachment(LLViewerInventoryItem* item,
LLViewerJointAttachment* attachment,
bool replace = false);

View File

@@ -95,7 +95,7 @@ LLUUID LLInventoryState::sWearNewClothingTransactionID;
void append_path(const LLUUID& id, std::string& path)
{
std::string temp;
LLInventoryObject* obj = gInventory.getObject(id);
const LLInventoryObject* obj = gInventory.getObject(id);
LLUUID parent_id;
if(obj) parent_id = obj->getParentUUID();
std::string forward_slash("/");
@@ -131,6 +131,49 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s
model->notifyObservers();
}
void copy_inventory_category(LLInventoryModel* model,
LLViewerInventoryCategory* cat,
const LLUUID& parent_id,
const LLUUID& root_copy_id)
{
// Create the initial folder
LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName());
model->notifyObservers();
// We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
// Get the content of the folder
LLInventoryModel::cat_array_t* cat_array;
LLInventoryModel::item_array_t* item_array;
gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
// Copy all the items
LLInventoryModel::item_array_t item_array_copy = *item_array;
for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
{
LLInventoryItem* item = *iter;
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
new_cat_uuid,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
}
// Copy all the folders
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
LLViewerInventoryCategory* category = *iter;
if (category->getUUID() != root_id)
{
copy_inventory_category(model, category, new_cat_uuid, root_id);
}
}
}
class LLInventoryCollectAllItems : public LLInventoryCollectFunctor
{
public:

View File

@@ -57,6 +57,8 @@ void show_item_profile(const LLUUID& item_uuid);
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null);
// Generates a string containing the path to the item specified by item_id.
void append_path(const LLUUID& id, std::string& path);
@@ -348,11 +350,10 @@ public:
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFindWearables
// Class LLFindWearablesEx
//
// Collects wearables based on given criteria.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLFindWearablesEx : public LLInventoryCollectFunctor
{
public:
@@ -414,6 +415,7 @@ public:
*******************************************************************************/
class LLFolderViewItem;
class LLFolderViewFolder;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFolderViewFunctor
//

View File

@@ -342,7 +342,7 @@ namespace LLMarketplaceImport
// Interface class
//
static const F32 MARKET_IMPORTER_UPDATE_FREQUENCY = 300.0f; //1.0f;
//static const F32 MARKET_IMPORTER_UPDATE_FREQUENCY = 300.0f; //1.0f;
//static
void LLMarketplaceInventoryImporter::update()
@@ -353,6 +353,7 @@ void LLMarketplaceInventoryImporter::update()
if (update_timer.hasExpired())
{
LLMarketplaceInventoryImporter::instance().updateImport();
static LLCachedControl<F32> MARKET_IMPORTER_UPDATE_FREQUENCY("MarketImporterUpdateFreq", 10.0f);
update_timer.setTimerExpirySec(MARKET_IMPORTER_UPDATE_FREQUENCY);
}
}