diff options
author | McCabe Maxsted | 2009-09-11 16:33:01 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-09-11 16:33:01 -0700 |
commit | 65e5463ae176dd148a4edcc45d0d4e1160cc6108 (patch) | |
tree | 17b1f1a1490c3f333170c0fabe51681a5b5ce812 /linden | |
parent | Fixed missing 'm' for draw distance slider (diff) | |
download | meta-impy-65e5463ae176dd148a4edcc45d0d4e1160cc6108.zip meta-impy-65e5463ae176dd148a4edcc45d0d4e1160cc6108.tar.gz meta-impy-65e5463ae176dd148a4edcc45d0d4e1160cc6108.tar.bz2 meta-impy-65e5463ae176dd148a4edcc45d0d4e1160cc6108.tar.xz |
Applied inventory Search menu from Emerald viewer (still ugly)
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | linden/indra/newview/llfolderview.cpp | 45 | ||||
-rw-r--r-- | linden/indra/newview/llfolderview.h | 5 | ||||
-rw-r--r-- | linden/indra/newview/llinventoryactions.cpp | 36 | ||||
-rw-r--r-- | linden/indra/newview/llinventoryview.cpp | 9 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml | 18 |
6 files changed, 122 insertions, 2 deletions
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 39b482b..088631b 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -4032,6 +4032,17 @@ | |||
4032 | <key>Value</key> | 4032 | <key>Value</key> |
4033 | <real>1.0</real> | 4033 | <real>1.0</real> |
4034 | </map> | 4034 | </map> |
4035 | <key>InventorySearchType</key> | ||
4036 | <map> | ||
4037 | <key>Comment</key> | ||
4038 | <string>Controls what type of inventory search we perform.</string> | ||
4039 | <key>Persist</key> | ||
4040 | <integer>0</integer> | ||
4041 | <key>Type</key> | ||
4042 | <string>U32</string> | ||
4043 | <key>Value</key> | ||
4044 | <integer>0</integer> | ||
4045 | </map> | ||
4035 | <key>InventorySortOrder</key> | 4046 | <key>InventorySortOrder</key> |
4036 | <map> | 4047 | <map> |
4037 | <key>Comment</key> | 4048 | <key>Comment</key> |
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index 70c4ead..5407f06 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp | |||
@@ -281,7 +281,28 @@ void LLFolderViewItem::refreshFromListener() | |||
281 | { | 281 | { |
282 | if(mListener) | 282 | if(mListener) |
283 | { | 283 | { |
284 | //Super crazy hack to build the creator search label - RK | ||
285 | LLInventoryItem* item = gInventory.getItem(mListener->getUUID()); | ||
286 | std::string creator_name; | ||
287 | if(item) | ||
288 | { | ||
289 | if(item->getCreatorUUID().notNull()) | ||
290 | { | ||
291 | gCacheName->getFullName(item->getCreatorUUID(), creator_name); | ||
292 | } | ||
293 | } | ||
294 | mLabelCreator = creator_name; | ||
295 | /*if(creator_name == "(Loading...)") | ||
296 | mLabelCreator = ""; | ||
297 | else | ||
298 | mLabelCreator = creator_name;*/ | ||
299 | |||
300 | //Label for name search | ||
284 | mLabel = mListener->getDisplayName(); | 301 | mLabel = mListener->getDisplayName(); |
302 | |||
303 | //Build label for combined search - RK | ||
304 | mLabelAll = mLabel + " " + mLabelCreator; | ||
305 | |||
285 | setIcon(mListener->getIcon()); | 306 | setIcon(mListener->getIcon()); |
286 | time_t creation_date = mListener->getCreationDate(); | 307 | time_t creation_date = mListener->getCreationDate(); |
287 | if (mCreationDate != creation_date) | 308 | if (mCreationDate != creation_date) |
@@ -299,12 +320,26 @@ void LLFolderViewItem::refresh() | |||
299 | refreshFromListener(); | 320 | refreshFromListener(); |
300 | 321 | ||
301 | std::string searchable_label(mLabel); | 322 | std::string searchable_label(mLabel); |
323 | std::string searchable_label_creator(mLabelCreator); | ||
324 | std::string searchable_label_all(mLabelAll); | ||
325 | |||
326 | //add the (no modify), (no transfer) etc stuff to each label. | ||
302 | searchable_label.append(mLabelSuffix); | 327 | searchable_label.append(mLabelSuffix); |
328 | searchable_label_creator.append(mLabelSuffix); | ||
329 | searchable_label_all.append(mLabelSuffix); | ||
330 | |||
331 | //all labels need to be uppercase. | ||
303 | LLStringUtil::toUpper(searchable_label); | 332 | LLStringUtil::toUpper(searchable_label); |
333 | LLStringUtil::toUpper(searchable_label_creator); | ||
334 | LLStringUtil::toUpper(searchable_label_all); | ||
304 | 335 | ||
305 | if (mSearchableLabel.compare(searchable_label)) | 336 | if (mSearchableLabel.compare(searchable_label) || |
337 | mSearchableLabelCreator.compare(searchable_label_creator)) | ||
306 | { | 338 | { |
307 | mSearchableLabel.assign(searchable_label); | 339 | mSearchableLabel.assign(searchable_label); |
340 | mSearchableLabelCreator.assign(searchable_label_creator); | ||
341 | mSearchableLabelAll.assign(searchable_label_all); | ||
342 | |||
308 | dirtyFilter(); | 343 | dirtyFilter(); |
309 | // some part of label has changed, so overall width has potentially changed | 344 | // some part of label has changed, so overall width has potentially changed |
310 | if (mParentFolder) | 345 | if (mParentFolder) |
@@ -588,7 +623,13 @@ void LLFolderViewItem::rename(const std::string& new_name) | |||
588 | 623 | ||
589 | const std::string& LLFolderViewItem::getSearchableLabel() const | 624 | const std::string& LLFolderViewItem::getSearchableLabel() const |
590 | { | 625 | { |
591 | return mSearchableLabel; | 626 | U32 search_type = gSavedSettings.getU32("InventorySearchType"); |
627 | if(search_type == 4) | ||
628 | return mSearchableLabelAll; | ||
629 | else if(search_type == 1) | ||
630 | return mSearchableLabelCreator; | ||
631 | else | ||
632 | return mSearchableLabel; | ||
592 | } | 633 | } |
593 | 634 | ||
594 | const std::string& LLFolderViewItem::getName( void ) const | 635 | const std::string& LLFolderViewItem::getName( void ) const |
diff --git a/linden/indra/newview/llfolderview.h b/linden/indra/newview/llfolderview.h index 3c350d4..25b4362 100644 --- a/linden/indra/newview/llfolderview.h +++ b/linden/indra/newview/llfolderview.h | |||
@@ -338,6 +338,11 @@ protected: | |||
338 | 338 | ||
339 | std::string mLabel; | 339 | std::string mLabel; |
340 | std::string mSearchableLabel; | 340 | std::string mSearchableLabel; |
341 | std::string mLabelAll; | ||
342 | std::string mSearchableLabelAll; | ||
343 | std::string mLabelCreator; | ||
344 | std::string mSearchableLabelCreator; | ||
345 | |||
341 | std::string mType; | 346 | std::string mType; |
342 | S32 mLabelWidth; | 347 | S32 mLabelWidth; |
343 | U32 mCreationDate; | 348 | U32 mCreationDate; |
diff --git a/linden/indra/newview/llinventoryactions.cpp b/linden/indra/newview/llinventoryactions.cpp index 0bf3ab2..2ee7307 100644 --- a/linden/indra/newview/llinventoryactions.cpp +++ b/linden/indra/newview/llinventoryactions.cpp | |||
@@ -464,6 +464,40 @@ class LLDoCreateFloater : public inventory_listener_t | |||
464 | } | 464 | } |
465 | }; | 465 | }; |
466 | 466 | ||
467 | //Handles the search type buttons | ||
468 | class SetSearchType : public inventory_listener_t | ||
469 | { | ||
470 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
471 | { | ||
472 | std::string search_type = userdata.asString(); | ||
473 | if(search_type == "name") | ||
474 | { | ||
475 | gSavedSettings.setU32("InventorySearchType", 0); | ||
476 | |||
477 | mPtr->getControl("Inventory.SearchByName")->setValue(TRUE); | ||
478 | mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); | ||
479 | mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE); | ||
480 | } | ||
481 | else if(search_type == "creator") | ||
482 | { | ||
483 | gSavedSettings.setU32("InventorySearchType", 1); | ||
484 | |||
485 | mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); | ||
486 | mPtr->getControl("Inventory.SearchByCreator")->setValue(TRUE); | ||
487 | mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE); | ||
488 | } | ||
489 | else if(search_type == "all") | ||
490 | { | ||
491 | gSavedSettings.setU32("InventorySearchType", 4); | ||
492 | |||
493 | mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); | ||
494 | mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); | ||
495 | mPtr->getControl("Inventory.SearchByAll")->setValue(TRUE); | ||
496 | } | ||
497 | return true; | ||
498 | } | ||
499 | }; | ||
500 | |||
467 | class LLSetSortBy : public inventory_listener_t | 501 | class LLSetSortBy : public inventory_listener_t |
468 | { | 502 | { |
469 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 503 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) |
@@ -711,6 +745,8 @@ void init_inventory_actions(LLInventoryView *floater) | |||
711 | (new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters"); | 745 | (new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters"); |
712 | (new LLResetFilter())->registerListener(floater, "Inventory.ResetFilter"); | 746 | (new LLResetFilter())->registerListener(floater, "Inventory.ResetFilter"); |
713 | (new LLSetSortBy())->registerListener(floater, "Inventory.SetSortBy"); | 747 | (new LLSetSortBy())->registerListener(floater, "Inventory.SetSortBy"); |
748 | |||
749 | (new SetSearchType())->registerListener(floater, "Inventory.SetSearchBy"); | ||
714 | } | 750 | } |
715 | 751 | ||
716 | void init_inventory_panel_actions(LLInventoryPanel *panel) | 752 | void init_inventory_panel_actions(LLInventoryPanel *panel) |
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 0f1eb2b..cc89ee1 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp | |||
@@ -521,6 +521,15 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
521 | addBoolControl("Inventory.FoldersAlwaysByName", sort_folders_by_name ); | 521 | addBoolControl("Inventory.FoldersAlwaysByName", sort_folders_by_name ); |
522 | addBoolControl("Inventory.SystemFoldersToTop", sort_system_folders_to_top ); | 522 | addBoolControl("Inventory.SystemFoldersToTop", sort_system_folders_to_top ); |
523 | 523 | ||
524 | //Search Controls | ||
525 | U32 search_type = gSavedSettings.getU32("InventorySearchType"); | ||
526 | BOOL search_by_name = (search_type == 0); | ||
527 | |||
528 | addBoolControl("Inventory.SearchByName", search_by_name); | ||
529 | addBoolControl("Inventory.SearchByCreator", !search_by_name); | ||
530 | |||
531 | addBoolControl("Inventory.SearchByAll", !search_by_name); | ||
532 | |||
524 | mSavedFolderState = new LLSaveFolderState(); | 533 | mSavedFolderState = new LLSaveFolderState(); |
525 | mSavedFolderState->setApply(FALSE); | 534 | mSavedFolderState->setApply(FALSE); |
526 | 535 | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml index 3d1c569..f0c97f2 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml | |||
@@ -205,5 +205,23 @@ | |||
205 | <on_click filter="" function="Inventory.SetSortBy" userdata="systemfolderstotop" /> | 205 | <on_click filter="" function="Inventory.SetSortBy" userdata="systemfolderstotop" /> |
206 | </menu_item_check> | 206 | </menu_item_check> |
207 | </menu> | 207 | </menu> |
208 | <menu bottom_delta="64" drop_shadow="true" height="49" | ||
209 | label="Search" left="0" mouse_opaque="false" name="Sort" opaque="true" | ||
210 | tear_off="true" width="118"> | ||
211 | <menu_item_check bottom_delta="-18" control_name="Inventory.SearchByName" height="18" | ||
212 | label="By Name" left="0" mouse_opaque="true" name="By Name" width="118"> | ||
213 | <on_click filter="" function="Inventory.SetSearchBy" userdata="name" /> | ||
214 | </menu_item_check> | ||
215 | <menu_item_check bottom_delta="-18" control_name="Inventory.SearchByCreator" height="18" | ||
216 | label="By Creator" left="0" mouse_opaque="true" name="By Creator" width="118"> | ||
217 | <on_click filter="" function="Inventory.SetSearchBy" userdata="creator" /> | ||
218 | </menu_item_check> | ||
219 | <menu_item_separator bottom_delta="-8" height="8" left="0" mouse_opaque="true" name="separator" | ||
220 | width="118" /> | ||
221 | <menu_item_check bottom_delta="-18" control_name="Inventory.SearchByAll" height="18" | ||
222 | label="By All" left="0" mouse_opaque="true" name="By All" width="118"> | ||
223 | <on_click filter="" function="Inventory.SetSearchBy" userdata="all" /> | ||
224 | </menu_item_check> | ||
225 | </menu> | ||
208 | </menu_bar> | 226 | </menu_bar> |
209 | </floater> | 227 | </floater> |