diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 08:04:56 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 08:04:56 +0000 |
commit | 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 (patch) | |
tree | 4a505c1e0919af52800b3ffb3eaf135e7d6f9ce6 /indra/newview/llfloaterproperties.cpp | |
parent | 351ebe9fcb76f3b99c2957004bb8493a904869ee (diff) |
merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3
ignore-dead-branch
Diffstat (limited to 'indra/newview/llfloaterproperties.cpp')
-rw-r--r-- | indra/newview/llfloaterproperties.cpp | 94 |
1 files changed, 63 insertions, 31 deletions
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 406d940cf0..5a8afc2277 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -37,13 +37,14 @@ #include <functional> #include "llcachename.h" #include "lldbstrings.h" +#include "llfloaterreg.h" #include "llinventory.h" #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" +#include "llfriendactions.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llradiogroup.h" @@ -51,11 +52,13 @@ #include "roles_constants.h" #include "llselectmgr.h" #include "lltextbox.h" +#include "lltrans.h" #include "lluiconstants.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewercontrol.h" +#include "llviewerwindow.h" #include "lluictrlfactory.h" @@ -135,7 +138,13 @@ LLFloaterProperties* LLFloaterProperties::show(const LLUUID& item_id, } instance->refresh(); - instance->open(); /* Flawfinder: ignore */ + instance->openFloater(); + } + else + { + LLFloaterProperties* floater = new LLFloaterProperties(item_id, object_id); + // keep onscreen + gFloaterView->adjustToFitScreen(floater, FALSE); } return instance; } @@ -151,14 +160,14 @@ void LLFloaterProperties::dirtyAll() } // Default constructor -LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id) : - LLFloater(name, rect, title), +LLFloaterProperties::LLFloaterProperties(const LLUUID& item_id, const LLUUID& object_id) + : LLFloater(), mItemID(item_id), mObjectID(object_id), mDirty(TRUE) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); - + if (!sPropertiesObserver) { sPropertiesObserver = new LLPropertiesObserver; @@ -168,6 +177,28 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& // add the object to the static structure LLUUID key = mItemID ^ mObjectID; sInstances.insert(instance_map::value_type(key, this)); + +} + +// Destroys the object +LLFloaterProperties::~LLFloaterProperties() +{ + // clean up the static data. + instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); + if(it != sInstances.end()) + { + sInstances.erase(it); + } + sPropertiesObserverCount--; + if (!sPropertiesObserverCount) + { + delete sPropertiesObserver; + sPropertiesObserver = NULL; + } +} +// virtual +BOOL LLFloaterProperties::postBuild() +{ // build the UI // item name & description childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); @@ -196,23 +227,8 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& childSetCommitCallback("EditPrice",&onCommitSaleInfo, this); // The UI has been built, now fill in all the values refresh(); -} -// Destroys the object -LLFloaterProperties::~LLFloaterProperties() -{ - // clean up the static data. - instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); - if(it != sInstances.end()) - { - sInstances.erase(it); - } - sPropertiesObserverCount--; - if (!sPropertiesObserverCount) - { - delete sPropertiesObserver; - sPropertiesObserver = NULL; - } + return TRUE; } void LLFloaterProperties::refresh() @@ -372,8 +388,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) ////////////////// // ACQUIRE DATE // ////////////////// - - // *TODO: Localize / translate this + time_t time_utc = item->getCreationDate(); if (0 == time_utc) { @@ -381,7 +396,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } else { - childSetText("LabelAcquiredDate", std::string(ctime(&time_utc)) ); + std::string timeStr = getString("acquiredDate"); + LLSD substitution; + substitution["datetime"] = (S32) time_utc; + LLStringUtil::format (timeStr, substitution); + childSetText ("LabelAcquiredDate", timeStr); } /////////////////////// @@ -586,7 +605,7 @@ void LLFloaterProperties::onClickCreator(void* data) if(!item) return; if(!item->getCreatorUUID().isNull()) { - LLFloaterAvatarInfo::showFromObject(item->getCreatorUUID()); + LLFriendActions::showProfile(item->getCreatorUUID()); } } @@ -603,10 +622,7 @@ void LLFloaterProperties::onClickOwner(void* data) } else { - if(!item->getPermissions().getOwner().isNull()) - { - LLFloaterAvatarInfo::showFromObject(item->getPermissions().getOwner()); - } + LLFriendActions::showProfile(item->getPermissions().getOwner()); } } @@ -938,7 +954,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ if (floaterp) { - floaterp->close(); + floaterp->closeFloater(); } } @@ -946,8 +962,24 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ /// LLMultiProperties ///---------------------------------------------------------------------------- -LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect) +LLMultiProperties::LLMultiProperties() + : LLMultiFloater() { + // *TODO: There should be a .xml file for this + const LLRect& nextrect = LLFloaterReg::getFloaterRect("properties"); // place where the next properties should show up + if (nextrect.getWidth() > 0) + { + setRect(nextrect); + } + else + { + // start with a small rect in the top-left corner ; will get resized + LLRect rect; + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 20, 20); + setRect(rect); + } + setTitle(LLTrans::getString("MultiPropertiesTitle")); + buildTabContainer(); } ///---------------------------------------------------------------------------- |