MAINT-4824 FIXED Show remaining time before resident's name

master
Mnikolenko ProductEngine 2015-01-28 12:05:01 +02:00
parent 8f7064a871
commit 20d70dca94
4 changed files with 25 additions and 23 deletions

View File

@ -2410,33 +2410,33 @@ void LLPanelLandAccess::refresh()
cit != parcel->mAccessList.end(); ++cit)
{
const LLAccessEntry& entry = (*cit).second;
std::string suffix;
std::string prefix;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
S32 seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
suffix.assign(" (");
prefix.assign(" (");
if (seconds >= 120)
{
args["[MINUTES]"] = llformat("%d", (seconds/60));
std::string buf = parent_floater->getString ("Minutes", args);
suffix.append(buf);
prefix.append(buf);
}
else if (seconds >= 60)
{
suffix.append("1 " + parent_floater->getString("Minute"));
prefix.append("1 " + parent_floater->getString("Minute"));
}
else
{
args["[SECONDS]"] = llformat("%d", seconds);
std::string buf = parent_floater->getString ("Seconds", args);
suffix.append(buf);
prefix.append(buf);
}
suffix.append(" " + parent_floater->getString("Remaining") + ")");
prefix.append(" " + parent_floater->getString("Remaining") + ") ");
}
mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, suffix);
mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
}
mListAccess->sortByName(TRUE);
}
@ -2456,33 +2456,33 @@ void LLPanelLandAccess::refresh()
cit != parcel->mBanList.end(); ++cit)
{
const LLAccessEntry& entry = (*cit).second;
std::string suffix;
std::string prefix;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
S32 seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
suffix.assign(" (");
prefix.assign(" (");
if (seconds >= 120)
{
args["[MINUTES]"] = llformat("%d", (seconds/60));
std::string buf = parent_floater->getString ("Minutes", args);
suffix.append(buf);
prefix.append(buf);
}
else if (seconds >= 60)
{
suffix.append("1 " + parent_floater->getString("Minute"));
prefix.append("1 " + parent_floater->getString("Minute"));
}
else
{
args["[SECONDS]"] = llformat("%d", seconds);
std::string buf = parent_floater->getString ("Seconds", args);
suffix.append(buf);
prefix.append(buf);
}
suffix.append(" " + parent_floater->getString("Remaining") + ")");
prefix.append(" " + parent_floater->getString("Remaining") + ") ");
}
mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, suffix);
mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
}
mListBanned->sortByName(TRUE);
}

View File

@ -70,7 +70,7 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p)
// public
LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
BOOL enabled, const std::string& suffix)
BOOL enabled, const std::string& suffix, const std::string& prefix)
{
//LL_INFOS() << "LLNameListCtrl::addNameItem " << agent_id << LL_ENDL;
@ -79,7 +79,7 @@ LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPositi
item.enabled = enabled;
item.target = INDIVIDUAL;
return addNameItemRow(item, pos, suffix);
return addNameItemRow(item, pos, suffix, prefix);
}
// virtual, public
@ -291,7 +291,8 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p
LLScrollListItem* LLNameListCtrl::addNameItemRow(
const LLNameListCtrl::NameItem& name_item,
EAddPosition pos,
const std::string& suffix)
const std::string& suffix,
const std::string& prefix)
{
LLUUID id = name_item.value().asUUID();
LLNameListItem* item = new LLNameListItem(name_item,name_item.target() == GROUP);
@ -365,7 +366,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
if (cell)
{
cell->setValue(fullname);
cell->setValue(prefix + fullname);
}
dirtyColumns();

View File

@ -129,11 +129,12 @@ public:
// Add a user to the list by name. It will be added, the name
// requested from the cache, and updated as necessary.
LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null);
BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null, const std::string& prefix = LLStringUtil::null);
LLScrollListItem* addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
/*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, const std::string& suffix = LLStringUtil::null);
LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, const std::string& suffix = LLStringUtil::null,
const std::string& prefix = LLStringUtil::null);
// Add a user to the list by name. It will be added, the name
// requested from the cache, and updated as necessary.

View File

@ -23,15 +23,15 @@
</floater.string>
<floater.string
name="Minutes">
[MINUTES] minutes
[MINUTES] min.
</floater.string>
<floater.string
name="Minute">
minute
min.
</floater.string>
<floater.string
name="Seconds">
[SECONDS] seconds
[SECONDS] sec.
</floater.string>
<floater.string
name="Remaining">