From 9d2c405ee419af3c316939a7fe12fbd97ce49f9b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 17 Jul 2020 23:19:37 +0300 Subject: SL-13516 Move dupplicated functionality of evironment editors into separate class --- indra/newview/llfloaterfixedenvironment.h | 76 ++----------------------------- 1 file changed, 5 insertions(+), 71 deletions(-) (limited to 'indra/newview/llfloaterfixedenvironment.h') diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 513996c4a3..1620bc101a 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -27,7 +27,7 @@ #ifndef LL_FLOATERFIXEDENVIRONMENT_H #define LL_FLOATERFIXEDENVIRONMENT_H -#include "llfloater.h" +#include "llfloatereditenvironmentbase.h" #include "llsettingsbase.h" #include "llflyoutcombobtn.h" #include "llinventory.h" @@ -43,15 +43,10 @@ class LLFixedSettingCopiedCallback; /** * Floater container for creating and editing fixed environment settings. */ -class LLFloaterFixedEnvironment : public LLFloater +class LLFloaterFixedEnvironment : public LLFloaterEditEnvironmentBase { LOG_CLASS(LLFloaterFixedEnvironment); - - friend class LLFixedSettingCopiedCallback; - public: - static const std::string KEY_INVENTORY_ID; - LLFloaterFixedEnvironment(const LLSD &key); ~LLFloaterFixedEnvironment(); @@ -59,26 +54,17 @@ public: virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; - virtual void onFocusReceived() override; - virtual void onFocusLost() override; - void setEditSettings(const LLSettingsBase::ptr_t &settings) { mSettings = settings; clearDirtyFlag(); syncronizeTabs(); refresh(); } - LLSettingsBase::ptr_t getEditSettings() const { return mSettings; } - - virtual BOOL isDirty() const override { return getIsDirty(); } + virtual LLSettingsBase::ptr_t getEditSettings() const override { return mSettings; } protected: typedef std::function on_confirm_fn; - virtual void updateEditEnvironment() = 0; virtual void refresh() override; + void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override; virtual void syncronizeTabs(); - LLFloaterSettingsPicker *getSettingsPicker(); - - void loadInventoryItem(const LLUUID &inventoryId, bool can_trans = true); - - void checkAndConfirmSettingsLoss(on_confirm_fn cb); + virtual LLFloaterSettingsPicker *getSettingsPicker() override; LLTabContainer * mTab; LLLineEditor * mTxtName; @@ -86,24 +72,9 @@ protected: LLSettingsBase::ptr_t mSettings; virtual void doImportFromDisk() = 0; - virtual void doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings); - virtual void doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings); - virtual void doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings); - void doCloseInventoryFloater(bool quitting = false); - - bool canUseInventory() const; - bool canApplyRegion() const; - bool canApplyParcel() const; LLFlyoutComboBtnCtrl * mFlyoutControl; - LLUUID mInventoryId; - LLInventoryItem * mInventoryItem; - LLHandle mInventoryFloater; - bool mCanCopy; - bool mCanMod; - bool mCanTrans; - void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); @@ -113,10 +84,8 @@ protected: virtual void clearDirtyFlag(); void doSelectFromInventory(); - void onPanelDirtyFlagChanged(bool); virtual void onClickCloseBtn(bool app_quitting = false) override; - void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings); private: void onNameChanged(const std::string &name); @@ -126,9 +95,6 @@ private: void onButtonLoad(); void onPickerCommitSetting(LLUUID item_id); - void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); - - bool mIsDirty; }; class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment @@ -172,36 +138,4 @@ protected: private: }; -class LLSettingsEditPanel : public LLPanel -{ -public: - virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; - - typedef boost::signals2::signal on_dirty_charged_sg; - typedef boost::signals2::connection connection_t; - - inline bool getIsDirty() const { return mIsDirty; } - inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } - inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } - - inline bool getCanChangeSettings() const { return mCanEdit; } - inline void setCanChangeSettings(bool flag) { mCanEdit = flag; } - - inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); } - - -protected: - LLSettingsEditPanel() : - LLPanel(), - mIsDirty(false), - mOnDirtyChanged() - {} - -private: - bool mIsDirty; - bool mCanEdit; - - on_dirty_charged_sg mOnDirtyChanged; -}; - #endif // LL_FLOATERFIXEDENVIRONMENT_H -- cgit v1.2.3