diff options
Diffstat (limited to 'linden/indra/newview/llinventoryview.cpp')
-rw-r--r-- | linden/indra/newview/llinventoryview.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 340608b..5e0456d 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp | |||
@@ -79,11 +79,13 @@ | |||
79 | #include "llviewermessage.h" | 79 | #include "llviewermessage.h" |
80 | #include "llviewerregion.h" | 80 | #include "llviewerregion.h" |
81 | #include "lltabcontainer.h" | 81 | #include "lltabcontainer.h" |
82 | #include "llvieweruictrlfactory.h" | 82 | #include "lluictrlfactory.h" |
83 | #include "llselectmgr.h" | 83 | #include "llselectmgr.h" |
84 | 84 | ||
85 | #include "llsdserialize.h" | 85 | #include "llsdserialize.h" |
86 | 86 | ||
87 | static LLRegisterWidget<LLInventoryPanel> r("inventory_panel"); | ||
88 | |||
87 | LLDynamicArray<LLInventoryView*> LLInventoryView::sActiveViews; | 89 | LLDynamicArray<LLInventoryView*> LLInventoryView::sActiveViews; |
88 | 90 | ||
89 | //BOOL LLInventoryView::sOpenNextNewItem = FALSE; | 91 | //BOOL LLInventoryView::sOpenNextNewItem = FALSE; |
@@ -113,18 +115,18 @@ LLInventoryViewFinder::LLInventoryViewFinder(const LLString& name, | |||
113 | mFilter(inventory_view->mActivePanel->getFilter()) | 115 | mFilter(inventory_view->mActivePanel->getFilter()) |
114 | { | 116 | { |
115 | 117 | ||
116 | gUICtrlFactory->buildFloater(this, "floater_inventory_view_finder.xml"); | 118 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml"); |
117 | 119 | ||
118 | childSetAction("All", selectAllTypes, this); | 120 | childSetAction("All", selectAllTypes, this); |
119 | childSetAction("None", selectNoTypes, this); | 121 | childSetAction("None", selectNoTypes, this); |
120 | 122 | ||
121 | mSpinSinceHours = LLUICtrlFactory::getSpinnerByName(this, "spin_hours_ago"); | 123 | mSpinSinceHours = getChild<LLSpinCtrl>("spin_hours_ago"); |
122 | childSetCommitCallback("spin_hours_ago", onTimeAgo, this); | 124 | childSetCommitCallback("spin_hours_ago", onTimeAgo, this); |
123 | 125 | ||
124 | mSpinSinceDays = LLUICtrlFactory::getSpinnerByName(this, "spin_days_ago"); | 126 | mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago"); |
125 | childSetCommitCallback("spin_days_ago", onTimeAgo, this); | 127 | childSetCommitCallback("spin_days_ago", onTimeAgo, this); |
126 | 128 | ||
127 | // mCheckSinceLogoff = LLUICtrlFactory::getSpinnerByName(this, "check_since_logoff"); | 129 | // mCheckSinceLogoff = getChild<LLSpinCtrl>("check_since_logoff"); |
128 | childSetCommitCallback("check_since_logoff", onCheckSinceLogoff, this); | 130 | childSetCommitCallback("check_since_logoff", onCheckSinceLogoff, this); |
129 | 131 | ||
130 | childSetAction("Close", onCloseBtn, this); | 132 | childSetAction("Close", onCloseBtn, this); |
@@ -491,12 +493,12 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
491 | mSavedFolderState = new LLSaveFolderState(); | 493 | mSavedFolderState = new LLSaveFolderState(); |
492 | mSavedFolderState->setApply(FALSE); | 494 | mSavedFolderState->setApply(FALSE); |
493 | 495 | ||
494 | gUICtrlFactory->buildFloater(this, "floater_inventory.xml", NULL); | 496 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory.xml", NULL); |
495 | 497 | ||
496 | mFilterTabs = (LLTabContainer*)LLUICtrlFactory::getTabContainerByName(this, "inventory filter tabs"); | 498 | mFilterTabs = (LLTabContainer*)getChild<LLTabContainer>("inventory filter tabs"); |
497 | 499 | ||
498 | // Set up the default inv. panel/filter settings. | 500 | // Set up the default inv. panel/filter settings. |
499 | mActivePanel = (LLInventoryPanel*)getCtrlByNameAndType("All Items", WIDGET_TYPE_INVENTORY_PANEL); | 501 | mActivePanel = getChild<LLInventoryPanel>("All Items"); |
500 | if (mActivePanel) | 502 | if (mActivePanel) |
501 | { | 503 | { |
502 | // "All Items" is the previous only view, so it gets the InventorySortOrder | 504 | // "All Items" is the previous only view, so it gets the InventorySortOrder |
@@ -505,7 +507,7 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
505 | mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); | 507 | mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); |
506 | mActivePanel->setSelectCallback(onSelectionChange, mActivePanel); | 508 | mActivePanel->setSelectCallback(onSelectionChange, mActivePanel); |
507 | } | 509 | } |
508 | LLInventoryPanel* recent_items_panel = (LLInventoryPanel*)getCtrlByNameAndType("Recent Items", WIDGET_TYPE_INVENTORY_PANEL); | 510 | LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items"); |
509 | if (recent_items_panel) | 511 | if (recent_items_panel) |
510 | { | 512 | { |
511 | recent_items_panel->setSinceLogoff(TRUE); | 513 | recent_items_panel->setSinceLogoff(TRUE); |
@@ -541,7 +543,7 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
541 | } | 543 | } |
542 | 544 | ||
543 | 545 | ||
544 | mSearchEditor = (LLSearchEditor*)getCtrlByNameAndType("inventory search editor", WIDGET_TYPE_SEARCH_EDITOR); | 546 | mSearchEditor = getChild<LLSearchEditor>("inventory search editor"); |
545 | if (mSearchEditor) | 547 | if (mSearchEditor) |
546 | { | 548 | { |
547 | mSearchEditor->setSearchCallback(onSearchEdit, this); | 549 | mSearchEditor->setSearchCallback(onSearchEdit, this); |
@@ -565,7 +567,7 @@ LLInventoryView::~LLInventoryView( void ) | |||
565 | { | 567 | { |
566 | // Save the filters state. | 568 | // Save the filters state. |
567 | LLSD filterRoot; | 569 | LLSD filterRoot; |
568 | LLInventoryPanel* all_items_panel = (LLInventoryPanel*)getCtrlByNameAndType("All Items", WIDGET_TYPE_INVENTORY_PANEL); | 570 | LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>("All Items"); |
569 | if (all_items_panel) | 571 | if (all_items_panel) |
570 | { | 572 | { |
571 | LLInventoryFilter* filter = all_items_panel->getFilter(); | 573 | LLInventoryFilter* filter = all_items_panel->getFilter(); |
@@ -574,7 +576,7 @@ LLInventoryView::~LLInventoryView( void ) | |||
574 | filterRoot[filter->getName()] = filterState; | 576 | filterRoot[filter->getName()] = filterState; |
575 | } | 577 | } |
576 | 578 | ||
577 | LLInventoryPanel* recent_items_panel = (LLInventoryPanel*)getCtrlByNameAndType("Recent Items", WIDGET_TYPE_INVENTORY_PANEL); | 579 | LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items"); |
578 | if (recent_items_panel) | 580 | if (recent_items_panel) |
579 | { | 581 | { |
580 | LLInventoryFilter* filter = recent_items_panel->getFilter(); | 582 | LLInventoryFilter* filter = recent_items_panel->getFilter(); |
@@ -606,7 +608,7 @@ void LLInventoryView::draw() | |||
606 | std::ostringstream title; | 608 | std::ostringstream title; |
607 | title << "Inventory"; | 609 | title << "Inventory"; |
608 | LLString item_count_string; | 610 | LLString item_count_string; |
609 | gResMgr->getIntegerString(item_count_string, gInventory.getItemCount()); | 611 | LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount()); |
610 | title << " (" << item_count_string << " items)"; | 612 | title << " (" << item_count_string << " items)"; |
611 | title << mFilterText; | 613 | title << mFilterText; |
612 | setTitle(title.str()); | 614 | setTitle(title.str()); |
@@ -727,15 +729,16 @@ void LLInventoryView::onClose(bool app_quitting) | |||
727 | } | 729 | } |
728 | } | 730 | } |
729 | 731 | ||
730 | BOOL LLInventoryView::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | 732 | BOOL LLInventoryView::handleKeyHere(KEY key, MASK mask) |
731 | { | 733 | { |
732 | LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL; | 734 | LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL; |
733 | if (root_folder) | 735 | if (root_folder) |
734 | { | 736 | { |
735 | // first check for user accepting current search results | 737 | // first check for user accepting current search results |
736 | if (!called_from_parent | 738 | if (mSearchEditor |
737 | && mSearchEditor && mSearchEditor->hasFocus() | 739 | && mSearchEditor->hasFocus() |
738 | && (key == KEY_RETURN || key == KEY_DOWN) | 740 | && (key == KEY_RETURN |
741 | || key == KEY_DOWN) | ||
739 | && mask == MASK_NONE) | 742 | && mask == MASK_NONE) |
740 | { | 743 | { |
741 | // move focus to inventory proper | 744 | // move focus to inventory proper |
@@ -750,7 +753,7 @@ BOOL LLInventoryView::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | |||
750 | } | 753 | } |
751 | } | 754 | } |
752 | 755 | ||
753 | return LLFloater::handleKeyHere(key, mask, called_from_parent); | 756 | return LLFloater::handleKeyHere(key, mask); |
754 | 757 | ||
755 | } | 758 | } |
756 | 759 | ||
@@ -762,7 +765,7 @@ void LLInventoryView::changed(U32 mask) | |||
762 | { | 765 | { |
763 | LLLocale locale(LLLocale::USER_LOCALE); | 766 | LLLocale locale(LLLocale::USER_LOCALE); |
764 | LLString item_count_string; | 767 | LLString item_count_string; |
765 | gResMgr->getIntegerString(item_count_string, gInventory.getItemCount()); | 768 | LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount()); |
766 | title << " (Fetched " << item_count_string << " items...)"; | 769 | title << " (Fetched " << item_count_string << " items...)"; |
767 | } | 770 | } |
768 | title << mFilterText; | 771 | title << mFilterText; |
@@ -1076,7 +1079,7 @@ BOOL LLInventoryView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | |||
1076 | 1079 | ||
1077 | return handled; | 1080 | return handled; |
1078 | } | 1081 | } |
1079 | LLUUID get_item_icon_uuid(LLAssetType::EType asset_type, | 1082 | LLString get_item_icon_name(LLAssetType::EType asset_type, |
1080 | LLInventoryType::EType inventory_type, | 1083 | LLInventoryType::EType inventory_type, |
1081 | U32 attachment_point, | 1084 | U32 attachment_point, |
1082 | BOOL item_is_multi ) | 1085 | BOOL item_is_multi ) |
@@ -1193,19 +1196,17 @@ LLUUID get_item_icon_uuid(LLAssetType::EType asset_type, | |||
1193 | default: | 1196 | default: |
1194 | break; | 1197 | break; |
1195 | } | 1198 | } |
1196 | LLString uuid_string = gViewerArt.getString(ICON_NAME[idx]); | 1199 | |
1197 | return LLUUID(uuid_string); | 1200 | return LLString(ICON_NAME[idx]); |
1198 | } | 1201 | } |
1199 | 1202 | ||
1200 | LLViewerImage* get_item_icon(LLAssetType::EType asset_type, | 1203 | LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, |
1201 | LLInventoryType::EType inventory_type, | 1204 | LLInventoryType::EType inventory_type, |
1202 | U32 attachment_point, | 1205 | U32 attachment_point, |
1203 | BOOL item_is_multi) | 1206 | BOOL item_is_multi) |
1204 | { | 1207 | { |
1205 | LLUUID icon_uuid = get_item_icon_uuid(asset_type, inventory_type, attachment_point, item_is_multi ); | 1208 | const LLString& icon_name = get_item_icon_name(asset_type, inventory_type, attachment_point, item_is_multi ); |
1206 | LLViewerImage* imagep = gImageList.getImage(icon_uuid, MIPMAP_FALSE, TRUE); | 1209 | return LLUI::getUIImage(icon_name); |
1207 | imagep->setClamp(TRUE, TRUE); | ||
1208 | return imagep; | ||
1209 | } | 1210 | } |
1210 | 1211 | ||
1211 | const LLString LLInventoryPanel::DEFAULT_SORT_ORDER = LLString("InventorySortOrder"); | 1212 | const LLString LLInventoryPanel::DEFAULT_SORT_ORDER = LLString("InventorySortOrder"); |