diff options
author | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-05-05 19:43:02 +0300 |
---|---|---|
committer | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-05-05 19:43:02 +0300 |
commit | 8b3f4ec5f58c1488ac7b3403a1a510a4977cebf6 (patch) | |
tree | 50bf30b88769873b12ea3d1589af942842aeaa40 /indra | |
parent | bdeeb6451fcfaabb826a6a8babe9f580643bc873 (diff) |
MAINT-6226 Incorporate a customized Snapshot feature to Outfit Browser flow
Removed odd controls like custom resolution spinners etc
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloateroutfitsnapshot.cpp | 382 | ||||
-rw-r--r-- | indra/newview/llfloateroutfitsnapshot.h | 6 | ||||
-rwxr-xr-x | indra/newview/llpanelsnapshot.cpp | 33 | ||||
-rwxr-xr-x | indra/newview/llpanelsnapshot.h | 2 | ||||
-rwxr-xr-x | indra/newview/llpanelsnapshotinventory.cpp | 50 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml | 63 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml | 52 |
7 files changed, 58 insertions, 530 deletions
diff --git a/indra/newview/llfloateroutfitsnapshot.cpp b/indra/newview/llfloateroutfitsnapshot.cpp index 8fa54e7f94..cea0e48aa6 100644 --- a/indra/newview/llfloateroutfitsnapshot.cpp +++ b/indra/newview/llfloateroutfitsnapshot.cpp @@ -105,20 +105,13 @@ public: static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); static void onImageQualityChange(LLFloaterOutfitSnapshot* view, S32 quality_val); static void onImageFormatChange(LLFloaterOutfitSnapshot* view); - static void applyCustomResolution(LLFloaterOutfitSnapshot* view, S32 w, S32 h); static void onSnapshotUploadFinished(bool status); static void onSendingPostcardFinished(bool status); static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); - static void setImageSizeSpinnersValues(LLFloaterOutfitSnapshot *view, S32 width, S32 height) ; - static void updateSpinners(LLFloaterOutfitSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); static LLPanelSnapshot* getActivePanel(LLFloaterOutfitSnapshot* floater, bool ok_if_not_found = true); static LLPanelSnapshot::ESnapshotType getActiveSnapshotType(LLFloaterOutfitSnapshot* floater); static LLFloaterOutfitSnapshot::ESnapshotFormat getImageFormat(LLFloaterOutfitSnapshot* floater); - static LLSpinCtrl* getWidthSpinner(LLFloaterOutfitSnapshot* floater); - static LLSpinCtrl* getHeightSpinner(LLFloaterOutfitSnapshot* floater); - static void enableAspectRatioCheckbox(LLFloaterOutfitSnapshot* floater, BOOL enable); - static void setAspectRatioCheckboxValue(LLFloaterOutfitSnapshot* floater, BOOL checked); static LLSnapshotLivePreview* getPreviewView(LLFloaterOutfitSnapshot *floater); static void setResolution(LLFloaterOutfitSnapshot* floater, const std::string& comboname); @@ -130,9 +123,7 @@ public: private: static LLViewerWindow::ESnapshotType getLayerType(LLFloaterOutfitSnapshot* floater); - static void comboSetCustom(LLFloaterOutfitSnapshot *floater, const std::string& comboname); static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); - static void checkAspectRatio(LLFloaterOutfitSnapshot *view, S32 index) ; static void setWorking(LLFloaterOutfitSnapshot* floater, bool working); static void setFinished(LLFloaterOutfitSnapshot* floater, bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); @@ -165,80 +156,16 @@ LLPanelSnapshot* LLFloaterOutfitSnapshot::Impl::getActivePanel(LLFloaterOutfitSn // static LLPanelSnapshot::ESnapshotType LLFloaterOutfitSnapshot::Impl::getActiveSnapshotType(LLFloaterOutfitSnapshot* floater) { - //LLSnapshotLivePreview::ESnapshotType type = LLSnapshotLivePreview::SNAPSHOT_WEB; - //std::string name; - LLPanelSnapshot* spanel = getActivePanel(floater); - - //if (spanel) - //{ - // name = spanel->getName(); - //} - - //if (name == "panel_snapshot_postcard") - //{ - // type = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; - //} - //else if (name == "panel_snapshot_inventory") - //{ - // type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; - //} - //else if (name == "panel_snapshot_local") - //{ - // type = LLSnapshotLivePreview::SNAPSHOT_LOCAL; - //} - - //return type; - if (spanel) - { - return spanel->getSnapshotType(); - } - return LLPanelSnapshot::SNAPSHOT_WEB; + return LLPanelSnapshot::SNAPSHOT_TEXTURE; } // static LLFloaterOutfitSnapshot::ESnapshotFormat LLFloaterOutfitSnapshot::Impl::getImageFormat(LLFloaterOutfitSnapshot* floater) { - //LLPanelSnapshot* active_panel = getActivePanel(floater); - // FIXME: if the default is not PNG, profile uploads may fail. - //return active_panel ? active_panel->getImageFormat() : LLFloaterOutfitSnapshot::SNAPSHOT_FORMAT_PNG; return LLFloaterOutfitSnapshot::SNAPSHOT_FORMAT_PNG; } // static -LLSpinCtrl* LLFloaterOutfitSnapshot::Impl::getWidthSpinner(LLFloaterOutfitSnapshot* floater) -{ - LLPanelSnapshot* active_panel = getActivePanel(floater); - return active_panel ? active_panel->getWidthSpinner() : floater->getChild<LLSpinCtrl>("snapshot_width"); -} - -// static -LLSpinCtrl* LLFloaterOutfitSnapshot::Impl::getHeightSpinner(LLFloaterOutfitSnapshot* floater) -{ - LLPanelSnapshot* active_panel = getActivePanel(floater); - return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height"); -} - -// static -void LLFloaterOutfitSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterOutfitSnapshot* floater, BOOL enable) -{ - LLPanelSnapshot* active_panel = getActivePanel(floater); - if (active_panel) - { - active_panel->enableAspectRatioCheckbox(enable); - } -} - -// static -void LLFloaterOutfitSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterOutfitSnapshot* floater, BOOL checked) -{ - LLPanelSnapshot* active_panel = getActivePanel(floater); - if (active_panel) - { - active_panel->getChild<LLUICtrl>(active_panel->getAspectRatioCBName())->setValue(checked); - } -} - -// static LLSnapshotLivePreview* LLFloaterOutfitSnapshot::Impl::getPreviewView(LLFloaterOutfitSnapshot *floater) { LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); @@ -248,14 +175,7 @@ LLSnapshotLivePreview* LLFloaterOutfitSnapshot::Impl::getPreviewView(LLFloaterOu // static LLViewerWindow::ESnapshotType LLFloaterOutfitSnapshot::Impl::getLayerType(LLFloaterOutfitSnapshot* floater) { - LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue(); - const std::string id = value.asString(); - if (id == "colors") - type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - else if (id == "depth") - type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; - return type; + return LLViewerWindow::SNAPSHOT_TYPE_COLOR; } // static @@ -375,67 +295,9 @@ void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterOutfitSnapshot* floa { LLPanelSnapshot::ESnapshotType shot_type = getActiveSnapshotType(floater); LLFloaterSnapshotBase::ESnapshotFormat shot_format = (LLFloaterSnapshotBase::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); - LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); - - floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); - floater->getChildView("layer_types")->setEnabled(shot_type == LLPanelSnapshot::SNAPSHOT_LOCAL); - - LLPanelSnapshot* active_panel = getActivePanel(floater); - if (active_panel) - { - LLSpinCtrl* width_ctrl = getWidthSpinner(floater); - LLSpinCtrl* height_ctrl = getHeightSpinner(floater); - - // Initialize spinners. - if (width_ctrl->getValue().asInteger() == 0) - { - S32 w = gViewerWindow->getWindowWidthRaw(); - LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL; - width_ctrl->setValue(w); - if (getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE) - { - width_ctrl->setIncrement(w >> 1); - } - } - if (height_ctrl->getValue().asInteger() == 0) - { - S32 h = gViewerWindow->getWindowHeightRaw(); - LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL; - height_ctrl->setValue(h); - if (getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE) - { - height_ctrl->setIncrement(h >> 1); - } - } - - // Clamp snapshot resolution to window size when showing UI or HUD in snapshot. - if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) - { - S32 width = gViewerWindow->getWindowWidthRaw(); - S32 height = gViewerWindow->getWindowHeightRaw(); - - width_ctrl->setMaxValue(width); - - height_ctrl->setMaxValue(height); - - if (width_ctrl->getValue().asInteger() > width) - { - width_ctrl->forceSetValue(width); - } - if (height_ctrl->getValue().asInteger() > height) - { - height_ctrl->forceSetValue(height); - } - } - else - { - width_ctrl->setMaxValue(6016); - height_ctrl->setMaxValue(6016); - } - } + LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); LLSnapshotLivePreview* previewp = getPreviewView(floater); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards @@ -458,36 +320,9 @@ void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterOutfitSnapshot* floa } floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); - floater->getChild<LLUICtrl>("file_size_label")->setColor( - shot_type == LLPanelSnapshot::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - - // Update the width and height spinners based on the corresponding resolution combos. (?) - switch(shot_type) - { - case LLPanelSnapshot::SNAPSHOT_WEB: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->getChild<LLUICtrl>("layer_types")->setValue("colors"); - setResolution(floater, "profile_size_combo"); - break; - case LLPanelSnapshot::SNAPSHOT_POSTCARD: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->getChild<LLUICtrl>("layer_types")->setValue("colors"); - setResolution(floater, "postcard_size_combo"); - break; - case LLPanelSnapshot::SNAPSHOT_TEXTURE: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->getChild<LLUICtrl>("layer_types")->setValue("colors"); - setResolution(floater, "texture_size_combo"); - break; - case LLPanelSnapshot::SNAPSHOT_LOCAL: - setResolution(floater, "local_size_combo"); - break; - default: - break; - } - setAspectRatioCheckboxValue(floater, !floater->impl.mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot")); + floater->getChild<LLUICtrl>("file_size_label")->setColor(LLUIColorTable::instance().getColor( "LabelTextColor" )); + + setResolution(floater, "texture_size_combo"); if (previewp) { @@ -641,32 +476,6 @@ void LLFloaterOutfitSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) // static void LLFloaterOutfitSnapshot::Impl::applyKeepAspectCheck(LLFloaterOutfitSnapshot* view, BOOL checked) { - gSavedSettings.setBOOL("KeepAspectForSnapshot", checked); - - if (view) - { - LLPanelSnapshot* active_panel = getActivePanel(view); - if (checked && active_panel) - { - LLComboBox* combo = view->getChild<LLComboBox>(active_panel->getImageSizeComboName()); - combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index - } - - LLSnapshotLivePreview* previewp = getPreviewView(view) ; - if(previewp) - { - previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; - - S32 w, h ; - previewp->getSize(w, h) ; - updateSpinners(view, previewp, w, h, TRUE); // may change w and h - - LL_DEBUGS() << "updating thumbnail" << LL_ENDL; - previewp->setSize(w, h) ; - previewp->updateSnapshot(TRUE); - checkAutoSnapshot(previewp, TRUE); - } - } } // static @@ -691,44 +500,6 @@ void LLFloaterOutfitSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* da updateLayout(view); } -// static -void LLFloaterOutfitSnapshot::Impl::checkAspectRatio(LLFloaterOutfitSnapshot *view, S32 index) -{ - LLSnapshotLivePreview *previewp = getPreviewView(view) ; - - // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here - if(LLPanelSnapshot::SNAPSHOT_TEXTURE == getActiveSnapshotType(view)) - { - previewp->mKeepAspectRatio = FALSE ; - return ; - } - - BOOL keep_aspect = FALSE, enable_cb = FALSE; - - if (0 == index) // current window size - { - enable_cb = FALSE; - keep_aspect = TRUE; - } - else if (-1 == index) // custom - { - enable_cb = TRUE; - keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot"); - } - else // predefined resolution - { - enable_cb = FALSE; - keep_aspect = FALSE; - } - - view->impl.mAspectRatioCheckOff = !enable_cb; - - if (previewp) - { - previewp->mKeepAspectRatio = keep_aspect; - } -} - // Show/hide upload progress indicators. // static void LLFloaterOutfitSnapshot::Impl::setWorking(LLFloaterOutfitSnapshot* floater, bool working) @@ -807,78 +578,22 @@ void LLFloaterOutfitSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, width = llmin(width, gViewerWindow->getWindowWidthRaw()); height = llmin(height, gViewerWindow->getWindowHeightRaw()); } + - if (width == 0 || height == 0) - { - // take resolution from current window size - LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; - previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); - } - else if (width == -1 || height == -1) - { - // load last custom value - S32 new_width = 0, new_height = 0; - LLPanelSnapshot* spanel = getActivePanel(view); - if (spanel) - { - LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL; - new_width = spanel->getTypedPreviewWidth(); - new_height = spanel->getTypedPreviewHeight(); - - // Limit custom size for inventory snapshots to 512x512 px. - if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) - { - new_width = llmin(new_width, MAX_TEXTURE_SIZE); - new_height = llmin(new_height, MAX_TEXTURE_SIZE); - } - } - else - { - LL_DEBUGS() << "No custom res chosen, setting preview res from window: " - << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; - new_width = gViewerWindow->getWindowWidthRaw(); - new_height = gViewerWindow->getWindowHeightRaw(); - } + llassert(width > 0 && height > 0); - llassert(new_width > 0 && new_height > 0); - previewp->setSize(new_width, new_height); - } - else - { - // use the resolution from the selected pre-canned drop-down choice - LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; - previewp->setSize(width, height); - } - - checkAspectRatio(view, width) ; - - previewp->getSize(width, height); - - // We use the height spinner here because we come here via the aspect ratio - // checkbox as well and we want height always changing to width by default. - // If we use the width spinner we would change width according to height by - // default, that is not what we want. - updateSpinners(view, previewp, width, height, !getHeightSpinner(view)->isDirty()); // may change width and height + // use the resolution from the selected pre-canned drop-down choice + LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; + previewp->setSize(width, height); - if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height) - { - getWidthSpinner(view)->setValue(width); - getHeightSpinner(view)->setValue(height); - if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) - { - getWidthSpinner(view)->setIncrement(width >> 1); - getHeightSpinner(view)->setIncrement(height >> 1); - } - } - if(original_width != width || original_height != height) { - previewp->setSize(width, height); + //previewp->setSize(width, height); // hide old preview as the aspect ratio could be wrong checkAutoSnapshot(previewp, FALSE); LL_DEBUGS() << "updating thumbnail" << LL_ENDL; - getPreviewView(view)->updateSnapshot(TRUE); + previewp->updateSnapshot(TRUE); if(do_update) { LL_DEBUGS() << "Will update controls" << LL_ENDL; @@ -928,15 +643,6 @@ void LLFloaterOutfitSnapshot::Impl::onImageFormatChange(LLFloaterOutfitSnapshot* } } -// Sets the named size combo to "custom" mode. -// static -void LLFloaterOutfitSnapshot::Impl::comboSetCustom(LLFloaterOutfitSnapshot* floater, const std::string& comboname) -{ - LLComboBox* combo = floater->getChild<LLComboBox>(comboname); - combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index - checkAspectRatio(floater, -1); // -1 means custom -} - // Update supplied width and height according to the constrain proportions flag; limit them by max_val. //static BOOL LLFloaterOutfitSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value) @@ -983,58 +689,6 @@ BOOL LLFloaterOutfitSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previe return (w != width || h != height) ; } -//static -void LLFloaterOutfitSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterOutfitSnapshot *view, S32 width, S32 height) -{ - getWidthSpinner(view)->forceSetValue(width); - getHeightSpinner(view)->forceSetValue(height); - if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) - { - getWidthSpinner(view)->setIncrement(width >> 1); - getHeightSpinner(view)->setIncrement(height >> 1); - } -} - -// static -void LLFloaterOutfitSnapshot::Impl::updateSpinners(LLFloaterOutfitSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed) -{ - getWidthSpinner(view)->resetDirty(); - getHeightSpinner(view)->resetDirty(); - if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize())) - { - setImageSizeSpinnersValues(view, width, height); - } -} - -// static -void LLFloaterOutfitSnapshot::Impl::applyCustomResolution(LLFloaterOutfitSnapshot* view, S32 w, S32 h) -{ - LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL; - if (!view) return; - - LLSnapshotLivePreview* previewp = getPreviewView(view); - if (previewp) - { - S32 curw,curh; - previewp->getSize(curw, curh); - - if (w != curw || h != curh) - { - //if to upload a snapshot, process spinner input in a special way. - previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ; - - previewp->setSize(w,h); - checkAutoSnapshot(previewp, FALSE); - comboSetCustom(view, "profile_size_combo"); - comboSetCustom(view, "postcard_size_combo"); - comboSetCustom(view, "texture_size_combo"); - comboSetCustom(view, "local_size_combo"); - LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL; - previewp->updateSnapshot(TRUE); - } - } -} - // static void LLFloaterOutfitSnapshot::Impl::onSnapshotUploadFinished(bool status) { @@ -1096,12 +750,6 @@ BOOL LLFloaterOutfitSnapshot::postBuild() childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); - impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); - - childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); - getChild<LLUICtrl>("layer_types")->setValue("colors"); - getChildView("layer_types")->setEnabled(FALSE); - getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); @@ -1261,7 +909,7 @@ S32 LLFloaterOutfitSnapshot::notify(const LLSD& info) impl.updateResolution(getChild<LLUICtrl>(combo_name), this); return 1; } - + /* if (info.has("custom-res-change")) { LLSD res = info["custom-res-change"]; @@ -1274,7 +922,7 @@ S32 LLFloaterOutfitSnapshot::notify(const LLSD& info) impl.applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean()); return 1; } - + */ if (info.has("image-quality-change")) { impl.onImageQualityChange(this, info["image-quality-change"].asInteger()); diff --git a/indra/newview/llfloateroutfitsnapshot.h b/indra/newview/llfloateroutfitsnapshot.h index 176a9520c2..9982676bea 100644 --- a/indra/newview/llfloateroutfitsnapshot.h +++ b/indra/newview/llfloateroutfitsnapshot.h @@ -38,12 +38,6 @@ class LLFloaterOutfitSnapshot : public LLFloaterSnapshotBase LOG_CLASS(LLFloaterOutfitSnapshot); public: - //typedef enum e_snapshot_format - //{ - // SNAPSHOT_FORMAT_PNG, - // SNAPSHOT_FORMAT_JPEG, - // SNAPSHOT_FORMAT_BMP - //} ESnapshotFormat; LLFloaterOutfitSnapshot(const LLSD& key); virtual ~LLFloaterOutfitSnapshot(); diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index ca62f2bdf5..284f7aad3f 100755 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -54,10 +54,18 @@ S32 power_of_two(S32 sz, S32 upper) BOOL LLPanelSnapshot::postBuild() { getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); - getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); - getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); - getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1)); - + if (!getWidthSpinnerName().empty()) + { + getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + } + if (!getHeightSpinnerName().empty()) + { + getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + } + if (!getAspectRatioCBName().empty()) + { + getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1)); + } updateControls(LLSD()); return TRUE; } @@ -92,27 +100,32 @@ void LLPanelSnapshot::enableControls(BOOL enable) LLSpinCtrl* LLPanelSnapshot::getWidthSpinner() { + llassert(!getWidthSpinnerName().empty()); return getChild<LLSpinCtrl>(getWidthSpinnerName()); } LLSpinCtrl* LLPanelSnapshot::getHeightSpinner() { + llassert(!getHeightSpinnerName().empty()); return getChild<LLSpinCtrl>(getHeightSpinnerName()); } S32 LLPanelSnapshot::getTypedPreviewWidth() const { + llassert(!getWidthSpinnerName().empty()); return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); } S32 LLPanelSnapshot::getTypedPreviewHeight() const { - return getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); + llassert(!getHeightSpinnerName().empty()); + return getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); } void LLPanelSnapshot::enableAspectRatioCheckbox(BOOL enable) { - getChild<LLUICtrl>(getAspectRatioCBName())->setEnabled(enable); + llassert(!getAspectRatioCBName().empty()); + getChild<LLUICtrl>(getAspectRatioCBName())->setEnabled(enable); } LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer() @@ -177,9 +190,11 @@ void LLPanelSnapshot::cancel() void LLPanelSnapshot::onCustomResolutionCommit() { LLSD info; - LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(getWidthSpinnerName()); - LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(getHeightSpinnerName()); - //TODO: Refactoring - move this code into some virtual method of LLPanelSnapshotInventory + std::string widthSpinnerName = getWidthSpinnerName(); + std::string heightSpinnerName = getHeightSpinnerName(); + llassert(!widthSpinnerName.empty() && !heightSpinnerName.empty()); + LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(widthSpinnerName); + LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(heightSpinnerName); if (getName() == "panel_snapshot_inventory") { S32 width = widthSpinner->getValue().asInteger(); diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h index d64ef3b75a..3868020cdf 100755 --- a/indra/newview/llpanelsnapshot.h +++ b/indra/newview/llpanelsnapshot.h @@ -68,7 +68,7 @@ protected: LLSideTrayPanelContainer* getParentContainer(); void updateImageQualityLevel(); void goBack(); ///< Switch to the default (Snapshot Options) panel - void cancel(); + virtual void cancel(); // common UI callbacks void onCustomResolutionCommit(); diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 013a564908..057e046e30 100755 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -47,19 +47,6 @@ class LLPanelSnapshotInventoryBase public: LLPanelSnapshotInventoryBase(); -// -// /*virtual*/ BOOL postBuild(); -// /*virtual*/ void onOpen(const LLSD& key); -// -// void onResolutionCommit(LLUICtrl* ctrl); -// -//private: -// /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; } -// /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; } -// /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; } -// /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; } -// /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; } -// /*virtual*/ void updateControls(const LLSD& info); protected: virtual void onSend() = 0; @@ -99,18 +86,17 @@ public: LLPanelOutfitSnapshotInventory(); /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - - void onResolutionCommit(LLUICtrl* ctrl); - - private: - /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; } - /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; } - /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; } - /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; } - /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; } - /*virtual*/ void updateControls(const LLSD& info); + +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 onSend(); + /*virtual*/ void cancel(); }; static LLPanelInjector<LLPanelSnapshotInventory> panel_class1("llpanelsnapshotinventory"); @@ -172,16 +158,12 @@ void LLPanelSnapshotInventory::onSend() LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory() { mCommitCallbackRegistrar.add("Inventory.SaveOutfitPhoto", boost::bind(&LLPanelOutfitSnapshotInventory::onSend, this)); - mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelOutfitSnapshotInventory::cancel, this)); + mCommitCallbackRegistrar.add("Inventory.SaveOutfitCancel", boost::bind(&LLPanelOutfitSnapshotInventory::cancel, this)); } // virtual BOOL LLPanelOutfitSnapshotInventory::postBuild() { - getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE); - getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE); - - getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelOutfitSnapshotInventory::onResolutionCommit, this, _1)); return LLPanelSnapshot::postBuild(); } @@ -199,15 +181,13 @@ void LLPanelOutfitSnapshotInventory::updateControls(const LLSD& info) getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot); } -void LLPanelOutfitSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) -{ - BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3); - getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected); - getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected); -} - void LLPanelOutfitSnapshotInventory::onSend() { LLFloaterOutfitSnapshot::saveTexture(); LLFloaterOutfitSnapshot::postSave(); } + +void LLPanelOutfitSnapshotInventory::cancel() +{ + getParentByType<LLFloater>()->closeFloater(); +} diff --git a/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml b/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml index 7b88b07ca6..34f02e535f 100644 --- a/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml @@ -156,23 +156,6 @@ width="100"> Capture: </text> - <combo_box - follows="left|top|right" - height="23" - label="Image Layers" - layout="topleft" - left="30" - name="layer_types" - right="-2"> - <combo_box.item - label="Colors" - name="Colors" - value="colors" /> - <combo_box.item - label="Depth" - name="Depth" - value="depth" /> - </combo_box> <check_box label="Interface" layout="topleft" @@ -243,43 +226,6 @@ top_pad="7" /> </panel> - <!-- - <panel_container - follows="left|top" - height="230" - layout="topleft" - left="0" - name="panel_container" - default_panel_name="panel_snapshot_options" - top_pad="10" - width="215"> - <panel - class="llpanelsnapshotoptions" - filename="panel_snapshot_options.xml" - follows="all" - layout="topleft" - left="0" - name="panel_snapshot_options" - top="0" /> - <panel - class="llpanelsnapshotprofile" - follows="all" - layout="topleft" - name="panel_snapshot_profile" - filename="panel_snapshot_profile.xml" /> - <panel - class="llpanelsnapshotpostcard" - follows="all" - layout="topleft" - name="panel_snapshot_postcard" - filename="panel_snapshot_postcard.xml" /> - --> - <!--panel - class="llpaneloutfitsnapshotinventory" - follows="all" - layout="topleft" - name="panel_outfit_snapshot_inventory" - filename="panel_snapshot_inventory.xml"--> <panel class="llpaneloutfitsnapshotinventory" follows="left|top" @@ -291,15 +237,6 @@ top_pad="10" width="215" /> - <!-- - <panel - class="llpanelsnapshotlocal" - follows="all" - layout="topleft" - name="panel_snapshot_local" - filename="panel_snapshot_local.xml" /> - </panel_container> ---> <view_border bevel_style="in" follows="left|top" diff --git a/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml index ce6309e2ed..7261d429ba 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml @@ -59,53 +59,7 @@ label="Large (512x512)" name="Large(512x512)" value="[i512,i512]" /> - <combo_box.item - label="Current Window(512x512)" - name="CurrentWindow" - value="[i0,i0]" /> - <combo_box.item - label="Custom" - name="Custom" - value="[i-1,i-1]" /> </combo_box> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="Width x Height" - label_width="90" - layout="topleft" - left="10" - max_val="6016" - min_val="32" - name="inventory_snapshot_width" - top_pad="7" - width="144" /> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="" - label_width="0" - layout="topleft" - left_pad="0" - max_val="6016" - min_val="32" - name="inventory_snapshot_height" - top_delta="0" - width="54" /> - <check_box - top_pad="12" - follows="left|top" - label="Constrain proportions" - layout="topleft" - left="10" - name="inventory_keep_aspect_check" - visible="false" /> <text follows="top|left" font="SansSerif" @@ -118,7 +72,7 @@ width="200" type="string" word_wrap="true"> - Saving an image to your inventory costs L$[UPLOAD_COST]. To save your image as a texture select one of the square formats. + Uploading an image to your inventory costs L$[UPLOAD_COST]. </text> <button follows="right|bottom" @@ -130,12 +84,12 @@ top="337" width="97"> <button.commit_callback - function="Inventory.Cancel" /> + function="Inventory.SaveOutfitCancel" /> </button> <button follows="left|bottom" height="23" - label="Save" + label="UPLOAD L$10" layout="topleft" left="10" name="save_btn" |