Firestorm Tip Tracker initial implemention, also money notification improvements, code cleanup.
parent
6f6afa77fb
commit
adcc7f0f46
|
|
@ -88,6 +88,7 @@ set(viewer_SOURCE_FILES
|
|||
floatermedialists.cpp
|
||||
fscontactsfloater.cpp
|
||||
fsareasearch.cpp
|
||||
fsmoneytracker.cpp
|
||||
fsdata.cpp
|
||||
fskeywords.cpp
|
||||
fslslbridge.cpp
|
||||
|
|
@ -698,6 +699,7 @@ set(viewer_HEADER_FILES
|
|||
fscontactsfloater.h
|
||||
fsradarlistctrl.h
|
||||
fsareasearch.h
|
||||
fsmoneytracker.h
|
||||
fsdata.h
|
||||
fskeywords.h
|
||||
fslslbridge.h
|
||||
|
|
@ -708,8 +710,8 @@ set(viewer_HEADER_FILES
|
|||
lggbeammaps.h
|
||||
lggbeamscolors.h
|
||||
lggbeamcolormapfloater.h
|
||||
lggcontactsets.h
|
||||
lggcontactsetsfloater.h
|
||||
lggcontactsets.h
|
||||
lggcontactsetsfloater.h
|
||||
llaccountingcostmanager.h
|
||||
llagent.h
|
||||
llagentaccess.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
* @file fsmoneytracker.cpp
|
||||
* @brief Tip Tracker Window
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Copyright (c) 2011 Arrehn Oberlander
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "fsmoneytracker.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llchathistory.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llnotificationmanager.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
|
||||
|
||||
FSMoneyTracker::FSMoneyTracker(const LLSD& seed)
|
||||
: LLFloater(seed)
|
||||
{
|
||||
}
|
||||
|
||||
FSMoneyTracker::~FSMoneyTracker()
|
||||
{
|
||||
if (mTransactionHistory)
|
||||
mTransactionHistory->clear();
|
||||
}
|
||||
|
||||
BOOL FSMoneyTracker::postBuild()
|
||||
{
|
||||
mTransactionHistory = getChild<LLChatHistory>("money_chat_history");
|
||||
mTransactionHistory->clear();
|
||||
|
||||
// Button Actions
|
||||
childSetAction("Clear", boost::bind(&FSMoneyTracker::clear,this));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void FSMoneyTracker::addMessage(const LLChat& chat,bool archive,const LLSD &args)
|
||||
{
|
||||
LLChat& tmp_chat = const_cast<LLChat&>(chat);
|
||||
tmp_chat.mFromName = chat.mFromName;
|
||||
LLSD chat_args = args;
|
||||
chat_args["use_plain_text_chat_history"] = true;
|
||||
if(tmp_chat.mTimeStr.empty())
|
||||
tmp_chat.mTimeStr = appendTime();
|
||||
|
||||
mTransactionHistory->appendMessage(tmp_chat, chat_args);
|
||||
}
|
||||
|
||||
std::string FSMoneyTracker::appendTime()
|
||||
{
|
||||
time_t utc_time;
|
||||
utc_time = time_corrected();
|
||||
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" + LLTrans::getString("TimeMin")+"]";
|
||||
if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps"))
|
||||
{
|
||||
timeStr += ":[" + LLTrans::getString("TimeSec")+"]";
|
||||
}
|
||||
|
||||
LLSD substitution;
|
||||
|
||||
substitution["datetime"] = (S32) utc_time;
|
||||
LLStringUtil::format (timeStr, substitution);
|
||||
|
||||
return timeStr;
|
||||
}
|
||||
|
||||
void FSMoneyTracker::clear()
|
||||
{
|
||||
llinfos << "Cleared." << llendl;
|
||||
mTransactionHistory->clear();
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* @file fsmoneytracker.h
|
||||
* @brief Tip Tracker Window
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Copyright (c) 2011 Arrehn Oberlander
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef FS_MONEYTRACKER_H
|
||||
#define FS_MONEYTRACKER_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llsingleton.h"
|
||||
#include "llchathistory.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llchat.h"
|
||||
#include <string.h>
|
||||
|
||||
class LLTextBox;
|
||||
class LLViewerRegion;
|
||||
|
||||
class FSMoneyTracker: public LLFloater
|
||||
{
|
||||
public:
|
||||
FSMoneyTracker(const LLSD& seed);
|
||||
virtual ~FSMoneyTracker();
|
||||
|
||||
BOOL postBuild();
|
||||
void addMessage(const LLChat& chat,bool archive,const LLSD &args);
|
||||
|
||||
private:
|
||||
void clear();
|
||||
std::string appendTime();
|
||||
LLChatHistory* mTransactionHistory;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -54,7 +54,9 @@ typedef enum e_notification_type
|
|||
NT_NEARBYCHAT,
|
||||
NT_ALERT,
|
||||
NT_ALERTMODAL,
|
||||
NT_OFFER
|
||||
NT_OFFER,
|
||||
NT_MONEYCHAT,
|
||||
NT_RADARCHAT
|
||||
} ENotificationType;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@
|
|||
#include "fscontactsfloater.h"
|
||||
#include "floatermedialists.h"
|
||||
#include "fsareasearch.h"
|
||||
#include "fsmoneytracker.h"
|
||||
#include "particleeditor.h"
|
||||
#include "quickprefs.h" // Quick Preferences panel -WoLf
|
||||
#include "lggcontactsetsfloater.h"
|
||||
|
|
@ -273,6 +274,8 @@ void LLViewerFloaterReg::registerFloaters()
|
|||
LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaSettings>);
|
||||
LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
|
||||
LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
|
||||
// AO: Firestorm Money (tip) tracker
|
||||
LLFloaterReg::add("money_tracker", "floater_fs_money_tracker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSMoneyTracker>);
|
||||
LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>);
|
||||
LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGetBlockedObjectName>);
|
||||
LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@
|
|||
//-TT Client LSL Bridge
|
||||
#include "fslslbridge.h"
|
||||
//-TT
|
||||
|
||||
#include "llfloaterreg.h"
|
||||
#include "fsmoneytracker.h"
|
||||
#include "fsareasearch.h"
|
||||
#include "fsdata.h"
|
||||
|
||||
|
|
@ -5890,6 +5891,22 @@ static void money_balance_avatar_notify(const LLUUID& agent_id,
|
|||
// Notification is either PaymentReceived or PaymentSent
|
||||
LLNotificationsUtil::add(notification, args, payload);
|
||||
}
|
||||
|
||||
//<AO> TipTracker Support
|
||||
FSMoneyTracker* tipTracker = (FSMoneyTracker*)LLFloaterReg::getInstance("money_tracker");
|
||||
if (tipTracker->isShown() || tipTracker->isMinimized())
|
||||
{
|
||||
args["MESSAGE"] = args["SLURLMESSAGE"]; // Always use slurl forms in money tracking
|
||||
|
||||
LLChat chat;
|
||||
chat.mText = llformat(args["MESSAGE"].asString().c_str(), av_name.getCompleteName().c_str());
|
||||
chat.mSourceType = CHAT_SOURCE_SYSTEM;
|
||||
LLSD chat_args;
|
||||
chat_args["type"] = LLNotificationsUI::NT_MONEYCHAT;
|
||||
tipTracker->addMessage(chat,false,chat_args);
|
||||
}
|
||||
//</AO>
|
||||
|
||||
}
|
||||
|
||||
static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
||||
|
|
@ -5935,8 +5952,8 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
|||
}
|
||||
else
|
||||
{
|
||||
source_slurl =
|
||||
LLSLURL( "agent", source_id, "completename").getSLURLString();
|
||||
//source_slurl =LLSLURL( "agent", source_id, "completename").getSLURLString();
|
||||
source_slurl =LLSLURL( "agent", source_id, "inspect").getSLURLString();
|
||||
}
|
||||
|
||||
std::string dest_slurl;
|
||||
|
|
@ -5947,8 +5964,8 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
|||
}
|
||||
else
|
||||
{
|
||||
dest_slurl =
|
||||
LLSLURL( "agent", dest_id, "completename").getSLURLString();
|
||||
//dest_slurl = LLSLURL( "agent", dest_id, "completename").getSLURLString();
|
||||
dest_slurl = LLSLURL( "agent", dest_id, "inspect").getSLURLString();
|
||||
}
|
||||
|
||||
std::string reason =
|
||||
|
|
@ -5997,10 +6014,44 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
|||
message = LLTrans::getString("you_paid_ldollars_no_info", args);
|
||||
}
|
||||
}
|
||||
|
||||
//<AO>: Additionally, always add a SLURL-enabled form.
|
||||
args["NAME"] = dest_slurl;
|
||||
is_name_group = is_dest_group;
|
||||
name_id = dest_id;
|
||||
if (!reason.empty())
|
||||
{
|
||||
if (dest_id.notNull())
|
||||
{
|
||||
message = LLTrans::getString("you_paid_ldollars", args);
|
||||
}
|
||||
else
|
||||
{
|
||||
// transaction fee to the system, eg, to create a group
|
||||
message = LLTrans::getString("you_paid_ldollars_no_name", args);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dest_id.notNull())
|
||||
{
|
||||
message = LLTrans::getString("you_paid_ldollars_no_reason", args);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no target, no reason, you just paid money
|
||||
message = LLTrans::getString("you_paid_ldollars_no_info", args);
|
||||
}
|
||||
}
|
||||
final_args["SLURLMESSAGE"] = message;
|
||||
//</AO>
|
||||
|
||||
|
||||
final_args["MESSAGE"] = message;
|
||||
notification = "PaymentSent";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// ...someone paid you
|
||||
args["NAME"] = balance_change_in_chat ? "%s" : source_slurl;
|
||||
is_name_group = is_source_group;
|
||||
|
|
@ -6009,11 +6060,28 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
|||
{
|
||||
message = LLTrans::getString("paid_you_ldollars", args);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
message = LLTrans::getString("paid_you_ldollars_no_reason", args);
|
||||
}
|
||||
final_args["MESSAGE"] = message;
|
||||
|
||||
|
||||
|
||||
//<AO>: Additionally, always add a SLURL-enabled form.
|
||||
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["SLURLMESSAGE"] = message;
|
||||
//</AO>
|
||||
|
||||
// make notification loggable
|
||||
payload["from_id"] = source_id;
|
||||
notification = "PaymentReceived";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<floater
|
||||
name="money_tracker"
|
||||
help_topic="fs_tip_tracker"
|
||||
title="Tip Tracker"
|
||||
width="200"
|
||||
height="188"
|
||||
can_resize="true"
|
||||
can_minimize="true"
|
||||
can_close="true"
|
||||
can_drag_on_left="false">
|
||||
<chat_history
|
||||
font="SansSerifSmall"
|
||||
follows="left|right|top|bottom"
|
||||
height="155"
|
||||
name="money_chat_history"
|
||||
parse_highlights="true"
|
||||
parse_urls="true"
|
||||
left="1"
|
||||
width="198">
|
||||
</chat_history>
|
||||
<button
|
||||
name="Clear"
|
||||
label="Clear"
|
||||
font="SansSerif"
|
||||
mouse_opaque="true"
|
||||
height="20"
|
||||
width="192"
|
||||
left="4"
|
||||
follows="left|right|bottom"/>
|
||||
</floater>
|
||||
|
|
@ -231,6 +231,14 @@
|
|||
function="RecreateLSLBridge"/>
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
|
||||
<menu_item_call
|
||||
label="Tip Tracker"
|
||||
name="money_tracker">
|
||||
<menu_item_call.on_click
|
||||
function="Floater.Toggle"
|
||||
parameter="money_tracker" />
|
||||
</menu_item_call>
|
||||
|
||||
<menu
|
||||
create_jump_keys="true"
|
||||
|
|
|
|||
Loading…
Reference in New Issue