diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
commit | a4000c3744e42fcbb638e742f3b63fa31a0dee15 (patch) | |
tree | 7f472c30e65bbfa04ee9bc06631a1af305cc31fb /indra/newview/llfloaterland.cpp | |
parent | 6c4cadbb04d633ad7b762058bdeba6e1f650dafd (diff) |
merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 135 |
1 files changed, 62 insertions, 73 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 94a834502f..1de656144f 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -59,6 +59,8 @@ #include "llpanellandmedia.h" #include "llradiogroup.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "llselectmgr.h" #include "llspinctrl.h" #include "lltabcontainer.h" @@ -75,6 +77,7 @@ #include "llviewerwindow.h" #include "llviewercontrol.h" #include "roles_constants.h" +#include "lltrans.h" static std::string OWNER_ONLINE = "0"; static std::string OWNER_OFFLINE = "1"; @@ -161,7 +164,7 @@ void LLFloaterLand::refreshAll() LLFloaterLand::getInstance()->refresh(); } -void LLFloaterLand::onOpen() +void LLFloaterLand::onOpen(const LLSD& key) { // Done automatically when the selected parcel's properties arrive // (and hence we have the local id). @@ -193,19 +196,16 @@ void LLFloaterLand::onClose(bool app_quitting) LLFloaterLand::LLFloaterLand(const LLSD& seed) -: LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land")) +: LLFloater() { - LLCallbackMap::map_t factory_map; - factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); + mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); + mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); + mFactoryMap["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); + mFactoryMap["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); + mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); + mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - - factory_map["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); - factory_map["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); - factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); - factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); - factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", &factory_map, false); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", false); sObserver = new LLParcelSelectionObserver(); LLViewerParcelMgr::getInstance()->addObserver( sObserver ); @@ -297,7 +297,7 @@ void* LLFloaterLand::createPanelLandAccess(void* data) LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_general_panel")), +: LLPanel(), mUncheckedSell(FALSE), mParcel(parcel) { @@ -306,15 +306,13 @@ LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) BOOL LLPanelLandGeneral::postBuild() { mEditName = getChild<LLLineEditor>("Name"); - mEditName->setCommitCallback(onCommitAny); + mEditName->setCommitCallback(onCommitAny, this); childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe); - childSetUserData("Name", this); mEditDesc = getChild<LLTextEditor>("Description"); mEditDesc->setCommitOnFocusLost(TRUE); - mEditDesc->setCommitCallback(onCommitAny); + mEditDesc->setCommitCallback(onCommitAny, this); childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe); - childSetUserData("Description", this); mTextSalePending = getChild<LLTextBox>("SalePending"); @@ -333,7 +331,7 @@ BOOL LLPanelLandGeneral::postBuild() mBtnSetGroup = getChild<LLButton>("Set..."); - mBtnSetGroup->setClickedCallback(onClickSetGroup, this); + mBtnSetGroup->setCommitCallback(boost::bind(&LLPanelLandGeneral::onClickSetGroup, this)); mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed"); @@ -396,7 +394,7 @@ BOOL LLPanelLandGeneral::postBuild() mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL); mBtnStartAuction = getChild<LLButton>("Linden Sale..."); - mBtnStartAuction->setClickedCallback(onClickStartAuction, NULL); + mBtnStartAuction->setClickedCallback(onClickStartAuction, this); return TRUE; } @@ -754,16 +752,14 @@ void LLPanelLandGeneral::draw() LLPanel::draw(); } -// static -void LLPanelLandGeneral::onClickSetGroup(void* userdata) +void LLPanelLandGeneral::onClickSetGroup() { - LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata; LLFloaterGroupPicker* fg; - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectCallback( cbGroupID, userdata ); + fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 )); if (parent_floater) { @@ -792,13 +788,6 @@ void LLPanelLandGeneral::onClickProfile(void* data) } } -// static -void LLPanelLandGeneral::cbGroupID(LLUUID group_id, void* userdata) -{ - LLPanelLandGeneral* self = (LLPanelLandGeneral*)userdata; - self->setGroup(group_id); -} - // public void LLPanelLandGeneral::setGroup(const LLUUID& group_id) { @@ -900,7 +889,7 @@ void LLPanelLandGeneral::onClickStartAuction(void* data) } else { - LLFloaterAuction::show(); + LLFloaterAuction::showInstance(); } } } @@ -974,7 +963,8 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data) // LLPanelLandObjects //--------------------------------------------------------------------------- LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_objects_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } @@ -1014,10 +1004,8 @@ BOOL LLPanelLandObjects::postBuild() mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time"); mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus, this); - mCleanOtherObjectsTime->setCommitCallback(onCommitClean); - + mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this); childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32); - childSetUserData("clean other time", this); mBtnRefresh = getChild<LLButton>("Refresh List"); mBtnRefresh->setClickedCallback(onClickRefresh, this); @@ -1032,7 +1020,7 @@ BOOL LLPanelLandObjects::postBuild() mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList->sortByColumnIndex(3, FALSE); childSetCommitCallback("owner list", onCommitList, this); - mOwnerList->setDoubleClickCallback(onDoubleClickOwner); + mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this); return TRUE; } @@ -1406,7 +1394,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) // ready the list for results self->mOwnerList->deleteAllItems(); - self->mOwnerList->addCommentText(std::string("Searching...")); // *TODO: Translate + self->mOwnerList->setCommentText(LLTrans::getString("Searching")); self->mOwnerList->setEnabled(FALSE); self->mFirstReply = TRUE; @@ -1468,39 +1456,34 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo continue; } - LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id); + LLNameListCtrl::NameItem item_params; + item_params.value = owner_id; + item_params.target = is_group_owned ? LLNameListCtrl::GROUP : LLNameListCtrl::INDIVIDUAL; + if (is_group_owned) { - row->addColumn(self->mIconGroup); - row->addColumn(OWNER_GROUP, FONT); + item_params.cells.add().type("icon").value(self->mIconGroup->getName()); + item_params.cells.add().value(OWNER_GROUP).font(FONT); } else if (is_online) { - row->addColumn(self->mIconAvatarOnline); - row->addColumn(OWNER_ONLINE, FONT); + item_params.cells.add().type("icon").value(self->mIconAvatarOnline->getName()); + item_params.cells.add().value(OWNER_ONLINE).font(FONT); } else // offline { - row->addColumn(self->mIconAvatarOffline); - row->addColumn(OWNER_OFFLINE, FONT); + item_params.cells.add().type("icon").value(self->mIconAvatarOffline->getName()); + item_params.cells.add().value(OWNER_OFFLINE).font(FONT); } + // Placeholder for name. - row->addColumn(LLStringUtil::null, FONT); + item_params.cells.add().font(FONT); object_count_str = llformat("%d", object_count); - row->addColumn(object_count_str, FONT); - - row->addColumn(formatted_time((time_t)most_recent_time), FONT); - + item_params.cells.add().value(object_count_str).font(FONT); + item_params.cells.add().value(formatted_time((time_t)most_recent_time)).font(FONT); - if (is_group_owned) - { - self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM); - } - else - { - self->mOwnerList->addNameItem(row, ADD_BOTTOM); - } + self->mOwnerList->addRow(item_params); lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") << ") owns " << object_count << " objects." << llendl; @@ -1508,7 +1491,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo // check for no results if (0 == self->mOwnerList->getItemCount()) { - self->mOwnerList->addCommentText(std::string("None found.")); // *TODO: Translate + self->mOwnerList->setCommentText(LLTrans::getString("NoneFound")); } else { @@ -1699,7 +1682,7 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data) //--------------------------------------------------------------------------- LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_options_panel")), +: LLPanel(), mCheckEditObjects(NULL), mCheckEditGroupObjects(NULL), mCheckAllObjectEntry(NULL), @@ -1808,8 +1791,7 @@ BOOL LLPanelLandOptions::postBuild() mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl"); if (mSnapshotCtrl) { - mSnapshotCtrl->setCommitCallback( onCommitAny ); - mSnapshotCtrl->setCallbackUserData( this ); + mSnapshotCtrl->setCommitCallback( onCommitAny, this ); mSnapshotCtrl->setAllowNoTexture ( TRUE ); mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); @@ -2262,7 +2244,8 @@ void LLPanelLandOptions::onClickPublishHelp(void*) //--------------------------------------------------------------------------- LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_access_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } @@ -2328,7 +2311,6 @@ void LLPanelLandAccess::refresh() childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - // *TODO: Translate for (access_map_const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) { @@ -2336,25 +2318,28 @@ void LLPanelLandAccess::refresh() std::string suffix; if (entry.mTime != 0) { + LLStringUtil::format_map_t args; S32 now = time(NULL); S32 seconds = entry.mTime - now; if (seconds < 0) seconds = 0; suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + args["[MINUTES]"] = llformat("%d", (seconds/60)); + std::string buf = getString ("Minutes", args); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append("1 " + getString("Minute")); } else { - std::string buf = llformat("%d seconds", seconds); + args["[SECONDS]"] = llformat("%d", seconds); + std::string buf = getString ("Seconds", args); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + getString("Remaining") + ")"); } if (mListAccess) mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); @@ -2375,25 +2360,28 @@ void LLPanelLandAccess::refresh() std::string suffix; if (entry.mTime != 0) { + LLStringUtil::format_map_t args; S32 now = time(NULL); S32 seconds = entry.mTime - now; if (seconds < 0) seconds = 0; suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + args["[MINUTES]"] = llformat("%d", (seconds/60)); + std::string buf = getString ("Minutes", args); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append("1 " + getString("Minute")); } else { - std::string buf = llformat("%d seconds", seconds); + args["[SECONDS]"] = llformat("%d", seconds); + std::string buf = getString ("Seconds", args); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + getString("Remaining") + ")"); } mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); } @@ -2758,7 +2746,8 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) // LLPanelLandCovenant //--------------------------------------------------------------------------- LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_covenant_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } |