diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-05-07 16:52:20 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-05-07 16:52:20 +0100 |
commit | ebc6b168309a8b7b301f73b8a38766a68aa464c1 (patch) | |
tree | d9abc6b073475c16eb5ca67515d6a34aabb59866 | |
parent | 3b2073270b2702a682b655c470ecae310822c29e (diff) | |
parent | 95fd6cf0dce75662f011d58be3faf3c35ce45372 (diff) |
merge from viewer-public
-rw-r--r-- | indra/newview/llcofwearables.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.cpp | 68 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.h | 6 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 112 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.h | 17 |
5 files changed, 46 insertions, 168 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 1925b818f2..29c32b6fa2 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -199,8 +199,8 @@ LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventory //setting callbacks //*TODO move that item panel's inner structure disclosing stuff into the panels item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable); - item_panel->childSetAction("btn_move_up", mCOFCallbacks.mMoveWearableCloser); - item_panel->childSetAction("btn_move_down", mCOFCallbacks.mMoveWearableFurther); + item_panel->childSetAction("btn_move_up", mCOFCallbacks.mMoveWearableFurther); + item_panel->childSetAction("btn_move_down", mCOFCallbacks.mMoveWearableCloser); item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable); //turning on gray separator line for the last item in the items group of the same wearable type @@ -243,11 +243,12 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]); - for (U32 i = 0; i < size; i++) + //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body) + for (U32 i = size; i != 0; --i) { - LLViewerInventoryItem* item = clothing_by_type[type][i]; + LLViewerInventoryItem* item = clothing_by_type[type][i-1]; - LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == 0, i == size - 1); + LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == size, i == 1); if (!item_panel) continue; mClothing->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index c00b6a4147..39833a7201 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -92,8 +92,7 @@ LLPanelGroup::LLPanelGroup() : LLPanel(), LLGroupMgrObserver( LLUUID() ), mSkipRefresh(FALSE), - mButtonJoin(NULL), - mShowingNotifyDialog(false) + mButtonJoin(NULL) { // Set up the factory callbacks. // Roles sub tabs @@ -629,69 +628,4 @@ void LLPanelGroup::showNotice(const std::string& subject, } -bool LLPanelGroup::canClose() -{ - if(getVisible() == false) - return true; - - bool need_save = false; - std::string mesg; - for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) - if(need_save|=(*it)->needsApply(mesg)) - break; - if(!need_save) - return false; - // If no message was provided, give a generic one. - if (mesg.empty()) - { - mesg = mDefaultNeedsApplyMesg; - } - // Create a notify box, telling the user about the unapplied tab. - LLSD args; - args["NEEDS_APPLY_MESSAGE"] = mesg; - args["WANT_APPLY_MESSAGE"] = mWantApplyMesg; - - LLNotificationsUtil::add("SaveChanges", args, LLSD(), boost::bind(&LLPanelGroup::handleNotifyCallback,this, _1, _2)); - - mShowingNotifyDialog = true; - - return false; -} - -bool LLPanelGroup::notifyChildren(const LLSD& info) -{ - if(info.has("request") && mID.isNull() ) - { - std::string str_action = info["request"]; - - if (str_action == "quit" ) - { - canClose(); - return true; - } - if(str_action == "wait_quit") - return mShowingNotifyDialog; - } - return false; -} -bool LLPanelGroup::handleNotifyCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - mShowingNotifyDialog = false; - switch (option) - { - case 0: // "Apply Changes" - apply(); - break; - case 1: // "Ignore Changes" - break; - case 2: // "Cancel" - default: - // Do nothing. The user is canceling the action. - // If we were quitting, we didn't really mean it. - LLAppViewer::instance()->abortQuit(); - break; - } - return false; -} diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 359f252383..13a03b0713 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -95,9 +95,6 @@ public: LLOfferInfo* inventory_offer); - bool notifyChildren (const LLSD& info); - bool handleNotifyCallback(const LLSD&, const LLSD&); - protected: virtual void update(LLGroupChange gc); @@ -117,9 +114,6 @@ protected: protected: bool apply(LLPanelGroupTab* tab); - bool canClose(); - - bool mShowingNotifyDialog; LLTimer mRefreshTimer; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index daa41e1467..43c2f01da5 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -77,11 +77,16 @@ const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK; static const std::string SAVE_BTN("save_btn"); static const std::string REVERT_BTN("revert_btn"); -class LLInventoryLookObserver : public LLInventoryObserver +class LLCOFObserver : public LLInventoryObserver { public: - LLInventoryLookObserver(LLPanelOutfitEdit *panel) : mPanel(panel) {} - virtual ~LLInventoryLookObserver() + LLCOFObserver(LLPanelOutfitEdit *panel) : mPanel(panel), + mCOFLastVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + gInventory.addObserver(this); + } + + virtual ~LLCOFObserver() { if (gInventory.containsObserver(this)) { @@ -91,51 +96,43 @@ public: virtual void changed(U32 mask) { - if (mask & (LLInventoryObserver::ADD | LLInventoryObserver::REMOVE)) - { - mPanel->updateLookInfo(); - } + if (!gInventory.isInventoryUsable()) return; + + LLUUID cof = LLAppearanceMgr::getInstance()->getCOF(); + if (cof.isNull()) return; + + LLViewerInventoryCategory* cat = gInventory.getCategory(cof); + if (!cat) return; + + S32 cof_version = cat->getVersion(); + + if (cof_version == mCOFLastVersion) return; + + mCOFLastVersion = cof_version; + + mPanel->update(); } + protected: LLPanelOutfitEdit *mPanel; -}; -class LLLookFetchObserver : public LLInventoryFetchDescendentsObserver -{ -public: - LLLookFetchObserver(LLPanelOutfitEdit *panel) : - mPanel(panel) - {} - LLLookFetchObserver() {} - virtual void done() - { - mPanel->lookFetched(); - if(gInventory.containsObserver(this)) - { - gInventory.removeObserver(this); - } - } -private: - LLPanelOutfitEdit *mPanel; + //last version number of a COF category + S32 mCOFLastVersion; }; LLPanelOutfitEdit::LLPanelOutfitEdit() : LLPanel(), - mCurrentOutfitID(), - mFetchLook(NULL), mSearchFilter(NULL), mCOFWearables(NULL), mInventoryItemsPanel(NULL), - mLookObserver(NULL) + mCOFObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); - mFetchLook = new LLLookFetchObserver(this); - mLookObserver = new LLInventoryLookObserver(this); - gInventory.addObserver(mLookObserver); + mCOFObserver = new LLCOFObserver(this); mLookItemTypes.reserve(NUM_LOOK_ITEM_TYPES); for (U32 i = 0; i < NUM_LOOK_ITEM_TYPES; i++) @@ -149,17 +146,8 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() LLPanelOutfitEdit::~LLPanelOutfitEdit() { delete mSavedFolderState; - if (gInventory.containsObserver(mFetchLook)) - { - gInventory.removeObserver(mFetchLook); - } - delete mFetchLook; - - if (gInventory.containsObserver(mLookObserver)) - { - gInventory.removeObserver(mLookObserver); - } - delete mLookObserver; + + delete mCOFObserver; } BOOL LLPanelOutfitEdit::postBuild() @@ -242,9 +230,6 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body) LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id); LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body); - - //*TODO why not to listen to inventory? - updateLookInfo(); } void LLPanelOutfitEdit::toggleAddWearablesPanel() @@ -360,10 +345,7 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void) LLFolderViewEventListener* listenerp = curr_item->getListener(); if (!listenerp) return; - if (LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID())) - { - updateLookInfo(); - } + LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID()); } @@ -372,8 +354,6 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) LLUUID id_to_remove = mCOFWearables->getSelectedUUID(); LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove); - - updateLookInfo(); } @@ -465,34 +445,13 @@ void LLPanelOutfitEdit::onOutfitItemSelectionChange(void) } } -void LLPanelOutfitEdit::changed(U32 mask) -{ -} - -void LLPanelOutfitEdit::lookFetched(void) +void LLPanelOutfitEdit::update() { mCOFWearables->refresh(); updateVerbs(); } -void LLPanelOutfitEdit::updateLookInfo() -{ - if (getVisible()) - { - mFetchLook->setFetchID(mCurrentOutfitID); - mFetchLook->startFetch(); - if (mFetchLook->isFinished()) - { - mFetchLook->done(); - } - else - { - gInventory.addObserver(mFetchLook); - } - } -} - void LLPanelOutfitEdit::displayCurrentOutfit() { if (!getVisible()) @@ -500,8 +459,6 @@ void LLPanelOutfitEdit::displayCurrentOutfit() setVisible(TRUE); } - mCurrentOutfitID = LLAppearanceMgr::getInstance()->getCOF(); - std::string current_outfit_name; if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name)) { @@ -512,12 +469,15 @@ void LLPanelOutfitEdit::displayCurrentOutfit() mCurrentOutfitName->setText(getString("No Outfit")); } - updateLookInfo(); + update(); } //private void LLPanelOutfitEdit::updateVerbs() { + //*TODO implement better handling of COF dirtiness + LLAppearanceMgr::getInstance()->updateIsDirty(); + bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); childSetEnabled(SAVE_BTN, outfit_is_dirty); diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 0074cd517b..3cdfed14b9 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -48,13 +48,12 @@ class LLButton; class LLCOFWearables; class LLTextBox; class LLInventoryCategory; -class LLInventoryLookObserver; +class LLCOFObserver; class LLInventoryPanel; class LLSaveFolderState; class LLFolderViewItem; class LLScrollListCtrl; class LLToggleableMenu; -class LLLookFetchObserver; class LLFilterEditor; class LLFilteredWearableListManager; @@ -82,11 +81,6 @@ public: /*virtual*/ ~LLPanelOutfitEdit(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void changed(U32 mask); - - /*virtual*/ void setParcelID(const LLUUID& parcel_id); - // Sends a request for data about the given parcel, which will - // only update the location if there is none already available. void moveWearable(bool closer_to_body); @@ -106,16 +100,12 @@ public: void displayCurrentOutfit(); - void lookFetched(void); - - void updateLookInfo(void); + void update(); private: void updateVerbs(); - //*TODO got rid of mCurrentOutfitID - LLUUID mCurrentOutfitID; LLTextBox* mCurrentOutfitName; LLInventoryPanel* mInventoryItemsPanel; @@ -127,8 +117,7 @@ private: LLFilteredWearableListManager* mWearableListManager; - LLLookFetchObserver* mFetchLook; - LLInventoryLookObserver* mLookObserver; + LLCOFObserver* mCOFObserver; std::vector<LLLookItemType> mLookItemTypes; LLCOFWearables* mCOFWearables; |