diff options
Diffstat (limited to 'indra/newview/llfloatersnapshot.h')
-rw-r--r-- | indra/newview/llfloatersnapshot.h | 175 |
1 files changed, 131 insertions, 44 deletions
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 5f9857c8c5..431888d2d0 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2016, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,36 +27,109 @@ #ifndef LL_LLFLOATERSNAPSHOT_H #define LL_LLFLOATERSNAPSHOT_H +#include "llagent.h" #include "llfloater.h" +#include "llpanelsnapshot.h" +#include "llsnapshotmodel.h" class LLSpinCtrl; +class LLSnapshotLivePreview; class LLFloaterSnapshotBase : public LLFloater { LOG_CLASS(LLFloaterSnapshotBase); public: - typedef enum e_snapshot_format - { - SNAPSHOT_FORMAT_PNG, - SNAPSHOT_FORMAT_JPEG, - SNAPSHOT_FORMAT_BMP - } ESnapshotFormat; LLFloaterSnapshotBase(const LLSD& key); virtual ~LLFloaterSnapshotBase(); - ///*virtual*/ S32 notify(const LLSD& info); + /*virtual*/ void draw(); + /*virtual*/ void onClose(bool app_quitting); + virtual S32 notify(const LLSD& info); - //static LLFloaterSnapshotBase* getInstance(); - //static LLFloaterSnapshotBase* findInstance(); - //static void saveTexture(); - //static BOOL saveLocal(); - //static void postSave(); + // TODO: create a snapshot model instead + virtual void saveTexture() = 0; + void postSave(); + virtual void postPanelSwitch(); + LLPointer<LLImageFormatted> getImageData(); + LLSnapshotLivePreview* getPreviewView(); + const LLVector3d& getPosTakenGlobal(); + + static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } + + void setRefreshLabelVisible(bool value) { mRefreshLabel->setVisible(value); } + void setSuccessLabelPanelVisible(bool value) { mSucceessLblPanel->setVisible(value); } + void setFailureLabelPanelVisible(bool value) { mFailureLblPanel->setVisible(value); } + + class ImplBase; + friend ImplBase; + ImplBase* impl; protected: - class ImplBase; - //ImplBase& impl; + static LLUICtrl* sThumbnailPlaceholder; + LLUICtrl *mRefreshBtn, *mRefreshLabel; + LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; +}; + +class LLFloaterSnapshotBase::ImplBase +{ +public: + typedef enum e_status + { + STATUS_READY, + STATUS_WORKING, + STATUS_FINISHED + } EStatus; + + ImplBase(LLFloaterSnapshotBase* floater) : mAvatarPauseHandles(), + mLastToolset(NULL), + mAspectRatioCheckOff(false), + mNeedRefresh(false), + mStatus(STATUS_READY), + mFloater(floater) + {} + virtual ~ImplBase() + { + //unpause avatars + mAvatarPauseHandles.clear(); + } + + static void onClickNewSnapshot(void* data); + static void onClickAutoSnap(LLUICtrl *ctrl, void* data); + static void onClickFilter(LLUICtrl *ctrl, void* data); + static void onClickUICheck(LLUICtrl *ctrl, void* data); + static void onClickHUDCheck(LLUICtrl *ctrl, void* data); + static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); + static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status); + + virtual LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true) = 0; + virtual LLSnapshotModel::ESnapshotType getActiveSnapshotType(LLFloaterSnapshotBase* floater); + virtual LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater) = 0; + virtual std::string getSnapshotPanelPrefix() = 0; + + LLSnapshotLivePreview* getPreviewView(); + virtual void updateControls(LLFloaterSnapshotBase* floater) = 0; + virtual void updateLayout(LLFloaterSnapshotBase* floater); + virtual void updateLivePreview(); + virtual void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); + virtual EStatus getStatus() const { return mStatus; } + virtual void setNeedRefresh(bool need); + + virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0; + virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); + void setWorking(bool working); + virtual void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) = 0; + +public: + LLFloaterSnapshotBase* mFloater; + std::vector<LLAnimPauseRequest> mAvatarPauseHandles; + + LLToolset* mLastToolset; + LLHandle<LLView> mPreviewHandle; + bool mAspectRatioCheckOff; + bool mNeedRefresh; + EStatus mStatus; }; class LLFloaterSnapshot : public LLFloaterSnapshotBase @@ -64,51 +137,65 @@ class LLFloaterSnapshot : public LLFloaterSnapshotBase LOG_CLASS(LLFloaterSnapshot); public: - //typedef enum e_snapshot_format - //{ - // SNAPSHOT_FORMAT_PNG, - // SNAPSHOT_FORMAT_JPEG, - // SNAPSHOT_FORMAT_BMP - //} ESnapshotFormat; - LLFloaterSnapshot(const LLSD& key); - virtual ~LLFloaterSnapshot(); + /*virtual*/ ~LLFloaterSnapshot(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); /*virtual*/ S32 notify(const LLSD& info); static void update(); - // TODO: create a snapshot model instead static LLFloaterSnapshot* getInstance(); - static LLFloaterSnapshot* findInstance(); - static void saveTexture(); - static BOOL saveLocal(); - static void postSave(); - static void postPanelSwitch(); - static LLPointer<LLImageFormatted> getImageData(); - static const LLVector3d& getPosTakenGlobal(); + /*virtual*/ void saveTexture(); + BOOL saveLocal(); static void setAgentEmail(const std::string& email); - static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } - -private: - static LLUICtrl* sThumbnailPlaceholder; - LLUICtrl *mRefreshBtn, *mRefreshLabel; - LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; - class Impl; - Impl& impl; + friend Impl; }; -class LLFloaterSnapshotBase::ImplBase +///---------------------------------------------------------------------------- +/// Class LLFloaterSnapshot::Impl +///---------------------------------------------------------------------------- + +class LLFloaterSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase { + LOG_CLASS(LLFloaterSnapshot::Impl); public: - ImplBase(); - ~ImplBase(); + Impl(LLFloaterSnapshotBase* floater) + : LLFloaterSnapshotBase::ImplBase(floater) + {} + ~Impl() + {} + + void applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked); + void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); + static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); + void onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val); + void onImageFormatChange(LLFloaterSnapshotBase* view); + void applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h); + static void onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status); + BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); + void setImageSizeSpinnersValues(LLFloaterSnapshotBase *view, S32 width, S32 height); + void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); + + /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true); + /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater); + LLSpinCtrl* getWidthSpinner(LLFloaterSnapshotBase* floater); + LLSpinCtrl* getHeightSpinner(LLFloaterSnapshotBase* floater); + void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable); + void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked); + /*virtual*/ std::string getSnapshotPanelPrefix(); + + void setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname); + /*virtual*/ void updateControls(LLFloaterSnapshotBase* floater); + +private: + /*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater); + void comboSetCustom(LLFloaterSnapshotBase *floater, const std::string& comboname); + void checkAspectRatio(LLFloaterSnapshotBase *view, S32 index); + void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); }; class LLSnapshotFloaterView : public LLFloaterView |