summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r--indra/newview/llfloaterpreference.cpp74
1 files changed, 47 insertions, 27 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 4434a8013d..e20249a737 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -56,6 +56,7 @@
#include "llfloaterabout.h"
#include "llfloaterhardwaresettings.h"
#include "llfloatervoicedevicesettings.h"
+#include "llimfloater.h"
#include "llkeyboard.h"
#include "llmodaldialog.h"
#include "llnavigationbar.h"
@@ -164,7 +165,6 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
{
mParent->setKey(key);
}
-
closeFloater();
return result;
}
@@ -310,7 +310,8 @@ F32 LLFloaterPreference::sAspectRatio = 0.0;
LLFloaterPreference::LLFloaterPreference(const LLSD& key)
: LLFloater(key),
mGotPersonalInfo(false),
- mOriginalIMViaEmail(false)
+ mOriginalIMViaEmail(false),
+ mCancelOnClose(true)
{
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
@@ -338,7 +339,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
- mCommitCallbackRegistrar.add("Pref.Logging", boost::bind(&LLFloaterPreference::onCommitLogging, this));
mCommitCallbackRegistrar.add("Pref.UpdateMeterText", boost::bind(&LLFloaterPreference::updateMeterText, this, _1));
mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
@@ -358,6 +358,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
BOOL LLFloaterPreference::postBuild()
{
+ gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
+
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
tabcontainer->selectFirstTab();
@@ -391,6 +393,20 @@ void LLFloaterPreference::draw()
LLFloater::draw();
}
+void LLFloaterPreference::saveSettings()
+{
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ child_list_t::const_iterator end = tabcontainer->getChildList()->end();
+ for ( ; iter != end; ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ panel->saveSettings();
+ }
+}
+
void LLFloaterPreference::apply()
{
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
@@ -445,6 +461,8 @@ void LLFloaterPreference::apply()
// LLWString busy_response = utf8str_to_wstring(getChild<LLUICtrl>("busy_response")->getValue().asString());
// LLWStringUtil::replaceTabsWithSpaces(busy_response, 4);
+
+ gSavedSettings.setBOOL("PlainTextChatHistory", childGetValue("plain_text_chat_history").asBoolean());
if(mGotPersonalInfo)
{
@@ -552,6 +570,11 @@ void LLFloaterPreference::onOpen(const LLSD& key)
LLPanelLogin::setAlwaysRefresh(true);
refresh();
+
+ // Make sure the current state of prefs are saved away when
+ // when the floater is opened. That will make cancel do its
+ // job
+ saveSettings();
}
void LLFloaterPreference::onVertexShaderEnable()
@@ -570,7 +593,7 @@ void LLFloaterPreference::onClose(bool app_quitting)
{
gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
LLPanelLogin::setAlwaysRefresh(false);
- cancel(); // will be a no-op if OK or apply was performed just prior.
+ if (mCancelOnClose) cancel();
}
void LLFloaterPreference::onOpenHardwareSettings()
@@ -593,7 +616,11 @@ void LLFloaterPreference::onBtnOK()
if (canClose())
{
apply();
+ // Here we do not want to cancel on close, so we do this funny thing
+ // that prevents cancel from undoing our changes when we hit OK
+ mCancelOnClose = false;
closeFloater(false);
+ mCancelOnClose = true;
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
LLUIColorTable::instance().saveUserSettings();
std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
@@ -621,6 +648,7 @@ void LLFloaterPreference::onBtnApply( )
}
}
apply();
+ saveSettings();
LLPanelLogin::refreshLocation( false );
}
@@ -637,7 +665,8 @@ void LLFloaterPreference::onBtnCancel()
}
refresh();
}
- closeFloater(); // side effect will also cancel any unsaved changes.
+ cancel();
+ closeFloater();
}
// static
@@ -1133,27 +1162,6 @@ void LLFloaterPreference::onClickLogPath()
gSavedPerAccountSettings.setString("InstantMessageLogFolder",chat_log_top_folder);
}
-void LLFloaterPreference::onCommitLogging()
-{
- enableHistory();
-}
-
-void LLFloaterPreference::enableHistory()
-{
- if (childGetValue("log_instant_messages").asBoolean())
- {
- childEnable("ChatIMLogs");
- childEnable("log_path_button");
- childEnable("show_timestamps_check_im");
- }
- else
- {
- childDisable("ChatIMLogs");
- childDisable("log_path_button");
- childDisable("show_timestamps_check_im");
- }
-}
-
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
{
mGotPersonalInfo = true;
@@ -1183,6 +1191,8 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility);
childEnable("send_im_to_email");
childSetValue("send_im_to_email", im_via_email);
+ childEnable("plain_text_chat_history");
+ childSetValue("plain_text_chat_history", gSavedSettings.getBOOL("PlainTextChatHistory"));
childEnable("log_instant_messages");
// childEnable("log_chat");
// childEnable("busy_response");
@@ -1193,7 +1203,12 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
// childSetText("busy_response", gSavedSettings.getString("BusyModeResponse2"));
- enableHistory();
+ childEnable("log_nearby_chat");
+ childEnable("log_instant_messages");
+ childEnable("show_timestamps_check_im");
+ childEnable("log_path_string");
+ childEnable("log_path_button");
+
std::string display_email(email);
childSetText("email_address",display_email);
@@ -1510,6 +1525,11 @@ BOOL LLPanelPreference::postBuild()
void LLPanelPreference::apply()
{
+ // no-op
+}
+
+void LLPanelPreference::saveSettings()
+{
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;