From b46ba199fffbcbf70a42b28d2fa6b72d38d77771 Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Tue, 11 May 2010 11:34:36 +0300 Subject: EXT-7075 FIXED Map button now is always enabled and shows current user location if no other item is selected - Added new pure virtual member function isSingleItemSelected() to the LLPanelPlacesTab. It is used in the LLPanelPlaces class inside onShowOnMapButtonClicked() to check if something was selected on the active panel. If so then selection is shown on the world map. Otherwise current agent position is shown on the world map. - Implemented isSingleItemSelected() in the both LLPanelPlacesTab derived classes: LLLandmarksPanel and LLTeleportHistoryPanel - Removed functionality which disables Map button if no selection is made Reviewed by Sergey Litovchuk at https://codereview.productengine.com/secondlife/r/355/ --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 0a978d1b26..bcc852cf4c 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -308,6 +308,25 @@ void LLLandmarksPanel::onTeleport() } } +// virtual +bool LLLandmarksPanel::isSingleItemSelected() +{ + bool result = false; + + if (mCurrentSelectedList != NULL) + { + LLPlacesFolderView* root_view = + static_cast(mCurrentSelectedList->getRootFolder()); + + if (root_view->getSelectedCount() == 1) + { + result = isLandmarkSelected(); + } + } + + return result; +} + // virtual void LLLandmarksPanel::updateVerbs() { @@ -316,8 +335,8 @@ void LLLandmarksPanel::updateVerbs() bool landmark_selected = isLandmarkSelected(); mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport")); - mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map")); mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info")); + mShowOnMapBtn->setEnabled(true); // TODO: mantipov: Uncomment when mShareBtn is supported // Share button should be enabled when neither a folder nor a landmark is selected -- cgit v1.3 From 1d6ebfbb573bca573c60d666d12a401c1f21d37d Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 13 May 2010 16:53:29 -0400 Subject: EXT-4088 : FIXED : INFRASTRUCTURE : Change LLFolderView::getSelectionList to return a selection Function signature change to return a selection instead of taking one as an argument. --- indra/newview/llfolderview.cpp | 9 ++++----- indra/newview/llfolderview.h | 2 +- indra/newview/llfolderviewitem.cpp | 6 ++++++ indra/newview/llfolderviewitem.h | 2 +- indra/newview/llinventorypanel.cpp | 6 ++---- indra/newview/llpanellandmarks.cpp | 4 ++-- indra/newview/llpanelmaininventory.cpp | 3 +-- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/llpaneloutfitsinventory.cpp | 9 +++------ indra/newview/llsidepanelinventory.cpp | 3 +-- indra/newview/llviewermessage.cpp | 5 ++--- 11 files changed, 24 insertions(+), 27 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index eba4cdfa31..2ae11aa2b5 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -846,16 +846,16 @@ void LLFolderView::clearSelection() mSelectThisID.setNull(); } -BOOL LLFolderView::getSelectionList(std::set &selection) const +std::set LLFolderView::getSelectionList() const { + std::set selection; for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { selection.insert((*item_it)->getListener()->getUUID()); } - - return (selection.size() != 0); + return selection; } BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) @@ -2070,8 +2070,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata) } - std::set selected_items; - getSelectionList(selected_items); + std::set selected_items = getSelectionList(); LLMultiPreview* multi_previewp = NULL; LLMultiProperties* multi_propertiesp = NULL; diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 38d7a47eba..0dfdbd364b 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -164,7 +164,7 @@ public: virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items); - virtual BOOL getSelectionList(std::set &selection) const; + virtual std::set getSelectionList() const; // make sure if ancestor is selected, descendents are not void sanitizeSelection(); diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index fd5fafdfe5..54e9bd5383 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -387,6 +387,12 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection) getRoot()->extendSelection(selection, NULL, selected_items); } +std::set LLFolderViewItem::getSelectionList() const +{ + std::set selection; + return selection; +} + EInventorySortGroup LLFolderViewItem::getSortGroup() const { return SG_ITEM; diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 655ad89e99..57c722afa4 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -231,7 +231,7 @@ public: virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items){ return FALSE; } // gets multiple-element selection - virtual BOOL getSelectionList(std::set &selection) const {return TRUE;} + virtual std::set getSelectionList() const; // Returns true is this object and all of its children can be removed (deleted by user) virtual BOOL isRemovable(); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index dd1e039cb1..000bcdd265 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -775,8 +775,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata) bool LLInventoryPanel::beginIMSession() { - std::set selected_items; - mFolderRoot->getSelectionList(selected_items); + std::set selected_items = mFolderRoot->getSelectionList(); std::string name; static int session_num = 1; @@ -873,8 +872,7 @@ bool LLInventoryPanel::beginIMSession() bool LLInventoryPanel::attachObject(const LLSD& userdata) { - std::set selected_items; - mFolderRoot->getSelectionList(selected_items); + std::set selected_items = mFolderRoot->getSelectionList(); std::string joint_name = userdata.asString(); LLViewerJointAttachment* attachmentp = NULL; diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index bcc852cf4c..6634bc948d 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -993,8 +993,8 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const } else if("create_pick" == command_name) { - std::set selection; - if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) ) + std::set selection = mCurrentSelectedList->getRootFolder()->getSelectionList(); + if ( mCurrentSelectedList && !selection.empty() ) { return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() ); } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index a84280c213..327196d9ba 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1099,8 +1099,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) if (root) { can_delete = TRUE; - std::set selection_set; - root->getSelectionList(selection_set); + std::set selection_set = root->getSelectionList(); if (selection_set.empty()) return FALSE; for (std::set::iterator iter = selection_set.begin(); iter != selection_set.end(); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 6a112f35dd..de16f9d343 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1489,7 +1489,7 @@ void LLPanelObjectInventory::updateInventory() BOOL inventory_has_focus = FALSE; if (mHaveInventory) { - mFolders->getSelectionList(selected_items); + selected_items = mFolders->getSelectionList(); inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders); } diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 111894b31c..660615df5a 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -493,8 +493,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) LLFolderView* root = getActivePanel()->getRootFolder(); if (root) { - std::set selection_set; - root->getSelectionList(selection_set); + std::set selection_set = root->getSelectionList(); can_delete = (selection_set.size() > 0); for (std::set::iterator iter = selection_set.begin(); iter != selection_set.end(); @@ -515,8 +514,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) LLFolderView* root = getActivePanel()->getRootFolder(); if (root) { - std::set selection_set; - root->getSelectionList(selection_set); + std::set selection_set = root->getSelectionList(); can_delete = (selection_set.size() > 0); for (std::set::iterator iter = selection_set.begin(); iter != selection_set.end(); @@ -568,8 +566,7 @@ bool LLPanelOutfitsInventory::hasItemsSelected() LLFolderView* root = getActivePanel()->getRootFolder(); if (root) { - std::set selection_set; - root->getSelectionList(selection_set); + std::set selection_set = root->getSelectionList(); has_items_selected = (selection_set.size() > 0); } } diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index fa543f1371..65b9184fe5 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -323,8 +323,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild("panel_main_inventory"); - std::set selection_list; - panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(selection_list); + std::set selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); return selection_list.size(); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 28c1a1ad3a..4b7c7f297b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -796,7 +796,7 @@ private: mSelectedItems.clear(); if (mActivePanel) { - mActivePanel->getRootFolder()->getSelectionList(mSelectedItems); + mSelectedItems = mActivePanel->getRootFolder()->getSelectionList(); } mSelectedItems.erase(mMoveIntoFolderID); } @@ -829,8 +829,7 @@ private: } // get selected items (without destination folder) - selected_items_t selected_items; - mActivePanel->getRootFolder()->getSelectionList(selected_items); + selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList(); selected_items.erase(mMoveIntoFolderID); // compare stored & current sets of selected items -- cgit v1.3 From d9f519d55c4b5cff0fa56d2130a7e25a144be9ff Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 14 May 2010 11:27:29 -0400 Subject: EXT-4088 FIXED (INFRASTRUCTURE) Change LLFolderView::getSelectionList to return a selection Fixed issue where mCurrentSelectedList was being used before NULL check. --- indra/newview/llpanellandmarks.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 6634bc948d..4bf4f9eac1 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -993,10 +993,13 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const } else if("create_pick" == command_name) { - std::set selection = mCurrentSelectedList->getRootFolder()->getSelectionList(); - if ( mCurrentSelectedList && !selection.empty() ) + if (mCurrentSelectedList) { - return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() ); + std::set selection = mCurrentSelectedList->getRootFolder()->getSelectionList(); + if (!selection.empty()) + { + return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() ); + } } return false; } -- cgit v1.3 From 4ac34230c125e070ba4a78a76d875595e9f7054e Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Wed, 2 Jun 2010 18:19:41 +0300 Subject: EXT-6744 FIX add settigns variable "LandmarksSortedByDate" reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/489/ --HG-- branch : product-engine --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llpanellandmarks.cpp | 18 ++++++++++-------- indra/newview/llpanellandmarks.h | 1 - 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 532ce69e41..e86f50ce20 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11362,5 +11362,16 @@ mini_map + LandmarksSortedByDate + + Comment + Reflects landmarks panel sorting order. + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 4bf4f9eac1..7fb46fc84f 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -221,8 +221,6 @@ BOOL LLLandmarksPanel::postBuild() // mast be called before any other initXXX methods to init Gear menu initListCommandsHandlers(); - U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER); - mSortByDate = sort_order & LLInventoryFilter::SO_DATE; initFavoritesInventoryPanel(); initLandmarksInventoryPanel(); initMyInventoryPanel(); @@ -607,7 +605,8 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, inventory_list, _1, _2)); inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - updateSortOrder(inventory_list, mSortByDate); + bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); + updateSortOrder(inventory_list, sorting_order); LLPlacesFolderView* root_folder = dynamic_cast(inventory_list->getRootFolder()); if (root_folder) @@ -875,10 +874,12 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) } else if ("sort_by_date" == command_name) { - mSortByDate = !mSortByDate; - updateSortOrder(mLandmarksInventoryPanel, mSortByDate); - updateSortOrder(mMyInventoryPanel, mSortByDate); - updateSortOrder(mLibraryInventoryPanel, mSortByDate); + bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); + sorting_order=!sorting_order; + gSavedSettings.setBOOL("LandmarksSortedByDate",sorting_order); + updateSortOrder(mLandmarksInventoryPanel, sorting_order); + updateSortOrder(mMyInventoryPanel, sorting_order); + updateSortOrder(mLibraryInventoryPanel, sorting_order); } else { @@ -895,7 +896,8 @@ bool LLLandmarksPanel::isActionChecked(const LLSD& userdata) const if ( "sort_by_date" == command_name) { - return mSortByDate; + bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); + return sorting_order; } return false; diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h index 8f8d9c2708..0e70c72f11 100644 --- a/indra/newview/llpanellandmarks.h +++ b/indra/newview/llpanellandmarks.h @@ -167,7 +167,6 @@ private: LLInventoryObserver* mInventoryObserver; LLPanel* mListCommands; - bool mSortByDate; typedef std::vector accordion_tabs_t; accordion_tabs_t mAccordionTabs; -- cgit v1.3