summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp102
-rw-r--r--indra/newview/llfloatereditextdaycycle.h15
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp1
-rw-r--r--indra/newview/llpanelenvironment.cpp20
-rw-r--r--indra/newview/llpanelenvironment.h6
-rw-r--r--indra/newview/llviewernetwork.cpp2
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp4
7 files changed, 131 insertions, 19 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 6a328b2e85..6abb698785 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -137,7 +137,8 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :
mWaterBlender(),
mScratchSky(),
mScratchWater(),
- mIsPlaying(false)
+ mIsPlaying(false),
+ mIsDirty(false)
{
mCommitCallbackRegistrar.add(EVNT_DAYTRACK, [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); });
@@ -175,7 +176,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE);
mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); });
- getChild<LLButton>(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onBtnCancel(); });
+ getChild<LLButton>(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); });
mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderMoved(); });
mAddFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onAddTrack(); });
mDeleteFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onRemoveTrack(); });
@@ -189,6 +190,26 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
mTimeSlider->addSlider(0);
+ LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
+ S32 tab_count = tab_container->getTabCount();
+
+ for (S32 idx = 0; idx < tab_count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
+ if (panel)
+ panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); });
+ }
+
+ tab_container = mWaterTabLayoutContainer->getChild<LLTabContainer>("water_tabs");
+ tab_count = tab_container->getTabCount();
+
+ for (S32 idx = 0; idx < tab_count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
+ if (panel)
+ panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); });
+ }
+
//getChild<LLButton>("sky1_track", true)->setToggleState(true);
return TRUE;
@@ -312,12 +333,12 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting)
doCloseInventoryFloater(app_quitting);
// there's no point to change environment if we're quitting
// or if we already restored environment
- if (!app_quitting && LLEnvironment::instance().getSelectedEnvironment() == LLEnvironment::ENV_EDIT)
+ stopPlay();
+ if (!app_quitting)
{
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_FAST);
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
}
- stopPlay();
}
void LLFloaterEditExtDayCycle::onFocusReceived()
@@ -355,7 +376,7 @@ void LLFloaterEditExtDayCycle::refresh()
mFlyoutControl->setMenuItemVisible(ACTION_APPLY_PARCEL, show_apply);
mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply);
- mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit);
+ mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit && !mCommitSignal.empty());
mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail);
mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail);
mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true);
@@ -445,14 +466,18 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
}
}
-void LLFloaterEditExtDayCycle::onBtnCancel()
+
+void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/)
{
- closeFloater(); // will restore env
+ if (!app_quitting)
+ checkAndConfirmSettingsLoss([this](){ closeFloater(); });
+ else
+ closeFloater();
}
void LLFloaterEditExtDayCycle::onButtonImport()
{
- doImportFromDisk();
+ checkAndConfirmSettingsLoss([this]() { doImportFromDisk(); });
}
void LLFloaterEditExtDayCycle::onButtonLoadFrame()
@@ -657,6 +682,35 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask)
selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
}
+
+void LLFloaterEditExtDayCycle::onPanelDirtyFlagChanged(bool value)
+{
+ if (value)
+ setDirtyFlag();
+}
+
+void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb)
+{
+ if (isDirty())
+ {
+ LLSD args(LLSDMap("TYPE", mEditDay->getSettingsType())
+ ("NAME", mEditDay->getName()));
+
+ // create and show confirmation textbox
+ LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
+ [this, cb](const LLSD&notif, const LLSD&resp)
+ {
+ S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
+ if (opt == 0)
+ cb();
+ });
+ }
+ else if (cb)
+ {
+ cb();
+ }
+}
+
void LLFloaterEditExtDayCycle::onTimeSliderMoved()
{
selectFrame(mTimeSlider->getCurSliderValue(), LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
@@ -1165,6 +1219,7 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent
return;
}
+ clearDirtyFlag();
setFocus(TRUE); // Call back the focus...
loadInventoryItem(inventory_id);
}
@@ -1173,6 +1228,7 @@ void LLFloaterEditExtDayCycle::onInventoryUpdated(LLUUID asset_id, LLUUID invent
{
LL_WARNS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL;
+ clearDirtyFlag();
if (inventory_id != mInventoryId)
{
loadInventoryItem(inventory_id);
@@ -1198,6 +1254,7 @@ void LLFloaterEditExtDayCycle::doImportFromDisk()
}
mCurrentTrack = 1;
+ setDirtyFlag();
setEditDayCycle(legacyday);
}
}
@@ -1274,6 +1331,33 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data)
}
+
+void LLFloaterEditExtDayCycle::clearDirtyFlag()
+{
+ mIsDirty = false;
+
+ LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
+ S32 tab_count = tab_container->getTabCount();
+
+ for (S32 idx = 0; idx < tab_count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
+ if (panel)
+ panel->clearIsDirty();
+ }
+
+ tab_container = mWaterTabLayoutContainer->getChild<LLTabContainer>("water_tabs");
+ tab_count = tab_container->getTabCount();
+
+ for (S32 idx = 0; idx < tab_count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
+ if (panel)
+ panel->clearIsDirty();
+ }
+
+}
+
void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID currasset)
{
// LLUI::sWindow->setCursor(UI_CURSOR_WAIT);
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 7d0489f0bc..ba269dd538 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -91,13 +91,15 @@ public:
BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
-private:
+ BOOL isDirty() const override { return getIsDirty(); }
+private:
+ typedef std::function<void()> on_confirm_fn;
F32 getCurrentFrame() const;
// flyout response/click
void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
- void onBtnCancel();
+ virtual void onClickCloseBtn(bool app_quitting = false) override;
void onButtonImport();
void onButtonLoadFrame();
void onAddTrack();
@@ -113,6 +115,10 @@ private:
void onFrameSliderMouseDown(S32 x, S32 y, MASK mask);
void onFrameSliderMouseUp(S32 x, S32 y, MASK mask);
+ void onPanelDirtyFlagChanged(bool);
+
+ void checkAndConfirmSettingsLoss(on_confirm_fn cb);
+
void selectTrack(U32 track_index, bool force = false);
void selectFrame(F32 frame, F32 slop_factor);
void clearTabs();
@@ -158,6 +164,10 @@ private:
void stopPlay();
static void onIdlePlay(void *);
+ bool getIsDirty() const { return mIsDirty; }
+ void setDirtyFlag() { mIsDirty = true; }
+ virtual void clearDirtyFlag();
+
LLSettingsDay::ptr_t mEditDay; // edited copy
LLSettingsDay::Seconds mDayLength;
U32 mCurrentTrack;
@@ -190,6 +200,7 @@ private:
LLFrameTimer mPlayTimer;
F32 mPlayStartFrame; // an env frame
bool mIsPlaying;
+ bool mIsDirty;
edit_commit_signal_t mCommitSignal;
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index cbc41f724e..ece4898935 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -273,7 +273,6 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro
{
cb();
}
-
}
void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID asset_id)
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index d91f9110e0..51b2fa380f 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -119,7 +119,19 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
if (new_visibility)
gIdleCallbacks.addFunction(onIdlePlay, this);
else
+ {
gIdleCallbacks.deleteFunction(onIdlePlay, this);
+ LLFloaterEditExtDayCycle *dayeditor = getEditFloater();
+ if (mCommitConnection.connected())
+ mCommitConnection.disconnect();
+ if (dayeditor)
+ {
+ if (dayeditor->isDirty())
+ dayeditor->refresh();
+ else
+ dayeditor->closeFloater();
+ }
+ }
}
@@ -213,13 +225,13 @@ LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker()
return picker;
}
-LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater()
+LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create)
{
static const S32 FOURHOURS(4 * 60 * 60);
LLFloaterEditExtDayCycle *editor = static_cast<LLFloaterEditExtDayCycle *>(mEditFloater.get());
// Show the dialog
- if (!editor)
+ if (!editor && create)
{
LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL)
(LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS));
@@ -228,9 +240,11 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater()
if (!editor)
return nullptr;
- editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); });
}
+ if (editor && !mCommitConnection.connected())
+ mCommitConnection = editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); });
+
return editor;
}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 6a0c784708..b867a7b61d 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -120,15 +120,19 @@ protected:
std::string getInventoryNameForAssetId(LLUUID asset_id);
LLFloaterSettingsPicker * getSettingsPicker();
- LLFloaterEditExtDayCycle * getEditFloater();
+ LLFloaterEditExtDayCycle * getEditFloater(bool create = true);
LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
S32 mCurrentParcelId;
+
private:
static void onIdlePlay(void *);
+ typedef boost::signals2::connection connection_t;
+
+ connection_t mCommitConnection;
LLHandle<LLFloater> mSettingsFloater;
LLHandle<LLFloater> mEditFloater;
S32 mDirtyFlag;
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 84c640fcf9..374322ac10 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -133,7 +133,7 @@ void LLGridManager::initialize(const std::string& grid_file)
addSystemGrid(LLTrans::getString("AditiGridLabel"),
"util.aditi.lindenlab.com",
"https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
- "https://aditi-secondlife.webdev.lindenlab.com/helpers/",
+ "https://secondlife.aditi.lindenlab.com/helpers/",
DEFAULT_LOGIN_PAGE,
SL_UPDATE_QUERY_URL,
"https://my.aditi.lindenlab.com/",
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index 22b576eb22..fe81fd63ea 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -258,7 +258,7 @@ namespace tut
std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
ensure_equals("Aditi helper uri",
LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
- std::string("https://aditi-secondlife.webdev.lindenlab.com/helpers/"));
+ std::string("https://secondlife.aditi.lindenlab.com/helpers/"));
ensure_equals("Aditi login page",
LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
std::string("https://viewer-splash.secondlife.com/"));
@@ -330,7 +330,7 @@ namespace tut
std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
ensure_equals("Aditi helper uri",
LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
- std::string("https://aditi-secondlife.webdev.lindenlab.com/helpers/"));
+ std::string("https://secondlife.aditi.lindenlab.com/helpers/"));
ensure_equals("Aditi login page",
LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
std::string("https://viewer-splash.secondlife.com/"));