summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelsnapshotinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelsnapshotinventory.cpp')
-rw-r--r--indra/newview/llpanelsnapshotinventory.cpp107
1 files changed, 99 insertions, 8 deletions
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index a2d1752c6a..b2952834fb 100644
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -33,6 +33,7 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
+#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
@@ -40,8 +41,22 @@
/**
* The panel provides UI for saving snapshot as an inventory texture.
*/
+class LLPanelSnapshotInventoryBase
+ : public LLPanelSnapshot
+{
+ LOG_CLASS(LLPanelSnapshotInventoryBase);
+
+public:
+ LLPanelSnapshotInventoryBase();
+
+ /*virtual*/ BOOL postBuild();
+protected:
+ void onSend();
+ /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
+};
+
class LLPanelSnapshotInventory
-: public LLPanelSnapshot
+ : public LLPanelSnapshotInventoryBase
{
LOG_CLASS(LLPanelSnapshotInventory);
@@ -60,10 +75,46 @@ private:
/*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
/*virtual*/ void updateControls(const LLSD& info);
- void onSend();
};
-static LLPanelInjector<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
+class LLPanelOutfitSnapshotInventory
+ : public LLPanelSnapshotInventoryBase
+{
+ LOG_CLASS(LLPanelOutfitSnapshotInventory);
+
+public:
+ LLPanelOutfitSnapshotInventory();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+private:
+ /*virtual*/ std::string getWidthSpinnerName() const { return ""; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return ""; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return ""; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
+ /*virtual*/ void updateControls(const LLSD& info);
+
+ /*virtual*/ void cancel();
+};
+
+static LLPanelInjector<LLPanelSnapshotInventory> panel_class1("llpanelsnapshotinventory");
+
+static LLPanelInjector<LLPanelOutfitSnapshotInventory> panel_class2("llpaneloutfitsnapshotinventory");
+
+LLPanelSnapshotInventoryBase::LLPanelSnapshotInventoryBase()
+{
+}
+
+BOOL LLPanelSnapshotInventoryBase::postBuild()
+{
+ return LLPanelSnapshot::postBuild();
+}
+
+LLSnapshotModel::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType()
+{
+ return LLSnapshotModel::SNAPSHOT_TEXTURE;
+}
LLPanelSnapshotInventory::LLPanelSnapshotInventory()
{
@@ -78,7 +129,7 @@ BOOL LLPanelSnapshotInventory::postBuild()
getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1));
- return LLPanelSnapshot::postBuild();
+ return LLPanelSnapshotInventoryBase::postBuild();
}
// virtual
@@ -102,19 +153,59 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);
}
-void LLPanelSnapshotInventory::onSend()
+void LLPanelSnapshotInventoryBase::onSend()
{
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
if (can_afford_transaction(expected_upload_cost))
{
- LLFloaterSnapshot::saveTexture();
- LLFloaterSnapshot::postSave();
+ if (mSnapshotFloater)
+ {
+ mSnapshotFloater->saveTexture();
+ mSnapshotFloater->postSave();
+ }
}
else
{
LLSD args;
args["COST"] = llformat("%d", expected_upload_cost);
LLNotificationsUtil::add("ErrorPhotoCannotAfford", args);
- LLFloaterSnapshot::inventorySaveFailed();
+ if (mSnapshotFloater)
+ {
+ mSnapshotFloater->inventorySaveFailed();
+ }
+ }
+}
+
+LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory()
+{
+ mCommitCallbackRegistrar.add("Inventory.SaveOutfitPhoto", boost::bind(&LLPanelOutfitSnapshotInventory::onSend, this));
+ mCommitCallbackRegistrar.add("Inventory.SaveOutfitCancel", boost::bind(&LLPanelOutfitSnapshotInventory::cancel, this));
+}
+
+// virtual
+BOOL LLPanelOutfitSnapshotInventory::postBuild()
+{
+ return LLPanelSnapshotInventoryBase::postBuild();
+}
+
+// virtual
+void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key)
+{
+ getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
+ LLPanelSnapshot::onOpen(key);
+}
+
+// virtual
+void LLPanelOutfitSnapshotInventory::updateControls(const LLSD& info)
+{
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
+}
+
+void LLPanelOutfitSnapshotInventory::cancel()
+{
+ if (mSnapshotFloater)
+ {
+ mSnapshotFloater->closeFloater();
}
}