summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2012-02-03 19:45:00 +0100
committerKitty Barnett <develop@catznip.com>2012-02-03 19:45:00 +0100
commit49e0c38ee85214eb7d0e7e995d1a380ee2f60720 (patch)
treed4beee5beb7e85d782d4fc750b09cae997e215c3 /indra/newview/llfloaterpreference.cpp
parent41e11a508379d8f6d2b95f835d2df9f4e2bbea01 (diff)
STORM-276 Added preferences panel
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rwxr-xr-xindra/newview/llfloaterpreference.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a333989e7e..29b07d2479 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -66,6 +66,7 @@
#include "llsky.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
+#include "llspellcheck.h"
#include "llsliderctrl.h"
#include "lltabcontainer.h"
#include "lltrans.h"
@@ -110,6 +111,8 @@
#include "lllogininstance.h" // to check if logged in yet
#include "llsdserialize.h"
+#include <boost/algorithm/string.hpp>
+
const F32 MAX_USER_FAR_CLIP = 512.f;
const F32 MIN_USER_FAR_CLIP = 64.f;
const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f;
@@ -445,6 +448,9 @@ BOOL LLFloaterPreference::postBuild()
getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
+ getChild<LLUICtrl>("btn_spellcheck_moveleft")->setCommitCallback(boost::bind(&LLFloaterPreference::onClickDictMove, this, "list_spellcheck_active", "list_spellcheck_available"));
+ getChild<LLUICtrl>("btn_spellcheck_moveright")->setCommitCallback(boost::bind(&LLFloaterPreference::onClickDictMove, this, "list_spellcheck_available", "list_spellcheck_active"));
+
// if floater is opened before login set default localized busy message
if (LLStartUp::getStartupState() < STATE_STARTED)
{
@@ -577,6 +583,19 @@ void LLFloaterPreference::apply()
}
}
+ if (hasChild("check_spellcheck"), TRUE)
+ {
+ LLScrollListCtrl* list_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_active");
+ std::vector<LLScrollListItem*> list_items = list_ctrl->getAllData();
+
+ std::list<std::string> list_dict;
+ list_dict.push_back(LLSpellChecker::instance().getActiveDictionary());
+ for (std::vector<LLScrollListItem*>::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it)
+ list_dict.push_back((*item_it)->getColumn(0)->getValue().asString());
+
+ gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ","));
+ }
+
saveAvatarProperties();
if (mClickActionDirty)
@@ -687,6 +706,8 @@ void LLFloaterPreference::onOpen(const LLSD& key)
// Load (double-)click to walk/teleport settings.
updateClickActionControls();
+ buildDictLists();
+
// Enabled/disabled popups, might have been changed by user actions
// while preferences floater was closed.
buildPopupLists();
@@ -865,6 +886,25 @@ void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue)
}
}
+void LLFloaterPreference::onClickDictMove(const std::string& from, const std::string& to)
+{
+ LLScrollListCtrl* from_ctrl = findChild<LLScrollListCtrl>(from);
+ LLScrollListCtrl* to_ctrl = findChild<LLScrollListCtrl>(to);
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
+ row["columns"][0]["font"]["style"] = "NORMAL";
+
+ std::vector<LLScrollListItem*> sel_items = from_ctrl->getAllSelected();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ row["columns"][0]["value"] = (*sel_it)->getColumn(0)->getValue();
+ to_ctrl->addElement(row);
+ }
+ from_ctrl->deleteSelectedItems();
+}
+
void LLFloaterPreference::onClickSetCache()
{
std::string cur_name(gSavedSettings.getString("CacheLocation"));
@@ -930,6 +970,61 @@ void LLFloaterPreference::refreshSkin(void* data)
self->getChild<LLRadioGroup>("skin_selection", true)->setValue(sSkin);
}
+void LLFloaterPreference::buildDictLists()
+{
+ LLComboBox* dict_combo = findChild<LLComboBox>("combo_spellcheck_dict");
+ dict_combo->clearRows();
+
+ LLScrollListCtrl* active_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_active");
+ active_ctrl->clearRows();
+
+ LLScrollListCtrl* avail_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_available");
+ avail_ctrl->clearRows();
+
+ if (LLSpellChecker::getUseSpellCheck())
+ {
+ // Populate the main dictionary combobox
+ const LLSD& dict_map = LLSpellChecker::instance().getDictionaryMap();
+ if (dict_map.size())
+ {
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ if ( (dict["installed"].asBoolean()) && (dict.has("language")) )
+ dict_combo->add(dict["language"].asString());
+ }
+ dict_combo->selectByValue(LLSpellChecker::instance().getActiveDictionary());
+ }
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
+ row["columns"][0]["font"]["style"] = "NORMAL";
+
+ // Populate the active dictionary list
+ LLSpellChecker::dict_list_t active_list = LLSpellChecker::instance().getSecondaryDictionaries();
+ active_ctrl->sortByColumnIndex(0, true);
+ for (LLSpellChecker::dict_list_t::const_iterator it = active_list.begin(); it != active_list.end(); ++it)
+ {
+ row["columns"][0]["value"] = *it;
+ active_ctrl->addElement(row);
+ }
+ active_list.push_back(LLSpellChecker::instance().getActiveDictionary());
+
+ // Populate the available dictionary list
+ avail_ctrl->sortByColumnIndex(0, true);
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ if ( (dict["installed"].asBoolean()) && (dict.has("language")) &&
+ (active_list.end() == std::find(active_list.begin(), active_list.end(), dict["language"].asString())) )
+ {
+ row["columns"][0]["value"] = dict["language"].asString();
+ avail_ctrl->addElement(row);
+ }
+ }
+ }
+}
void LLFloaterPreference::buildPopupLists()
{