Transaction Notifications are now optionally Notify Tips for those who don't want them to collect at the top right of the screen, but still want a notification.

Debug setting LiruNoTransactionClutter has been added, and is toggled by checkbox in General preferences
This adds support for TransactionInfo message, to localize the server's transaction notifications.
Adds a notification called Payment, which unifies all three of v-d's Payment* notifications.

This is a fairly large change to view, keep in mind what was removed as it may just be in a slightly different order or position..
This commit is contained in:
Lirusaito
2012-12-02 17:52:36 -05:00
parent cbb27a5661
commit cfbc8a23f7
8 changed files with 325 additions and 14 deletions

View File

@@ -693,6 +693,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruNoTransactionClutter</key>
<map>
<key>Comment</key>
<string>Use notifytips for transactions instead of notifys, this way they do not collect in the top right of the screen.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruSensibleARC</key>
<map>
<key>Comment</key>

View File

@@ -72,6 +72,7 @@ BOOL LLPanelGeneral::postBuild()
childSetValue("show_my_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitle"));
childSetValue("afk_timeout_spinner", gSavedSettings.getF32("AFKTimeout"));
childSetValue("notify_money_change_checkbox", gSavedSettings.getBOOL("NotifyMoneyChange"));
childSetValue("no_transaction_clutter_checkbox", gSavedSettings.getBOOL("LiruNoTransactionClutter"));
@@ -111,6 +112,9 @@ BOOL LLPanelGeneral::postBuild()
childSetVisible("maturity_desired_combobox", can_choose);
childSetVisible("maturity_desired_textbox", !can_choose);
childSetEnabled("no_transaction_clutter_checkbox", gSavedSettings.getBOOL("NotifyMoneyChange"));
childSetCommitCallback("notify_money_change_checkbox", &onClickCheckbox, this);
childSetAction("clear_settings", &onClickClearSettings, this);
return TRUE;
@@ -147,6 +151,7 @@ void LLPanelGeneral::apply()
gSavedSettings.setBOOL("RenderHideGroupTitle", childGetValue("show_my_title_checkbox"));
gSavedSettings.setF32("AFKTimeout", childGetValue("afk_timeout_spinner").asReal());
gSavedSettings.setBOOL("NotifyMoneyChange", childGetValue("notify_money_change_checkbox"));
gSavedSettings.setBOOL("LiruNoTransactionClutter", childGetValue("no_transaction_clutter_checkbox"));
gSavedSettings.setF32("UIScaleFactor", childGetValue("ui_scale_slider").asReal());
@@ -163,6 +168,15 @@ void LLPanelGeneral::cancel()
{
}
// static
void LLPanelGeneral::onClickCheckbox(LLUICtrl* ctrl, void* data)
{
LLPanelGeneral* self = (LLPanelGeneral*)data;
bool enabled = ctrl->getValue().asBoolean();
if(ctrl->getName() == "notify_money_change_checkbox")
self->childSetEnabled("no_transaction_clutter_checkbox", enabled);
}
// static
void LLPanelGeneral::onClickClearSettings(void*)
{

View File

@@ -47,6 +47,7 @@ public:
void apply();
void cancel();
static void onClickCheckbox(LLUICtrl* ctrl, void* data);
static void onClickClearSettings(void*);
static void callbackResetAllSettings(const LLSD& notification, const LLSD& response);
};

View File

@@ -212,6 +212,7 @@ extern BOOL gDebugClicks;
// function prototypes
bool check_offer_throttle(const std::string& from_name, bool check_only);
void callbackCacheEstateOwnerName(const LLUUID& id, const std::string& full_name, bool is_group);
static void process_money_balance_reply_extended(LLMessageSystem* msg);
//inventory offer throttle globals
LLFrameTimer gThrottleTimer;
@@ -5704,20 +5705,20 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
gStatusBar->setLandCredit(credit);
gStatusBar->setLandCommitted(committed);
}
static std::deque<LLUUID> recent;
if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange")
&& (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend()))
{
// Make the user confirm the transaction, since they might
// have missed something during an event.
// *TODO:translate
LLSD args;
args["MESSAGE"] = desc;
LLNotificationsUtil::add("SystemMessage", args);
// Also send notification to chat -- MC
LLChat chat(desc);
LLFloaterChat::addChat(desc);
if (desc.empty()
|| !gSavedSettings.getBOOL("NotifyMoneyChange"))
{
// ...nothing to display
return;
}
// Suppress duplicate messages about the same transaction
static std::deque<LLUUID> recent;
if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend())
{
return;
}
// Once the 'recent' container gets large enough, chop some
// off the beginning.
@@ -5730,6 +5731,236 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
}
//LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL;
recent.push_back(tid);
if (msg->has("TransactionInfo"))
{
// ...message has extended info for localization
process_money_balance_reply_extended(msg);
}
else
{
// Only old dev grids will not supply the TransactionInfo block,
// so we can just use the hard-coded English string.
LLSD args;
args["MESSAGE"] = desc;
LLNotificationsUtil::add("SystemMessage", args);
// Also send notification to chat -- MC
LLChat chat(desc);
LLFloaterChat::addChat(desc);
}
}
static std::string reason_from_transaction_type(S32 transaction_type,
const std::string& item_desc)
{
// *NOTE: The keys for the reason strings are unusual because
// an earlier version of the code used English language strings
// extracted from hard-coded server English descriptions.
// Keeping them so we don't have to re-localize them.
switch (transaction_type)
{
case TRANS_OBJECT_SALE:
{
LLStringUtil::format_map_t arg;
arg["ITEM"] = item_desc;
return LLTrans::getString("for item", arg);
}
case TRANS_LAND_SALE:
return LLTrans::getString("for a parcel of land");
case TRANS_LAND_PASS_SALE:
return LLTrans::getString("for a land access pass");
case TRANS_GROUP_LAND_DEED:
return LLTrans::getString("for deeding land");
case TRANS_GROUP_CREATE:
return LLTrans::getString("to create a group");
case TRANS_GROUP_JOIN:
return LLTrans::getString("to join a group");
case TRANS_UPLOAD_CHARGE:
return LLTrans::getString("to upload");
case TRANS_CLASSIFIED_CHARGE:
return LLTrans::getString("to publish a classified ad");
// These have no reason to display, but are expected and should not
// generate warnings
case TRANS_GIFT:
case TRANS_PAY_OBJECT:
case TRANS_OBJECT_PAYS:
return std::string();
default:
llwarns << "Unknown transaction type "
<< transaction_type << llendl;
return std::string();
}
}
static void process_money_balance_reply_extended(LLMessageSystem* msg)
{
// Added in server 1.40 and viewer 2.1, support for localization
// and agent ids for name lookup.
S32 transaction_type = 0;
LLUUID source_id;
BOOL is_source_group = false;
LLUUID dest_id;
BOOL is_dest_group = false;
S32 amount = 0;
std::string item_description;
BOOL success = false;
msg->getS32("TransactionInfo", "TransactionType", transaction_type);
msg->getUUID("TransactionInfo", "SourceID", source_id);
msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group);
msg->getUUID("TransactionInfo", "DestID", dest_id);
msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group);
msg->getS32("TransactionInfo", "Amount", amount);
msg->getString("TransactionInfo", "ItemDescription", item_description);
msg->getBOOL("MoneyData", "TransactionSuccess", success);
LL_INFOS("Money") << "MoneyBalanceReply source " << source_id
<< " dest " << dest_id
<< " type " << transaction_type
<< " item " << item_description << LL_ENDL;
if (source_id.isNull() && dest_id.isNull())
{
// this is a pure balance update, no notification required
return;
}
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
std::string source_slurl;
if (is_source_group)
{
gCacheName->getGroupName(source_id, source_slurl);
}
else
{
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(source_id, &avatar_name))
{
switch (phoenix_name_system)
{
case 0 : source_slurl = avatar_name.getLegacyName(); break;
case 1 : source_slurl = avatar_name.getCompleteName(); break;
case 2 : source_slurl = avatar_name.mDisplayName; break;
default : source_slurl = avatar_name.getLegacyName(); break;
}
}
}
std::string dest_slurl;
if (is_dest_group)
{
gCacheName->getGroupName(dest_id, dest_slurl);
}
else
{
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(dest_id, &avatar_name))
{
switch (phoenix_name_system)
{
case 0 : dest_slurl = avatar_name.getLegacyName(); break;
case 1 : dest_slurl = avatar_name.getCompleteName(); break;
case 2 : dest_slurl = avatar_name.mDisplayName; break;
default : dest_slurl = avatar_name.getLegacyName(); break;
}
}
}
std::string reason =
reason_from_transaction_type(transaction_type, item_description);
LLStringUtil::format_map_t args;
args["REASON"] = reason; // could be empty
args["AMOUNT"] = llformat("%d", amount);
// Need to delay until name looked up, so need to know whether or not
// is group
bool is_name_group = false;
LLUUID name_id;
std::string message;
static LLCachedControl<bool> no_transaction_clutter("LiruNoTransactionClutter", false);
std::string notification = no_transaction_clutter ? "Payment" : "SystemMessage";
LLSD final_args;
LLSD payload;
bool you_paid_someone = (source_id == gAgentID);
if (you_paid_someone)
{
args["NAME"] = dest_slurl;
is_name_group = is_dest_group;
name_id = dest_id;
if (!reason.empty())
{
if (dest_id.notNull())
{
message = success ? LLTrans::getString("you_paid_ldollars", args) :
LLTrans::getString("you_paid_failure_ldollars", args);
}
else
{
// transaction fee to the system, eg, to create a group
message = success ? LLTrans::getString("you_paid_ldollars_no_name", args) :
LLTrans::getString("you_paid_failure_ldollars_no_name", args);
}
}
else
{
if (dest_id.notNull())
{
message = success ? LLTrans::getString("you_paid_ldollars_no_reason", args) :
LLTrans::getString("you_paid_failure_ldollars_no_reason", args);
}
else
{
// no target, no reason, you just paid money
message = success ? LLTrans::getString("you_paid_ldollars_no_info", args) :
LLTrans::getString("you_paid_failure_ldollars_no_info", args);
}
}
final_args["MESSAGE"] = message;
}
else
{
// ...someone paid you
args["NAME"] = source_slurl;
is_name_group = is_source_group;
name_id = source_id;
if (!reason.empty())
{
message = LLTrans::getString("paid_you_ldollars", args);
}
else
{
message = LLTrans::getString("paid_you_ldollars_no_reason", args);
}
final_args["MESSAGE"] = message;
// make notification loggable
payload["from_id"] = source_id;
}
// Despite using SLURLs, wait until the name is available before
// showing the notification, otherwise the UI layout is strange and
// the user sees a "Loading..." message
if (is_name_group)
{
gCacheName->getGroup(name_id,
boost::bind(&LLNotificationsUtil::add,
notification, final_args, payload));
}
else
{
LLAvatarNameCache::get(name_id,
boost::bind(&LLNotificationsUtil::add,
notification, final_args, payload));
}
}

View File

@@ -5880,6 +5880,14 @@ Please select at least one type of content to search (PG, Mature, or Adult).
[MESSAGE]
</notification>
<notification
icon="notify.tga"
name="Payment"
type="notifytip">
<tag>funds</tag>
[MESSAGE]
</notification>
<notification
icon="notify.tga"
name="EventNotification"

View File

@@ -25,6 +25,8 @@
<check_box bottom="-195" height="16" initial_value="false" label="Use resolution independent scale" left="101" name="ui_auto_scale"/>
<spinner bottom="-220" decimal_digits="0" height="16" increment="1" initial_val="300" label="Away Timeout:" label_width="91" left="10" max_val="600" min_val="0" name="afk_timeout_spinner" width="137"/>
<check_box bottom="-257" height="16" initial_value="false" label="Notify when in-world currency is spent or received" left="10" name="notify_money_change_checkbox"/>
<check_box bottom="-257" height="16" initial_value="false" label="Notify when in-world currency is exchanged" left="10" name="notify_money_change_checkbox"/>
<check_box bottom="-257" height="16" label="without filling up the corner" left="245" name="no_transaction_clutter_checkbox" tool_tip="Still present the notifications, but have them pop up in the bottom right momentarily, then leave, so the transaction draws attention but doesn't get in the way."/>
<text bottom="-291" height="10" left="10" name="maturity_desired_label">Rating:</text>
<text bottom="-291" height="10" left="101" name="maturity_desired_prompt">I want to access content rated:</text>
<combo_box bottom="-297" follows="left|top" height="18" left="267" name="maturity_desired_combobox" width="120" control_name="PreferredMaturity">

View File

@@ -3872,9 +3872,27 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="Home position set.">Home position set.</string>
<!-- Financial operations strings -->
<string name="this_costs">This costs [CURRENCY]</string>
<string name="paid_you_ldollars">[NAME] paid you L$[AMOUNT] [REASON].</string>
<string name="paid_you_ldollars_no_reason">[NAME] paid you L$[AMOUNT].</string>
<string name="you_paid_ldollars">You paid [NAME] L$[AMOUNT] [REASON].</string>
<string name="you_paid_ldollars_no_info">You paid L$[AMOUNT].</string>
<string name="you_paid_ldollars_no_reason">You paid [NAME] L$[AMOUNT].</string>
<string name="you_paid_ldollars_no_name">You paid L$[AMOUNT] [REASON].</string>
<string name="you_paid_failure_ldollars">You failed to pay [NAME] L$[AMOUNT] [REASON].</string>
<string name="you_paid_failure_ldollars_no_info">You failed to pay L$[AMOUNT].</string>
<string name="you_paid_failure_ldollars_no_reason">You failed to pay [NAME] L$[AMOUNT].</string>
<string name="you_paid_failure_ldollars_no_name">You failed to pay L$[AMOUNT] [REASON].</string>
<string name="for item">for [ITEM]</string>
<string name="for a parcel of land">for a parcel of land</string>
<string name="for a land access pass">for a land access pass</string>
<string name="for deeding land">for deeding land</string>
<string name="to create a group">to create a group</string>
<string name="to join a group">to join a group</string>
<string name="to upload">to upload</string>
<string name="to publish a classified ad">to publish a classified ad</string>
<string name="giving">Giving [CURRENCY]</string>
<string name="this_costs">This costs [CURRENCY]</string>
<string name="group_role_everyone">Everyone</string>
<string name="group_role_officers">Officers</string>

View File

@@ -6775,6 +6775,8 @@ version 2.0
}
// And, the money transfer
// *NOTE: Unused as of 2010-04-06, because all back-end money transactions
// are done with web services via L$ API. JC
{
MoneyTransferBackend Low 312 Trusted Zerocoded
{
@@ -6825,6 +6827,19 @@ version 2.0
{ SquareMetersCommitted S32 }
{ Description Variable 1 } // string
}
// For replies that are part of a transaction (buying something) provide
// metadata for localization. If TransactionType is 0, the message is
// purely a balance update. Added for server 1.40 and viewer 2.1. JC
{
TransactionInfo Single
{ TransactionType S32 } // lltransactiontype.h
{ SourceID LLUUID }
{ IsSourceGroup BOOL }
{ DestID LLUUID }
{ IsDestGroup BOOL }
{ Amount S32 }
{ ItemDescription Variable 1 } // string
}
}
@@ -6851,6 +6866,17 @@ version 2.0
{ SquareMetersCommitted S32 }
{ Description Variable 1 } // string
}
// See MoneyBalanceReply above.
{
TransactionInfo Single
{ TransactionType S32 } // lltransactiontype.h
{ SourceID LLUUID }
{ IsSourceGroup BOOL }
{ DestID LLUUID }
{ IsDestGroup BOOL }
{ Amount S32 }
{ ItemDescription Variable 1 } // string
}
}