More updates to preferences UI and bug fixes.

This commit is contained in:
TighMacFanatic
2011-05-28 21:31:35 -04:00
parent 139a3d35bb
commit da23cd1f42
6 changed files with 292 additions and 274 deletions

View File

@@ -53,6 +53,9 @@ LLPrefsAscentChat::LLPrefsAscentChat()
childSetAction("EmSpell_Add", onSpellAdd, this); childSetAction("EmSpell_Add", onSpellAdd, this);
childSetAction("EmSpell_Remove", onSpellRemove, this); childSetAction("EmSpell_Remove", onSpellRemove, this);
childSetCommitCallback("time_format_combobox", onCommitTimeDate, this);
childSetCommitCallback("date_format_combobox", onCommitTimeDate, this);
childSetCommitCallback("AscentInstantMessageResponseAnyone", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseAnyone", onCommitAutoResponse, this);
childSetCommitCallback("AscentInstantMessageResponseFriends", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseFriends", onCommitAutoResponse, this);
childSetCommitCallback("AscentInstantMessageResponseMuted", onCommitAutoResponse, this); childSetCommitCallback("AscentInstantMessageResponseMuted", onCommitAutoResponse, this);
@@ -128,6 +131,62 @@ void LLPrefsAscentChat::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata
} }
} }
//static
void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata)
{
LLPrefsAscentChat* self = (LLPrefsAscentChat*)userdata;
LLComboBox* combo = (LLComboBox*)ctrl;
if (ctrl->getName() == "time_format_combobox")
{
self->tempTimeFormat = combo->getCurrentIndex();
}
else if (ctrl->getName() == "date_format_combobox")
{
self->tempDateFormat = combo->getCurrentIndex();
}
std::string short_date, long_date, short_time, long_time, timestamp;
if (self->tempTimeFormat == 0)
{
short_time = "%H:%M";
long_time = "%H:%M:%S";
timestamp = " %H:%M:%S";
}
else
{
short_time = "%I:%M %p";
long_time = "%I:%M:%S %p";
timestamp = " %I:%M %p";
}
if (self->tempDateFormat == 0)
{
short_date = "%Y-%m-%d";
long_date = "%A %d %B %Y";
timestamp = "%a %d %b %Y" + timestamp;
}
else if (self->tempDateFormat == 1)
{
short_date = "%d/%m/%Y";
long_date = "%A %d %B %Y";
timestamp = "%a %d %b %Y" + timestamp;
}
else
{
short_date = "%m/%d/%Y";
long_date = "%A, %B %d %Y";
timestamp = "%a %b %d %Y" + timestamp;
}
gSavedSettings.setString("ShortDateFormat", short_date);
gSavedSettings.setString("LongDateFormat", long_date);
gSavedSettings.setString("ShortTimeFormat", short_time);
gSavedSettings.setString("LongTimeFormat", long_time);
gSavedSettings.setString("TimestampFormat", timestamp);
}
//static //static
void LLPrefsAscentChat::onCommitAutoResponse(LLUICtrl* ctrl, void* user_data) void LLPrefsAscentChat::onCommitAutoResponse(LLUICtrl* ctrl, void* user_data)
{ {
@@ -209,6 +268,9 @@ void LLPrefsAscentChat::refreshValues()
mDateFormat = 0; mDateFormat = 0;
} }
tempTimeFormat = mTimeFormat;
tempDateFormat = mDateFormat;
mIMResponseAnyone = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseAnyone"); mIMResponseAnyone = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseAnyone");
mIMResponseFriends = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseFriends"); mIMResponseFriends = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseFriends");
mIMResponseMuted = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseMuted"); mIMResponseMuted = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseMuted");
@@ -433,59 +495,6 @@ void LLPrefsAscentChat::cancel()
// Update local copy so cancel has no effect // Update local copy so cancel has no effect
void LLPrefsAscentChat::apply() void LLPrefsAscentChat::apply()
{ {
//Chat/IM -----------------------------------------------------------------------------
LLComboBox* combo = getChild<LLComboBox>("time_format_combobox");
if (combo)
{
mTimeFormat = combo->getCurrentIndex();
}
combo = getChild<LLComboBox>("date_format_combobox");
if (combo)
{
mDateFormat = combo->getCurrentIndex();
}
std::string short_date, long_date, short_time, long_time, timestamp;
if (mTimeFormat == 0)
{
short_time = "%H:%M";
long_time = "%H:%M:%S";
timestamp = " %H:%M:%S";
}
else
{
short_time = "%I:%M %p";
long_time = "%I:%M:%S %p";
timestamp = " %I:%M %p";
}
if (mDateFormat == 0)
{
short_date = "%Y-%m-%d";
long_date = "%A %d %B %Y";
timestamp = "%a %d %b %Y" + timestamp;
}
else if (mDateFormat == 1)
{
short_date = "%d/%m/%Y";
long_date = "%A %d %B %Y";
timestamp = "%a %d %b %Y" + timestamp;
}
else
{
short_date = "%m/%d/%Y";
long_date = "%A, %B %d %Y";
timestamp = "%a %b %d %Y" + timestamp;
}
gSavedSettings.setString("ShortDateFormat", short_date);
gSavedSettings.setString("LongDateFormat", long_date);
gSavedSettings.setString("ShortTimeFormat", short_time);
gSavedSettings.setString("LongTimeFormat", long_time);
gSavedSettings.setString("TimestampFormat", timestamp);
refreshValues(); refreshValues();
refresh(); refresh();
} }

View File

@@ -53,6 +53,7 @@ protected:
static void onSpellGetMore(void* data); static void onSpellGetMore(void* data);
static void onSpellEditCustom(void* data); static void onSpellEditCustom(void* data);
static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata); static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata);
static void onCommitTimeDate(LLUICtrl* ctrl, void *userdata);
static void onCommitAutoResponse(LLUICtrl* ctrl, void* user_data); static void onCommitAutoResponse(LLUICtrl* ctrl, void* user_data);
static void onCommitKeywords(LLUICtrl* ctrl, void* user_data); static void onCommitKeywords(LLUICtrl* ctrl, void* user_data);
@@ -68,6 +69,8 @@ protected:
U32 mLinksForChattingObjects; U32 mLinksForChattingObjects;
U32 mTimeFormat; U32 mTimeFormat;
U32 mDateFormat; U32 mDateFormat;
U32 tempTimeFormat;
U32 tempDateFormat;
BOOL mSecondsInChatAndIMs; BOOL mSecondsInChatAndIMs;
BOOL mIMResponseAnyone; BOOL mIMResponseAnyone;

View File

@@ -87,7 +87,7 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, void* user_data)
// llinfos << "Change to " << ctrl->getControlName() << " aka " << ctrl->getName() << llendl; // llinfos << "Change to " << ctrl->getControlName() << " aka " << ctrl->getName() << llendl;
if (ctrl->getName() == "speed_rez_check") // Why is this one getControlName() and the rest are getName()? if (ctrl->getName() == "speed_rez_check")
{ {
bool enabled = self->childGetValue("speed_rez_check").asBoolean(); bool enabled = self->childGetValue("speed_rez_check").asBoolean();
self->childSetEnabled("speed_rez_interval", enabled); self->childSetEnabled("speed_rez_interval", enabled);

View File

@@ -54,6 +54,8 @@ LLPrefsAscentVan::LLPrefsAscentVan()
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_vanity.xml"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_vanity.xml");
childSetCommitCallback("tag_spoofing_combobox", onCommitClientTag, this);
childSetCommitCallback("show_my_tag_check", onCommitCheckBox, this); childSetCommitCallback("show_my_tag_check", onCommitCheckBox, this);
childSetCommitCallback("show_self_tag_check", onCommitCheckBox, this); childSetCommitCallback("show_self_tag_check", onCommitCheckBox, this);
childSetCommitCallback("show_self_tag_color_check", onCommitCheckBox, this); childSetCommitCallback("show_self_tag_color_check", onCommitCheckBox, this);
@@ -62,7 +64,6 @@ LLPrefsAscentVan::LLPrefsAscentVan()
childSetCommitCallback("use_status_check", onCommitCheckBox, this); childSetCommitCallback("use_status_check", onCommitCheckBox, this);
childSetCommitCallback("custom_tag_label_box", onCommitTextModified, this); childSetCommitCallback("custom_tag_label_box", onCommitTextModified, this);
// childSetCommitCallback("custom_tag_color_swatch", onCommitColor, this);
childSetCommitCallback("X Modifier", onCommitUpdateAvatarOffsets); childSetCommitCallback("X Modifier", onCommitUpdateAvatarOffsets);
childSetCommitCallback("Y Modifier", onCommitUpdateAvatarOffsets); childSetCommitCallback("Y Modifier", onCommitUpdateAvatarOffsets);
@@ -78,6 +79,37 @@ LLPrefsAscentVan::~LLPrefsAscentVan()
{ {
} }
//static
void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata)
{
std::string client_uuid;
U32 client_index;
LLPrefsAscentVan* self = (LLPrefsAscentVan*)userdata;
LLComboBox* combo = (LLComboBox*)ctrl;
if (combo)
{
client_index = combo->getCurrentIndex();
//Don't rebake if it's not neccesary.
if (client_index != self->mSelectedClient)
{
client_uuid = combo->getSelectedValue().asString();
gSavedSettings.setString("AscentReportClientUUID", client_uuid);
gSavedSettings.setU32("AscentReportClientIndex", client_index);
LLVOAvatar* avatar = gAgent.getAvatarObject();
if (avatar)
{
// Slam pending upload count to "unstick" things
bool slam_for_debug = true;
avatar->forceBakeAllTextures(slam_for_debug);
}
}
}
}
//static //static
void LLPrefsAscentVan::onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata) void LLPrefsAscentVan::onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata)
{ {
@@ -332,33 +364,6 @@ void LLPrefsAscentVan::cancel()
// Update local copy so cancel has no effect // Update local copy so cancel has no effect
void LLPrefsAscentVan::apply() void LLPrefsAscentVan::apply()
{ {
std::string client_uuid;
U32 client_index;
//General -----------------------------------------------------------------------------
//Tags\Colors -------------------------------------------------------------------------
LLComboBox* combo = getChild<LLComboBox>("tag_spoofing_combobox");
if (combo)
{
client_index = combo->getCurrentIndex();
//Don't rebake if it's not neccesary.
if (client_index != mSelectedClient)
{
client_uuid = combo->getSelectedValue().asString();
gSavedSettings.setString("AscentReportClientUUID", client_uuid);
gSavedSettings.setU32("AscentReportClientIndex", client_index);
LLVOAvatar* avatar = gAgent.getAvatarObject();
if (!avatar) return;
// Slam pending upload count to "unstick" things
bool slam_for_debug = true;
avatar->forceBakeAllTextures(slam_for_debug);
}
}
//Body Dynamics -----------------------------------------------------------------------
refreshValues(); refreshValues();
refresh(); refresh();
} }

View File

@@ -49,6 +49,7 @@ public:
// LLPanel* getPanel(); // LLPanel* getPanel();
protected: protected:
static void onCommitClientTag(LLUICtrl* ctrl, void* userdata);
static void onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata); static void onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata);
static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data); static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data);
static void onCommitTextModified(LLUICtrl* ctrl, void* userdata); static void onCommitTextModified(LLUICtrl* ctrl, void* userdata);