summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterfixedenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterfixedenvironment.cpp')
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index fd72bb3624..0b4de90703 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -37,6 +37,7 @@
#include "llsliderctrl.h"
#include "lltabcontainer.h"
#include "llfilepicker.h"
+#include "llsettingspicker.h"
#include "llviewerparcelmgr.h"
@@ -64,6 +65,7 @@ namespace
const std::string BUTTON_NAME_COMMIT("btn_commit");
const std::string BUTTON_NAME_CANCEL("btn_cancel");
const std::string BUTTON_NAME_FLYOUT("btn_flyout");
+ const std::string BUTTON_NAME_LOAD("btn_load");
const std::string ACTION_SAVE("save_settings");
const std::string ACTION_SAVEAS("save_as_new_settings");
@@ -102,6 +104,7 @@ BOOL LLFloaterFixedEnvironment::postBuild()
getChild<LLButton>(BUTTON_NAME_IMPORT)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonImport(); });
getChild<LLButton>(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonCancel(); });
+ getChild<LLButton>(BUTTON_NAME_LOAD)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonLoad(); });
mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE);
mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); });
@@ -130,6 +133,8 @@ void LLFloaterFixedEnvironment::onOpen(const LLSD& key)
void LLFloaterFixedEnvironment::onClose(bool app_quitting)
{
+ doCloseInventoryFloater(app_quitting);
+
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
@@ -226,6 +231,12 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
[this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); });
}
+void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID asset_id)
+{
+ LLSettingsVOBase::getSettingsAsset(asset_id,
+ [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
+}
+
void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
{
if (!settings || status)
@@ -283,6 +294,27 @@ void LLFloaterFixedEnvironment::onButtonCancel()
this->closeFloater();
}
+void LLFloaterFixedEnvironment::onButtonLoad()
+{
+ // LLUI::sWindow->setCursor(UI_CURSOR_WAIT);
+ LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get());
+
+ // Show the dialog
+ if (!picker)
+ {
+ picker = new LLFloaterSettingsPicker(this,
+ LLUUID::null, "SELECT SETTINGS");
+
+ mInventoryFloater = picker->getHandle();
+
+ picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data.asUUID()); });
+ }
+
+ picker->setSettingsFilter(mSettings->getSettingsTypeValue());
+ picker->openFloater();
+ picker->setFocus(TRUE);
+}
+
void LLFloaterFixedEnvironment::doApplyCreateNewInventory()
{
LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
@@ -344,6 +376,16 @@ void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where)
}
+void LLFloaterFixedEnvironment::doCloseInventoryFloater(bool quitting)
+{
+ LLFloater* floaterp = mInventoryFloater.get();
+
+ if (floaterp)
+ {
+ floaterp->closeFloater(quitting);
+ }
+}
+
void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results)
{
LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL;