diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelclassified.cpp | 73 | ||||
-rw-r--r-- | indra/newview/llpanelclassified.h | 24 | ||||
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 50 | ||||
-rw-r--r-- | indra/newview/llpanelpicks.h | 4 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_classified_info.xml | 8 |
6 files changed, 97 insertions, 68 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index b118c6813c..f03e7da2ec 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1147,11 +1147,9 @@ void LLPanelClassified::setDefaultAccessCombo() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - -std::string SET_LOCATION_NOTICE1("(will update after save)"); - LLPanelClassifiedInfo::LLPanelClassifiedInfo() : LLPanel() + , mInfoLoaded(false) { } @@ -1204,6 +1202,7 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); + setInfoLoaded(false); } void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType type) @@ -1211,19 +1210,25 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t if(APT_CLASSIFIED_INFO == type) { LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data); - if(data && getClassifiedId() == c_info->classified_id) + if(c_info && getClassifiedId() == c_info->classified_id) { setClassifiedName(c_info->name); setDescription(c_info->description); setSnapshotId(c_info->snapshot_id); + setParcelId(c_info->parcel_id); setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); childSetValue("category", LLClassifiedInfo::sCategories[c_info->category]); + static std::string mature_str = getString("type_mature"); + static std::string pg_str = getString("type_pg"); + bool mature = is_cf_mature(c_info->flags); - childSetValue("content_type", mature ? "Mature" : "PG Content"); + childSetValue("content_type", mature ? mature_str : pg_str); childSetValue("auto_renew", is_cf_auto_renew(c_info->flags)); childSetTextArg("price_for_listing", "[PRICE]", llformat("%d", c_info->price_for_listing)); + + setInfoLoaded(true); } } } @@ -1240,6 +1245,9 @@ void LLPanelClassifiedInfo::resetData() void LLPanelClassifiedInfo::resetControls() { + childSetValue("category", LLStringUtil::null); + childSetValue("content_type", LLStringUtil::null); + if(getAvatarId() == gAgent.getID()) { childSetEnabled("edit_btn", TRUE); @@ -1327,9 +1335,12 @@ void LLPanelClassifiedInfo::onExit() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +static const S32 CB_ITEM_MATURE = 0; +static const S32 CB_ITEM_PG = 1; +static std::string SET_LOCATION_NOTICE("(will update after save)"); + LLPanelClassifiedEdit::LLPanelClassifiedEdit() : LLPanelClassifiedInfo() - , mSnapshotCtrl(NULL) , mNewClassified(false) { } @@ -1350,8 +1361,8 @@ BOOL LLPanelClassifiedEdit::postBuild() { LLPanelClassifiedInfo::postBuild(); - mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot"); - mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onSnapshotChanged, this, _1)); + LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("classified_snapshot"); + snapshot->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); LLLineEditor* line_edit = getChild<LLLineEditor>("classified_name"); line_edit->setKeystrokeCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); @@ -1365,15 +1376,12 @@ BOOL LLPanelClassifiedEdit::postBuild() iter != LLClassifiedInfo::sCategories.end(); iter++) { - combobox->add(LLTrans::getString(iter->second), (void *)((intptr_t)iter->first), ADD_BOTTOM); + combobox->add(LLTrans::getString(iter->second)); } - - combobox->setCurrentByIndex(0); - combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); - combobox = getChild<LLComboBox>("content_type"); combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); + childSetCommitCallback("content_type", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); childSetCommitCallback("price_for_listing", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); childSetCommitCallback("auto_renew", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); @@ -1417,7 +1425,8 @@ void LLPanelClassifiedEdit::onOpen(const LLSD& key) childSetValue("classified_name", makeClassifiedName()); childSetValue("classified_desc", desc); setSnapshotId(snapshot_id); - setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal())); + setClassifiedLocation(createLocationText(SET_LOCATION_NOTICE, region_name, getPosGlobal())); + // server will set valid parcel id setParcelId(LLUUID::null); enableSaveButton(true); @@ -1431,6 +1440,7 @@ void LLPanelClassifiedEdit::onOpen(const LLSD& key) } resetDirty(); + setInfoLoaded(false); } void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType type) @@ -1438,11 +1448,14 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t if(APT_CLASSIFIED_INFO == type) { LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data); - if(data && getClassifiedId() == c_info->classified_id) + if(c_info && getClassifiedId() == c_info->classified_id) { setClassifiedName(c_info->name); setDescription(c_info->description); setSnapshotId(c_info->snapshot_id); + // setParcelId(c_info->parcel_id); + setPosGlobal(c_info->pos_global); + setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); getChild<LLComboBox>("category")->setCurrentByIndex(c_info->category + 1); getChild<LLComboBox>("category")->resetDirty(); @@ -1450,11 +1463,12 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); bool auto_renew = is_cf_auto_renew(c_info->flags); - getChild<LLComboBox>("content_type")->setCurrentByIndex(mature ? 0 : 1); + getChild<LLComboBox>("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); childSetValue("auto_renew", auto_renew); childSetValue("price_for_listing", c_info->price_for_listing); resetDirty(); + setInfoLoaded(true); } } } @@ -1467,11 +1481,11 @@ BOOL LLPanelClassifiedEdit::isDirty() const BOOL dirty = false; dirty |= LLPanelClassifiedInfo::isDirty(); - dirty |= mSnapshotCtrl->isDirty(); - dirty |= getChild<LLLineEditor>("classified_name")->isDirty(); - dirty |= getChild<LLTextEditor>("classified_desc")->isDirty(); - dirty |= getChild<LLComboBox>("category")->isDirty(); - dirty |= getChild<LLComboBox>("content_type")->isDirty(); + dirty |= getChild<LLUICtrl>("classified_snapshot")->isDirty(); + dirty |= getChild<LLUICtrl>("classified_name")->isDirty(); + dirty |= getChild<LLUICtrl>("classified_desc")->isDirty(); + dirty |= getChild<LLUICtrl>("category")->isDirty(); + dirty |= getChild<LLUICtrl>("content_type")->isDirty(); dirty |= getChild<LLUICtrl>("auto_renew")->isDirty(); dirty |= getChild<LLUICtrl>("price_for_listing")->isDirty(); @@ -1481,7 +1495,7 @@ BOOL LLPanelClassifiedEdit::isDirty() const void LLPanelClassifiedEdit::resetDirty() { LLPanelClassifiedInfo::resetDirty(); - mSnapshotCtrl->resetDirty(); + getChild<LLUICtrl>("classified_snapshot")->resetDirty(); getChild<LLUICtrl>("classified_name")->resetDirty(); getChild<LLUICtrl>("classified_desc")->resetDirty(); getChild<LLUICtrl>("category")->resetDirty(); @@ -1546,7 +1560,7 @@ U8 LLPanelClassifiedEdit::getClassifiedFlags() bool auto_renew = childGetValue("auto_renew").asBoolean(); LLComboBox* content_cb = getChild<LLComboBox>("content_type"); - bool mature = content_cb->getCurrentIndex() == 0; + bool mature = content_cb->getCurrentIndex() == CB_ITEM_MATURE; return pack_classified_flags_request(auto_renew, false, mature, false);; } @@ -1595,7 +1609,7 @@ void LLPanelClassifiedEdit::onClickSetLocation() region_name = region->getName(); } - setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal())); + setClassifiedLocation(createLocationText(SET_LOCATION_NOTICE, region_name, getPosGlobal())); // mark classified as dirty setValue(LLSD()); @@ -1603,11 +1617,6 @@ void LLPanelClassifiedEdit::onClickSetLocation() onClassifiedChanged(); } -void LLPanelClassifiedEdit::onSnapshotChanged(LLUICtrl* ctrl) -{ - -} - void LLPanelClassifiedEdit::onClassifiedChanged() { if(isDirty()) @@ -1623,12 +1632,6 @@ void LLPanelClassifiedEdit::onClassifiedChanged() void LLPanelClassifiedEdit::onClickSave() { sendUpdate(); - -// LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(getAvatarId()); - - LLSD params; - params["action"] = "save_classified"; - notifyParent(params); } //EOF diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index eccc83cf53..7e384824ab 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -208,8 +208,6 @@ public: virtual ~LLPanelClassifiedInfo(); - virtual void setExitCallback(const commit_callback_t& cb); - /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ BOOL postBuild(); @@ -218,7 +216,7 @@ public: virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; } - LLUUID& getAvatarId() { return mAvatarId; } + virtual LLUUID& getAvatarId() { return mAvatarId; } virtual void setSnapshotId(const LLUUID& id); @@ -242,6 +240,16 @@ public: virtual LLVector3d& getPosGlobal() { return mPosGlobal; } + virtual void setParcelId(const LLUUID& id) { mParcelId = id; } + + virtual LLUUID getParcelId() { return mParcelId; } + + virtual bool getInfoLoaded() { return mInfoLoaded; } + + virtual void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; } + + virtual void setExitCallback(const commit_callback_t& cb); + protected: LLPanelClassifiedInfo(); @@ -265,6 +273,8 @@ private: LLUUID mAvatarId; LLUUID mClassifiedId; LLVector3d mPosGlobal; + LLUUID mParcelId; + bool mInfoLoaded; }; class LLPanelClassifiedEdit : public LLPanelClassifiedInfo @@ -305,23 +315,15 @@ protected: std::string makeClassifiedName(); - void setParcelId(const LLUUID& id) { mParcelId = id; } - - LLUUID getParcelId() { return mParcelId; } - S32 getPriceForListing(); U8 getClassifiedFlags(); void onClickSetLocation(); - void onSnapshotChanged(LLUICtrl* ctrl); void onClassifiedChanged(); void onClickSave(); private: - LLTextureCtrl* mSnapshotCtrl; - - LLUUID mParcelId; bool mNewClassified; }; diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 7b7667c147..2129fe473a 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -73,9 +73,19 @@ static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks("panel_picks"); ////////////////////////////////////////////////////////////////////////// +/** + * Copy&Pasted from old LLPanelClassified. This class does nothing at the moment. + * Subscribing to "classifiedclickthrough" removes a few warnings. + */ class LLClassifiedClickThrough : public LLDispatchHandler { public: + + // "classifiedclickthrough" + // strings[0] = classified_id + // strings[1] = teleport_clicks + // strings[2] = map_clicks + // strings[3] = profile_clicks virtual bool operator()( const LLDispatcher* dispatcher, const std::string& key, @@ -85,15 +95,6 @@ public: if (strings.size() != 4) return false; - // LLUUID classified_id(strings[0]); - // S32 teleport_clicks = atoi(strings[1].c_str()); - // S32 map_clicks = atoi(strings[2].c_str()); - // S32 profile_clicks = atoi(strings[3].c_str()); - // LLPanelClassified::setClickThrough(classified_id, teleport_clicks, - // map_clicks, - // profile_clicks, - // false); - return true; } }; @@ -115,10 +116,11 @@ LLPanelPicks::LLPanelPicks() mPicksAccTab(NULL), mClassifiedsAccTab(NULL), mPanelClassifiedInfo(NULL), - mPanelClassifiedEdit(NULL) + mPanelClassifiedEdit(NULL), + mClickThroughDisp(NULL) { - gGenericDispatcher.addHandler("classifiedclickthrough", - new LLClassifiedClickThrough()); + mClickThroughDisp = new LLClassifiedClickThrough(); + gGenericDispatcher.addHandler("classifiedclickthrough", mClickThroughDisp); } LLPanelPicks::~LLPanelPicks() @@ -127,6 +129,8 @@ LLPanelPicks::~LLPanelPicks() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } + + delete mClickThroughDisp; } void* LLPanelPicks::create(void* data /* = NULL */) @@ -693,14 +697,26 @@ void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) LLSD c_value; c_value.insert(CLASSIFIED_ID, c_item->getClassifiedId()); c_value.insert(CLASSIFIED_NAME, c_item->getClassifiedName()); - mClassifiedsList->addItem(c_item, c_value); + mClassifiedsList->addItem(c_item, c_value, ADD_TOP); c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1)); c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4)); c_item->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this)); c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this)); } - else + else + { + onPanelClassifiedClose(panel); + return; + } + + onPanelPickClose(panel); + updateButtons(); +} + +void LLPanelPicks::onPanelClassifiedClose(LLPanelClassifiedInfo* panel) +{ + if(panel->getInfoLoaded()) { std::vector<LLSD> values; mClassifiedsList->getValues(values); @@ -739,7 +755,7 @@ void LLPanelPicks::createClassifiedInfoPanel() if(!mPanelClassifiedInfo) { mPanelClassifiedInfo = LLPanelClassifiedInfo::create(); - mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedInfo)); + mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedInfo)); mPanelClassifiedInfo->setVisible(FALSE); } } @@ -749,9 +765,9 @@ void LLPanelPicks::createClassifiedEditPanel() if(!mPanelClassifiedEdit) { mPanelClassifiedEdit = LLPanelClassifiedEdit::create(); - mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedEdit)); mPanelClassifiedEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelClassifiedSave, this, mPanelClassifiedEdit)); - mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedEdit)); mPanelClassifiedEdit->setVisible(FALSE); } } diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index b30036c603..68ad2436ee 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -55,6 +55,7 @@ class LLPanelPickEdit; class LLToggleableMenu; class LLPanelClassifiedInfo; class LLPanelClassifiedEdit; +class LLClassifiedClickThrough; class LLPanelPicks : public LLPanelProfileTab @@ -101,6 +102,7 @@ private: void onPanelPickClose(LLPanel* panel); void onPanelPickSave(LLPanel* panel); void onPanelClassifiedSave(LLPanelClassifiedEdit* panel); + void onPanelClassifiedClose(LLPanelClassifiedInfo* panel); void onPanelPickEdit(); void onPanelClassifiedEdit(); void onClickMenuEdit(); @@ -146,6 +148,8 @@ private: LLAccordionCtrlTab* mPicksAccTab; LLAccordionCtrlTab* mClassifiedsAccTab; + + LLClassifiedClickThrough* mClickThroughDisp; }; class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b0a71f1ebe..02f45c1b48 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -243,10 +243,6 @@ void LLPanelProfile::notifyParent(const LLSD& info) onOpen(info); return; } - else if("save_classified" == action) - { - // onOpen(info); - return; - } + LLPanel::notifyParent(info); } diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml index b7a54a7eea..bdca8531dc 100644 --- a/indra/newview/skins/default/xui/en/panel_classified_info.xml +++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml @@ -9,6 +9,14 @@ name="panel_classified_info" top="0" width="333"> + <panel.string + name="type_mature"> + Mature + </panel.string> + <panel.string + name="type_pg"> + PG Content + </panel.string> <button follows="top|right" height="23" |