diff options
Diffstat (limited to 'linden/indra/newview/llinventoryview.cpp')
-rw-r--r-- | linden/indra/newview/llinventoryview.cpp | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index f9dd70d..f64dd0d 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "llradiogroup.h" | 44 | #include "llradiogroup.h" |
45 | #include "llspinctrl.h" | 45 | #include "llspinctrl.h" |
46 | #include "lltextbox.h" | 46 | #include "lltextbox.h" |
47 | #include "llcombobox.h" | ||
47 | #include "llui.h" | 48 | #include "llui.h" |
48 | 49 | ||
49 | #include "llfirstuse.h" | 50 | #include "llfirstuse.h" |
@@ -549,6 +550,12 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
549 | mSearchEditor->setSearchCallback(onSearchEdit, this); | 550 | mSearchEditor->setSearchCallback(onSearchEdit, this); |
550 | } | 551 | } |
551 | 552 | ||
553 | mQuickFilterCombo = getChild<LLComboBox>("Quick Filter"); | ||
554 | if (mQuickFilterCombo) | ||
555 | { | ||
556 | mQuickFilterCombo->setCommitCallback(onQuickFilterCommit); | ||
557 | } | ||
558 | |||
552 | sActiveViews.put(this); | 559 | sActiveViews.put(this); |
553 | 560 | ||
554 | gInventory.addObserver(this); | 561 | gInventory.addObserver(this); |
@@ -617,6 +624,11 @@ void LLInventoryView::draw() | |||
617 | { | 624 | { |
618 | mSearchEditor->setText(mActivePanel->getFilterSubString()); | 625 | mSearchEditor->setText(mActivePanel->getFilterSubString()); |
619 | } | 626 | } |
627 | if (mActivePanel && mQuickFilterCombo) | ||
628 | { | ||
629 | refreshQuickFilter( mQuickFilterCombo ); | ||
630 | } | ||
631 | |||
620 | LLFloater::draw(); | 632 | LLFloater::draw(); |
621 | } | 633 | } |
622 | 634 | ||
@@ -981,6 +993,238 @@ void LLInventoryView::onSearchEdit(const std::string& search_string, void* user_ | |||
981 | } | 993 | } |
982 | 994 | ||
983 | 995 | ||
996 | //static | ||
997 | void LLInventoryView::onQuickFilterCommit(LLUICtrl* ctrl, void* user_data) | ||
998 | { | ||
999 | |||
1000 | LLComboBox* quickfilter = (LLComboBox*)ctrl; | ||
1001 | |||
1002 | |||
1003 | LLInventoryView* view = (LLInventoryView*)(quickfilter->getParent()); | ||
1004 | if (!view->mActivePanel) | ||
1005 | { | ||
1006 | return; | ||
1007 | } | ||
1008 | |||
1009 | |||
1010 | std::string item_type = quickfilter->getSimple(); | ||
1011 | U32 filter_type; | ||
1012 | |||
1013 | if (view->getString("filter_type_animation") == item_type) | ||
1014 | { | ||
1015 | filter_type = 0x1 << LLInventoryType::IT_ANIMATION; | ||
1016 | } | ||
1017 | |||
1018 | else if (view->getString("filter_type_callingcard") == item_type) | ||
1019 | { | ||
1020 | filter_type = 0x1 << LLInventoryType::IT_CALLINGCARD; | ||
1021 | } | ||
1022 | |||
1023 | else if (view->getString("filter_type_wearable") == item_type) | ||
1024 | { | ||
1025 | filter_type = 0x1 << LLInventoryType::IT_WEARABLE; | ||
1026 | } | ||
1027 | |||
1028 | else if (view->getString("filter_type_gesture") == item_type) | ||
1029 | { | ||
1030 | filter_type = 0x1 << LLInventoryType::IT_GESTURE; | ||
1031 | } | ||
1032 | |||
1033 | else if (view->getString("filter_type_landmark") == item_type) | ||
1034 | { | ||
1035 | filter_type = 0x1 << LLInventoryType::IT_LANDMARK; | ||
1036 | } | ||
1037 | |||
1038 | else if (view->getString("filter_type_notecard") == item_type) | ||
1039 | { | ||
1040 | filter_type = 0x1 << LLInventoryType::IT_NOTECARD; | ||
1041 | } | ||
1042 | |||
1043 | else if (view->getString("filter_type_object") == item_type) | ||
1044 | { | ||
1045 | filter_type = 0x1 << LLInventoryType::IT_OBJECT; | ||
1046 | } | ||
1047 | |||
1048 | else if (view->getString("filter_type_script") == item_type) | ||
1049 | { | ||
1050 | filter_type = 0x1 << LLInventoryType::IT_LSL; | ||
1051 | } | ||
1052 | |||
1053 | else if (view->getString("filter_type_sound") == item_type) | ||
1054 | { | ||
1055 | filter_type = 0x1 << LLInventoryType::IT_SOUND; | ||
1056 | } | ||
1057 | |||
1058 | else if (view->getString("filter_type_texture") == item_type) | ||
1059 | { | ||
1060 | filter_type = 0x1 << LLInventoryType::IT_TEXTURE; | ||
1061 | } | ||
1062 | |||
1063 | else if (view->getString("filter_type_snapshot") == item_type) | ||
1064 | { | ||
1065 | filter_type = 0x1 << LLInventoryType::IT_SNAPSHOT; | ||
1066 | } | ||
1067 | |||
1068 | else if (view->getString("filter_type_custom") == item_type) | ||
1069 | { | ||
1070 | // When they select custom, show the floater then return | ||
1071 | if( !(view->filtersVisible(view)) ) | ||
1072 | { | ||
1073 | view->toggleFindOptions(); | ||
1074 | } | ||
1075 | return; | ||
1076 | } | ||
1077 | |||
1078 | else if (view->getString("filter_type_all") == item_type) | ||
1079 | { | ||
1080 | // Show all types | ||
1081 | filter_type = 0xffffffff; | ||
1082 | } | ||
1083 | |||
1084 | else | ||
1085 | { | ||
1086 | llwarns << "Ignoring unknown filter: " << item_type << llendl; | ||
1087 | return; | ||
1088 | } | ||
1089 | |||
1090 | view->mActivePanel->setFilterTypes( filter_type ); | ||
1091 | |||
1092 | |||
1093 | // Force the filters window to update itself, if it's open. | ||
1094 | LLInventoryViewFinder* finder = view->getFinder(); | ||
1095 | if( finder ) | ||
1096 | { | ||
1097 | finder->updateElementsFromFilter(); | ||
1098 | } | ||
1099 | |||
1100 | // llinfos << "Quick Filter: " << item_type << llendl; | ||
1101 | |||
1102 | } | ||
1103 | |||
1104 | |||
1105 | |||
1106 | //static | ||
1107 | void LLInventoryView::refreshQuickFilter(LLUICtrl* ctrl) | ||
1108 | { | ||
1109 | |||
1110 | LLInventoryView* view = (LLInventoryView*)(ctrl->getParent()); | ||
1111 | if (!view->mActivePanel) | ||
1112 | { | ||
1113 | return; | ||
1114 | } | ||
1115 | |||
1116 | LLComboBox* quickfilter = view->getChild<LLComboBox>("Quick Filter"); | ||
1117 | if (!quickfilter) | ||
1118 | { | ||
1119 | return; | ||
1120 | } | ||
1121 | |||
1122 | |||
1123 | U32 filter_type = view->mActivePanel->getFilterTypes(); | ||
1124 | |||
1125 | |||
1126 | // Mask to extract only the bit fields we care about. | ||
1127 | // *TODO: There's probably a cleaner way to construct this mask. | ||
1128 | U32 filter_mask = 0; | ||
1129 | filter_mask |= (0x1 << LLInventoryType::IT_ANIMATION); | ||
1130 | filter_mask |= (0x1 << LLInventoryType::IT_CALLINGCARD); | ||
1131 | filter_mask |= (0x1 << LLInventoryType::IT_WEARABLE); | ||
1132 | filter_mask |= (0x1 << LLInventoryType::IT_GESTURE); | ||
1133 | filter_mask |= (0x1 << LLInventoryType::IT_LANDMARK); | ||
1134 | filter_mask |= (0x1 << LLInventoryType::IT_NOTECARD); | ||
1135 | filter_mask |= (0x1 << LLInventoryType::IT_OBJECT); | ||
1136 | filter_mask |= (0x1 << LLInventoryType::IT_LSL); | ||
1137 | filter_mask |= (0x1 << LLInventoryType::IT_SOUND); | ||
1138 | filter_mask |= (0x1 << LLInventoryType::IT_TEXTURE); | ||
1139 | filter_mask |= (0x1 << LLInventoryType::IT_SNAPSHOT); | ||
1140 | |||
1141 | |||
1142 | filter_type &= filter_mask; | ||
1143 | |||
1144 | |||
1145 | //llinfos << "filter_type: " << filter_type << llendl; | ||
1146 | |||
1147 | std::string selection; | ||
1148 | |||
1149 | |||
1150 | if (filter_type == filter_mask) | ||
1151 | { | ||
1152 | selection = view->getString("filter_type_all"); | ||
1153 | } | ||
1154 | |||
1155 | else if (filter_type == (0x1 << LLInventoryType::IT_ANIMATION)) | ||
1156 | { | ||
1157 | selection = view->getString("filter_type_animation"); | ||
1158 | } | ||
1159 | |||
1160 | else if (filter_type == (0x1 << LLInventoryType::IT_CALLINGCARD)) | ||
1161 | { | ||
1162 | selection = view->getString("filter_type_callingcard"); | ||
1163 | } | ||
1164 | |||
1165 | else if (filter_type == (0x1 << LLInventoryType::IT_WEARABLE)) | ||
1166 | { | ||
1167 | selection = view->getString("filter_type_wearable"); | ||
1168 | } | ||
1169 | |||
1170 | else if (filter_type == (0x1 << LLInventoryType::IT_GESTURE)) | ||
1171 | { | ||
1172 | selection = view->getString("filter_type_gesture"); | ||
1173 | } | ||
1174 | |||
1175 | else if (filter_type == (0x1 << LLInventoryType::IT_LANDMARK)) | ||
1176 | { | ||
1177 | selection = view->getString("filter_type_landmark"); | ||
1178 | } | ||
1179 | |||
1180 | else if (filter_type == (0x1 << LLInventoryType::IT_NOTECARD)) | ||
1181 | { | ||
1182 | selection = view->getString("filter_type_notecard"); | ||
1183 | } | ||
1184 | |||
1185 | else if (filter_type == (0x1 << LLInventoryType::IT_OBJECT)) | ||
1186 | { | ||
1187 | selection = view->getString("filter_type_object"); | ||
1188 | } | ||
1189 | |||
1190 | else if (filter_type == (0x1 << LLInventoryType::IT_LSL)) | ||
1191 | { | ||
1192 | selection = view->getString("filter_type_script"); | ||
1193 | } | ||
1194 | |||
1195 | else if (filter_type == (0x1 << LLInventoryType::IT_SOUND)) | ||
1196 | { | ||
1197 | selection = view->getString("filter_type_sound"); | ||
1198 | } | ||
1199 | |||
1200 | else if (filter_type == (0x1 << LLInventoryType::IT_TEXTURE)) | ||
1201 | { | ||
1202 | selection = view->getString("filter_type_texture"); | ||
1203 | } | ||
1204 | |||
1205 | else if (filter_type == (0x1 << LLInventoryType::IT_SNAPSHOT)) | ||
1206 | { | ||
1207 | selection = view->getString("filter_type_snapshot"); | ||
1208 | } | ||
1209 | |||
1210 | else | ||
1211 | { | ||
1212 | selection = view->getString("filter_type_custom"); | ||
1213 | } | ||
1214 | |||
1215 | |||
1216 | // Select the chosen item by label text | ||
1217 | BOOL result = quickfilter->setSimple( (selection) ); | ||
1218 | |||
1219 | if( !result ) | ||
1220 | { | ||
1221 | llinfos << "The item didn't exist: " << selection << llendl; | ||
1222 | } | ||
1223 | |||
1224 | } | ||
1225 | |||
1226 | |||
1227 | |||
984 | // static | 1228 | // static |
985 | // BOOL LLInventoryView::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward) | 1229 | // BOOL LLInventoryView::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward) |
986 | // { | 1230 | // { |