Changed how the 'client' column in avatar radar is handled. Initially was not designed nor tested to be toggleable on user-demand (was one shot deal depending on detected grid).

This commit is contained in:
Shyotl
2013-01-15 23:14:58 -06:00
parent a6e3352073
commit 6894d4c0bc
2 changed files with 47 additions and 25 deletions

View File

@@ -6461,6 +6461,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key> <key>Value</key>
<integer>52</integer> <integer>52</integer>
</map> </map>
<key>RadarColumnNameWidth</key>
<map>
<key>Comment</key>
<string>Width for radar's name column</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>80</integer>
</map>
<key>RadarColumnMarkHidden</key> <key>RadarColumnMarkHidden</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -427,7 +427,7 @@ BOOL LLFloaterAvatarList::postBuild()
return TRUE; return TRUE;
} }
void col_helper(const bool hide, const std::string width_ctrl_name, LLScrollListColumn* col) void col_helper(const bool hide, LLCachedControl<S32> &setting, LLScrollListColumn* col)
{ {
// Brief Explanation: // Brief Explanation:
// Check if we want the column hidden, and if it's still showing. If so, hide it, but save its width. // Check if we want the column hidden, and if it's still showing. If so, hide it, but save its width.
@@ -437,44 +437,55 @@ void col_helper(const bool hide, const std::string width_ctrl_name, LLScrollList
if (hide && width) if (hide && width)
{ {
gSavedSettings.setS32(width_ctrl_name, width); setting = width;
col->setWidth(0); col->setWidth(0);
} }
else if(!hide && !width) else if(!hide && !width)
{ {
llinfos << "We got into the setter!!" << llendl; col->setWidth(setting);
col->setWidth(gSavedSettings.getS32(width_ctrl_name));
} }
} }
//Macro to reduce redundant lines. Preprocessor concatenation and stringizing avoids bloat that
//wrapping in a class would create.
#define BIND_COLUMN_TO_SETTINGS(col, name)\
static const LLCachedControl<bool> hide_##name(gSavedSettings, "RadarColumn"#name"Hidden");\
static LLCachedControl<S32> width_##name(gSavedSettings, "RadarColumn"#name"Width");\
col_helper(hide_##name, width_##name, mAvatarList->getColumn(col));
void LLFloaterAvatarList::assessColumns() void LLFloaterAvatarList::assessColumns()
{ {
static LLCachedControl<bool> hide_mark(gSavedSettings, "RadarColumnMarkHidden"); BIND_COLUMN_TO_SETTINGS(LIST_MARK,Mark);
col_helper(hide_mark, "RadarColumnMarkWidth", mAvatarList->getColumn(LIST_MARK)); BIND_COLUMN_TO_SETTINGS(LIST_POSITION,Position);
BIND_COLUMN_TO_SETTINGS(LIST_ALTITUDE,Altitude);
BIND_COLUMN_TO_SETTINGS(LIST_ACTIVITY,Activity);
BIND_COLUMN_TO_SETTINGS(LIST_AGE,Age);
BIND_COLUMN_TO_SETTINGS(LIST_TIME,Time);
static LLCachedControl<bool> hide_pos(gSavedSettings, "RadarColumnPositionHidden"); static const LLCachedControl<bool> hide_client(gSavedSettings, "RadarColumnClientHidden");
col_helper(hide_pos, "RadarColumnPositionWidth", mAvatarList->getColumn(LIST_POSITION)); static LLCachedControl<S32> width_name(gSavedSettings, "RadarColumnNameWidth");
bool client_hidden = hide_client || gHippoGridManager->getConnectedGrid()->isSecondLife();
LLScrollListColumn* name_col = mAvatarList->getColumn(LIST_AVATAR_NAME);
LLScrollListColumn* client_col = mAvatarList->getColumn(LIST_CLIENT);
static LLCachedControl<bool> hide_alt(gSavedSettings, "RadarColumnAltitudeHidden"); if (client_hidden != !!name_col->mDynamicWidth)
col_helper(hide_alt, "RadarColumnAltitudeWidth", mAvatarList->getColumn(LIST_ALTITUDE)); {
//Don't save if its being hidden because of detected grid. Not that it really matters, as this setting(along with the other RadarColumn*Width settings)
//isn't handled in a way that allows it to carry across sessions, but I assume that may want to be fixed in the future..
if(client_hidden && !gHippoGridManager->getConnectedGrid()->isSecondLife() && name_col->getWidth() > 0)
width_name = name_col->getWidth();
static LLCachedControl<bool> hide_act(gSavedSettings, "RadarColumnActivityHidden"); //MUST call setWidth(0) first to clear out mTotalStaticColumnWidth accumulation in parent before changing the mDynamicWidth value
col_helper(hide_act, "RadarColumnActivityWidth", mAvatarList->getColumn(LIST_ACTIVITY)); client_col->setWidth(0);
name_col->setWidth(0);
static LLCachedControl<bool> hide_age(gSavedSettings, "RadarColumnAgeHidden"); client_col->mDynamicWidth = !client_hidden;
col_helper(hide_age, "RadarColumnAgeWidth", mAvatarList->getColumn(LIST_AGE)); name_col->mDynamicWidth = client_hidden;
static LLCachedControl<bool> hide_time(gSavedSettings, "RadarColumnTimeHidden"); if(!client_hidden)
col_helper(hide_time, "RadarColumnTimeWidth", mAvatarList->getColumn(LIST_TIME)); {
name_col->setWidth(width_name);
static LLCachedControl<bool> hide_client(gSavedSettings, "RadarColumnClientHidden"); }
if (gHippoGridManager->getConnectedGrid()->isSecondLife() || hide_client){
mAvatarList->getColumn(LIST_AVATAR_NAME)->setWidth(0);
mAvatarList->getColumn(LIST_CLIENT)->setWidth(0);
mAvatarList->getColumn(LIST_CLIENT)->mDynamicWidth = FALSE;
mAvatarList->getColumn(LIST_CLIENT)->mRelWidth = 0;
mAvatarList->getColumn(LIST_AVATAR_NAME)->mDynamicWidth = TRUE;
mAvatarList->getColumn(LIST_AVATAR_NAME)->mRelWidth = -1;
} }
mAvatarList->updateLayout(); mAvatarList->updateLayout();