diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-06-29 22:03:29 +0300 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-06-29 22:03:29 +0300 |
commit | e4b12b83e8721e0856af0305f6cee46cd6092024 (patch) | |
tree | 8d63de0e773cb523fc613b74dbd70a78bc9f2cf8 | |
parent | 0c05ea2740b63c824fba2bab37f67ca2188f0d07 (diff) |
SH-1725 WIP Added upload permissions and fee requests to Upload Model Wizard.
- Enabled warning for users without upload permissions.
- Enabled "Calculate weights & fee" button.
- Temporarily enabled to upload meshes if upload permission capability request has failed.
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 59 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.h | 9 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lluploadfloaterobservers.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lluploadfloaterobservers.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_wizard.xml | 2 |
8 files changed, 74 insertions, 22 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 00cc81c5d6..9b61124208 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5491,7 +5491,7 @@ void LLFloaterModelPreview::DecompRequest::completed() void dump_llsd_to_file(const LLSD& content, std::string filename); -void LLFloaterModelPreview::onPermReceived(const LLSD& result) +void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result) { dump_llsd_to_file(result,"perm_received.xml"); std::string upload_status = result["mesh_upload_status"].asString(); @@ -5503,9 +5503,9 @@ void LLFloaterModelPreview::onPermReceived(const LLSD& result) getChild<LLTextBox>("warning_message")->setVisible(!mHasUploadPerm); } -void LLFloaterModelPreview::setPermErrorStatus(U32 status, const std::string& reason) +void LLFloaterModelPreview::setPermissonsErrorStatus(U32 status, const std::string& reason) { - llwarns << "LLFloaterModelPreview::setPermErrors(" << status << " : " << reason << ")" << llendl; + llwarns << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << llendl; LLNotificationsUtil::add("MeshUploadPermError"); } diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 62878812c3..6d5e46d9e4 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -197,10 +197,10 @@ public: void disableViewOption(const std::string& option); // shows warning message if agent has no permissions to upload model - /*virtual*/ void onPermReceived(const LLSD& result); + /*virtual*/ void onPermissionsReceived(const LLSD& result); // called when error occurs during permissions request - /*virtual*/ void setPermErrorStatus(U32 status, const std::string& reason); + /*virtual*/ void setPermissonsErrorStatus(U32 status, const std::string& reason); /*virtual*/ void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url); diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 3c0ce96864..4482d02ca3 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -162,6 +162,8 @@ void LLFloaterModelWizard::setState(int state) getChildView("cancel")->setVisible(true); mCalculateWeightsBtn->setVisible(false); mCalculatingWeightsBtn->setVisible(false); + + getChildView("upload")->setEnabled(mHasUploadPerm); } if (state == UPLOAD) @@ -264,6 +266,21 @@ void LLFloaterModelWizard::onClickRecalculatePhysics() executePhysicsStage("Decompose"); } +void LLFloaterModelWizard::onClickCalculateUploadFee() +{ + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, false); + + mModelPreview->rebuildUploadData(); + + mUploadModelUrl.clear(); + LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + true, false, false, mUploadModelUrl, false); + + thread->setObserverHandle(getWholeModelFeeObserverHandle()); + + gMeshRepo.mUploadWaitList.push_back(thread); +} + void LLFloaterModelWizard::loadModel() { mModelPreview->mLoading = TRUE; @@ -460,13 +477,42 @@ void LLFloaterModelWizard::initDecompControls() mDecompParams["Simplify Method"] = 0; // set it to retain % } -void LLFloaterModelWizard::onPermReceived(const LLSD& result) +/*virtual*/ +void LLFloaterModelWizard::onPermissionsReceived(const LLSD& result) +{ + std::string upload_status = result["mesh_upload_status"].asString(); + mHasUploadPerm = "valid" == upload_status; + + getChildView("upload")->setEnabled(mHasUploadPerm); + getChildView("warning_label")->setVisible(mHasUploadPerm); + getChildView("warning_text")->setVisible(mHasUploadPerm); +} + +/*virtual*/ +void LLFloaterModelWizard::setPermissonsErrorStatus(U32 status, const std::string& reason) { + llwarns << "LLFloaterModelWizard::setPermissonsErrorStatus(" << status << " : " << reason << ")" << llendl; } -void LLFloaterModelWizard::setPermErrorStatus(U32 status, const std::string& reason) +/*virtual*/ +void LLFloaterModelWizard::onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) { - llwarns << "LLFloaterModelWizard::setPermErrors(" << status << " : " << reason << ")" << llendl; + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + + mUploadModelUrl = upload_url; + + childSetTextArg("review_fee", "[FEE]", llformat("%d", fee)); + childSetTextArg("charged_fee", "[FEE]", llformat("%d", fee)); + + setState(llmin((int) UPLOAD, mState+1)); +} + +/*virtual*/ +void LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) +{ + swap_controls(mCalculateWeightsBtn, mCalculatingWeightsBtn, true); + + llwarns << "LLFloaterModelWizard::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; } //static @@ -573,8 +619,7 @@ BOOL LLFloaterModelWizard::postBuild() mRecalculatingPhysicsBtn = getChild<LLButton>("recalculating_physics_btn"); mCalculateWeightsBtn = getChild<LLButton>("calculate"); - // *TODO: Change the callback to upload fee request. - mCalculateWeightsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickNext, this)); + mCalculateWeightsBtn->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickCalculateUploadFee, this)); mCalculatingWeightsBtn = getChild<LLButton>("calculating"); @@ -622,10 +667,6 @@ void LLFloaterModelWizard::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F } childSetTextArg("review_prim_equiv", "[EQUIV]", llformat("%d", mModelPreview->mResourceCost)); - - // *TODO: Get the actual upload fee. - childSetTextArg("review_fee", "[FEE]", llformat("%d", 0)); - childSetTextArg("charged_fee", "[FEE]", llformat("%d", 0)); } void LLFloaterModelWizard::modelLoadedCallback() diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index 9930e0c4e6..0b6ee451e1 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -72,10 +72,14 @@ public: void initDecompControls(); // shows warning message if agent has no permissions to upload model - void onPermReceived(const LLSD& result); + /*virtual*/ void onPermissionsReceived(const LLSD& result); // called when error occurs during permissions request - void setPermErrorStatus(U32 status, const std::string& reason); + /*virtual*/ void setPermissonsErrorStatus(U32 status, const std::string& reason); + + /*virtual*/ void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url); + + /*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason); const LLRect& getPreviewRect() const { return mPreviewRect; } @@ -99,6 +103,7 @@ private: void onClickSwitchToAdvanced(); void onClickRecalculateGeometry(); void onClickRecalculatePhysics(); + void onClickCalculateUploadFee(); void onClickCancel(); void onClickBack(); void onClickNext(); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 743a8d53ed..31c2d34b8d 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -577,13 +577,14 @@ public: mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); + LLWholeModelFeeObserver* observer = mObserverHandle.get(); + if (isGoodStatus(status) && cc["state"].asString() == "upload") { llinfos << "fee request succeeded" << llendl; mThread->mWholeModelUploadURL = cc["uploader"].asString(); - LLWholeModelFeeObserver* observer = mObserverHandle.get(); if (observer) { S32 fee = cc["upload_price"].asInteger(); @@ -597,6 +598,11 @@ public: llwarns << "fee request failed" << llendl; log_upload_error(status,cc,"fee",mModelData["name"]); mThread->mWholeModelUploadURL = ""; + + if (observer) + { + observer->setModelPhysicsFeeErrorStatus(status, reason); + } } } diff --git a/indra/newview/lluploadfloaterobservers.cpp b/indra/newview/lluploadfloaterobservers.cpp index 2d418ee00d..5a6a17fbca 100644 --- a/indra/newview/lluploadfloaterobservers.cpp +++ b/indra/newview/lluploadfloaterobservers.cpp @@ -41,7 +41,7 @@ void LLUploadModelPremissionsResponder::error(U32 status, const std::string& rea if (observer) { - observer->setPermErrorStatus(status, reason); + observer->setPermissonsErrorStatus(status, reason); } } @@ -51,6 +51,6 @@ void LLUploadModelPremissionsResponder::result(const LLSD& content) if (observer) { - observer->onPermReceived(content); + observer->onPermissionsReceived(content); } } diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h index f27687e12e..23206549e7 100644 --- a/indra/newview/lluploadfloaterobservers.h +++ b/indra/newview/lluploadfloaterobservers.h @@ -38,8 +38,8 @@ public: LLUploadPermissionsObserver(){mUploadPermObserverHandle.bind(this);} virtual ~LLUploadPermissionsObserver() {} - virtual void onPermReceived(const LLSD& result) = 0; - virtual void setPermErrorStatus(U32 status, const std::string& reason) = 0; + virtual void onPermissionsReceived(const LLSD& result) = 0; + virtual void setPermissonsErrorStatus(U32 status, const std::string& reason) = 0; LLHandle<LLUploadPermissionsObserver> getPermObserverHandle() const {return mUploadPermObserverHandle;} diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 9f7c79ada4..89736363b9 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -126,7 +126,7 @@ </text> </panel> <panel - top="14" + top_pad="14" left="15" height="310" width="505" |