diff options
-rw-r--r-- | indra/newview/llfloaterexperienceprofile.cpp | 130 | ||||
-rw-r--r-- | indra/newview/llfloaterexperienceprofile.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_experienceprofile.xml | 13 |
3 files changed, 92 insertions, 55 deletions
diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 2a81c6cdec..83b4f1609e 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -275,6 +275,8 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetCommitCallback(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); childSetCommitCallback(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + childSetCommitCallback(EDIT IMG_LOGO, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + getChild<LLTextEditor>(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); @@ -396,6 +398,7 @@ bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* chil void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) { mExperienceDetails = experience; + mPackage = experience; LLLayoutPanel* imagePanel = getChild<LLLayoutPanel>(PNL_IMAGE); @@ -581,7 +584,23 @@ void LLFloaterExperienceProfile::setPreferences( const LLSD& content ) void LLFloaterExperienceProfile::onFieldChanged() { - mDirty=true; + updatePackage(); + + LLSD::map_const_iterator st = mExperienceDetails.beginMap(); + LLSD::map_const_iterator dt = mPackage.beginMap(); + + mDirty = false; + while( !mDirty && st != mExperienceDetails.endMap() && dt != mPackage.endMap()) + { + mDirty = st->first != dt->first || st->second.asString() != dt->second.asString(); + ++st;++dt; + } + + if(!mDirty && (st != mExperienceDetails.endMap() || dt != mPackage.endMap())) + { + mDirty = true; + } + getChild<LLButton>(BTN_SAVE)->setEnabled(mDirty); } @@ -645,60 +664,8 @@ void LLFloaterExperienceProfile::doSave( int success_action ) std::string url=region->getCapability("UpdateExperience"); if(url.empty()) return; - - LLSD package=mExperienceDetails; - - package[LLExperienceCache::NAME] = getChild<LLLineEditor>(EDIT TF_NAME)->getText(); - package[LLExperienceCache::DESCRIPTION] = getChild<LLTextEditor>(EDIT TF_DESC)->getText(); - std::string slurl = getChild<LLTextBox>(EDIT TF_SLURL)->getText(); - if(slurl == getString("empty_slurl")) - { - package[LLExperienceCache::SLURL] = LLStringUtil::null; - } - else - { - package[LLExperienceCache::SLURL] = slurl; - } - - package[LLExperienceCache::MATURITY] = getChild<LLComboBox>(EDIT TF_MATURITY)->getSelectedValue().asInteger(); - - LLSD metadata; - - metadata[TF_MRKT] = getChild<LLLineEditor>(EDIT TF_MRKT)->getText(); - metadata[IMG_LOGO] = getChild<LLTextureCtrl>(EDIT IMG_LOGO)->getImageAssetID(); - - LLPointer<LLSDXMLFormatter> formatter = new LLSDXMLFormatter(); - - std::ostringstream os; - if(formatter->format(metadata, os)) - { - package[LLExperienceCache::METADATA]=os.str(); - } - - int properties = package[LLExperienceCache::PROPERTIES].asInteger(); - LLCheckBoxCtrl* enable = getChild<LLCheckBoxCtrl>(EDIT BTN_ENABLE); - if(enable->get()) - { - properties &= ~LLExperienceCache::PROPERTY_DISABLED; - } - else - { - properties |= LLExperienceCache::PROPERTY_DISABLED; - } - - enable = getChild<LLCheckBoxCtrl>(EDIT BTN_PRIVATE); - if(enable->get()) - { - properties |= LLExperienceCache::PROPERTY_PRIVATE; - } - else - { - properties &= ~LLExperienceCache::PROPERTY_PRIVATE; - } - - package[LLExperienceCache::PROPERTIES] = properties; - - LLHTTPClient::post(url, package, new ExperienceUpdateResponder(getDerivedHandle<LLFloaterExperienceProfile>())); + + LLHTTPClient::post(url, mPackage, new ExperienceUpdateResponder(getDerivedHandle<LLFloaterExperienceProfile>())); } void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content ) @@ -841,3 +808,56 @@ void LLFloaterExperienceProfile::onClose( bool app_quitting ) LLEventPumps::instance().obtain("experience_permission").stopListening(mExperienceId.asString()+"-profile"); LLFloater::onClose(app_quitting); } + +void LLFloaterExperienceProfile::updatePackage() +{ + mPackage[LLExperienceCache::NAME] = getChild<LLLineEditor>(EDIT TF_NAME)->getText(); + mPackage[LLExperienceCache::DESCRIPTION] = getChild<LLTextEditor>(EDIT TF_DESC)->getText(); + std::string slurl = getChild<LLTextBox>(EDIT TF_SLURL)->getText(); + if(slurl == getString("empty_slurl")) + { + mPackage[LLExperienceCache::SLURL] = LLStringUtil::null; + } + else + { + mPackage[LLExperienceCache::SLURL] = slurl; + } + + mPackage[LLExperienceCache::MATURITY] = getChild<LLComboBox>(EDIT TF_MATURITY)->getSelectedValue().asInteger(); + + LLSD metadata; + + metadata[TF_MRKT] = getChild<LLLineEditor>(EDIT TF_MRKT)->getText(); + metadata[IMG_LOGO] = getChild<LLTextureCtrl>(EDIT IMG_LOGO)->getImageAssetID(); + + LLPointer<LLSDXMLFormatter> formatter = new LLSDXMLFormatter(); + + std::ostringstream os; + if(formatter->format(metadata, os)) + { + mPackage[LLExperienceCache::METADATA]=os.str(); + } + + int properties = mPackage[LLExperienceCache::PROPERTIES].asInteger(); + LLCheckBoxCtrl* enable = getChild<LLCheckBoxCtrl>(EDIT BTN_ENABLE); + if(enable->get()) + { + properties &= ~LLExperienceCache::PROPERTY_DISABLED; + } + else + { + properties |= LLExperienceCache::PROPERTY_DISABLED; + } + + enable = getChild<LLCheckBoxCtrl>(EDIT BTN_PRIVATE); + if(enable->get()) + { + properties |= LLExperienceCache::PROPERTY_PRIVATE; + } + else + { + properties &= ~LLExperienceCache::PROPERTY_PRIVATE; + } + + mPackage[LLExperienceCache::PROPERTIES] = properties; +} diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h index 83ad75913f..550b3c6f27 100644 --- a/indra/newview/llfloaterexperienceprofile.h +++ b/indra/newview/llfloaterexperienceprofile.h @@ -84,9 +84,13 @@ protected: bool setMaturityString(U8 maturity, LLTextBox* child, LLComboBox* combo); bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response, PostSaveAction action); void doSave( int success_action ); + + void updatePackage(); + void updatePermission( const LLSD& permission ); LLUUID mExperienceId; LLSD mExperienceDetails; + LLSD mPackage; int mSaveCompleteAction; bool mDirty; bool mForceClose; diff --git a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml index b823b338ad..43ff3f07e4 100644 --- a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml +++ b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml @@ -504,6 +504,7 @@ layout="topleft" right="-10" top_pad="-19" + tool_tip="Increasing the maturity rating on an experience will reset permission for all residents which have allowed the experience." name="edit_ContentRatingText" width="105"> <icons_combo_box.drop_down_button @@ -606,6 +607,7 @@ left="10" layout="topleft" follows="top|left" + tool_tip="" label="Enable Experience" name="edit_enable_btn"/> <check_box width="130" @@ -636,6 +638,17 @@ width="120" right="-10" visible="true"/> + <text + follows="left|top|right" + height="50" + layout="topleft" + left="10" + top_pad="10" + name="changes" + use_ellipses="true" + word_wrap="true" + value="Experience changes may take several minutes to be seen on all regions." + right="-10"/> </panel> </scroll_container> </panel> |