Add support for Avination's "Upload Credits"

This commit is contained in:
Melanie
2013-04-15 15:55:46 +02:00
parent 0b70e32f15
commit 09965b0cdf
7 changed files with 83 additions and 6 deletions

View File

@@ -58,7 +58,8 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
mMaxAgentGroups(-1), mMaxAgentGroups(-1),
mCurrencySymbol("OS$"), mCurrencySymbol("OS$"),
mRealCurrencySymbol("US$"), mRealCurrencySymbol("US$"),
mDirectoryFee(30) mDirectoryFee(30),
mUPCSupported(false)
{ {
} }
@@ -676,6 +677,19 @@ void HippoGridInfo::setAutoUpdate(bool b)
mAutoUpdate = b; mAutoUpdate = b;
} }
bool HippoGridInfo::getUPCSupported()
{
if(isSecondLife())
return false;
else
return mUPCSupported;
}
void HippoGridInfo::setUPCSupported(bool b)
{
mUPCSupported = b;
}
// ******************************************************************** // ********************************************************************
// ******************************************************************** // ********************************************************************
// HippoGridManager // HippoGridManager

View File

@@ -82,6 +82,8 @@ public:
void setRenderCompat(bool compat); void setRenderCompat(bool compat);
void setMaxAgentGroups(int max) { mMaxAgentGroups = max; } void setMaxAgentGroups(int max) { mMaxAgentGroups = max; }
void setVoiceConnector(const std::string& vc) { mVoiceConnector = vc; } void setVoiceConnector(const std::string& vc) { mVoiceConnector = vc; }
void setUPCSupported(bool on);
bool getUPCSupported();
void setCurrencySymbol(const std::string& sym); void setCurrencySymbol(const std::string& sym);
void setRealCurrencySymbol(const std::string& sym); void setRealCurrencySymbol(const std::string& sym);
@@ -116,6 +118,7 @@ private:
bool mRenderCompat; bool mRenderCompat;
bool mInvLinks; bool mInvLinks;
bool mAutoUpdate; bool mAutoUpdate;
bool mUPCSupported;
int mMaxAgentGroups; int mMaxAgentGroups;
std::string mCurrencySymbol; std::string mCurrencySymbol;

View File

@@ -4385,6 +4385,8 @@ bool process_login_success_response(std::string& password)
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str())); if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str()));
tmp = response["VoiceConnector"].asString(); tmp = response["VoiceConnector"].asString();
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setVoiceConnector(tmp); if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setVoiceConnector(tmp);
tmp = response["upc_supported"].asString();
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setUPCSupported(true);
gHippoGridManager->saveFile(); gHippoGridManager->saveFile();
gHippoLimits->setLimits(); gHippoLimits->setLimits();

View File

@@ -68,6 +68,7 @@
#include "llworld.h" #include "llworld.h"
#include "llstatgraph.h" #include "llstatgraph.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewergenericmessage.h"
#include "llviewermenu.h" // for gMenuBarView #include "llviewermenu.h" // for gMenuBarView
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
#include "llviewerthrottle.h" #include "llviewerthrottle.h"
@@ -137,9 +138,27 @@ std::vector<std::string> LLStatusBar::sDays;
std::vector<std::string> LLStatusBar::sMonths; std::vector<std::string> LLStatusBar::sMonths;
const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000;
class LLDispatchUPCBalance : public LLDispatchHandler
{
public:
virtual bool operator()(
const LLDispatcher* dispatcher,
const std::string& key,
const LLUUID& invoice,
const sparam_t& strings)
{
S32 upc = atoi(strings[0].c_str());
gStatusBar->setUPC(upc);
return true;
}
};
static LLDispatchUPCBalance sDispatchUPCBalance;
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
: LLPanel(name, LLRect(), FALSE), // not mouse opaque : LLPanel(name, LLRect(), FALSE), // not mouse opaque
mBalance(0), mBalance(0),
mUPC(0),
mHealth(100), mHealth(100),
mSquareMetersCredit(0), mSquareMetersCredit(0),
mSquareMetersCommitted(0), mSquareMetersCommitted(0),
@@ -147,6 +166,11 @@ mRegionCrossingSlot(),
mNavMeshSlot(), mNavMeshSlot(),
mIsNavMeshDirty(false) mIsNavMeshDirty(false)
{ {
mUPCSupported = gHippoGridManager->getConnectedGrid()->getUPCSupported();
if (mUPCSupported)
gGenericDispatcher.addHandler("upcbalance", &sDispatchUPCBalance);
// status bar can possible overlay menus? // status bar can possible overlay menus?
setMouseOpaque(FALSE); setMouseOpaque(FALSE);
setIsChrome(TRUE); setIsChrome(TRUE);
@@ -168,10 +192,14 @@ mIsNavMeshDirty(false)
mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); mTextParcelName = getChild<LLTextBox>("ParcelNameText" );
mTextBalance = getChild<LLTextBox>("BalanceText" ); mTextBalance = getChild<LLTextBox>("BalanceText" );
mTextUPC = getChild<LLTextBox>("UPCText" );
mTextHealth = getChild<LLTextBox>("HealthText" ); mTextHealth = getChild<LLTextBox>("HealthText" );
mTextTime = getChild<LLTextBox>("TimeText" ); mTextTime = getChild<LLTextBox>("TimeText" );
if (!mUPCSupported)
mTextUPC->setVisible(false);
childSetAction("scriptout", onClickScriptDebug, this); childSetAction("scriptout", onClickScriptDebug, this);
childSetAction("health", onClickHealth, this); childSetAction("health", onClickHealth, this);
childSetAction("no_fly", onClickFly, this); childSetAction("no_fly", onClickFly, this);
@@ -595,6 +623,14 @@ void LLStatusBar::refresh()
} }
// Set rects of money, buy money, time // Set rects of money, buy money, time
if (mUPCSupported)
{
childGetRect("UPCText", r);
r.translate( new_right - r.mRight, 0);
childSetRect("UPCText", r);
new_right -= r.getWidth() - 18;
}
childGetRect("BalanceText", r); childGetRect("BalanceText", r);
r.translate( new_right - r.mRight, 0); r.translate( new_right - r.mRight, 0);
childSetRect("BalanceText", r); childSetRect("BalanceText", r);
@@ -631,6 +667,8 @@ void LLStatusBar::refresh()
void LLStatusBar::setVisibleForMouselook(bool visible) void LLStatusBar::setVisibleForMouselook(bool visible)
{ {
mTextBalance->setVisible(visible); mTextBalance->setVisible(visible);
if (mUPCSupported)
mTextUPC->setVisible(visible);
mTextTime->setVisible(visible); mTextTime->setVisible(visible);
childSetVisible("buycurrency", visible); childSetVisible("buycurrency", visible);
childSetVisible("search_editor", visible); childSetVisible("search_editor", visible);
@@ -653,7 +691,7 @@ void LLStatusBar::creditBalance(S32 credit)
void LLStatusBar::setBalance(S32 balance) void LLStatusBar::setBalance(S32 balance)
{ {
mTextBalance->setText(gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str() + mTextBalance->setText(gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str() +
LLResMgr::getInstance()->getMonetaryString(balance)); LLResMgr::getInstance()->getMonetaryString(balance - mUPC));
if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold")))
{ {
@@ -670,6 +708,14 @@ void LLStatusBar::setBalance(S32 balance)
} }
} }
void LLStatusBar::setUPC(S32 upc)
{
mTextUPC->setText("UPC " + LLResMgr::getInstance()->getMonetaryString(upc));
mUPC = upc;
setBalance(mBalance);
}
// static // static
void LLStatusBar::sendMoneyBalanceRequest() void LLStatusBar::sendMoneyBalanceRequest()

View File

@@ -61,6 +61,7 @@ public:
// MANIPULATORS // MANIPULATORS
void setBalance(S32 balance); void setBalance(S32 balance);
void setUPC(S32 balance);
void debitBalance(S32 debit); void debitBalance(S32 debit);
void creditBalance(S32 credit); void creditBalance(S32 credit);
@@ -99,6 +100,7 @@ private:
private: private:
LLTextBox *mTextBalance; LLTextBox *mTextBalance;
LLTextBox *mTextUPC;
LLTextBox *mTextHealth; LLTextBox *mTextHealth;
LLTextBox *mTextTime; LLTextBox *mTextTime;
@@ -110,6 +112,7 @@ private:
LLButton *mBtnBuyCurrency; LLButton *mBtnBuyCurrency;
S32 mBalance; S32 mBalance;
S32 mUPC;
S32 mHealth; S32 mHealth;
S32 mSquareMetersCredit; S32 mSquareMetersCredit;
S32 mSquareMetersCommitted; S32 mSquareMetersCommitted;
@@ -118,6 +121,7 @@ private:
boost::signals2::connection mRegionCrossingSlot; boost::signals2::connection mRegionCrossingSlot;
LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
bool mIsNavMeshDirty; bool mIsNavMeshDirty;
bool mUPCSupported;
static std::vector<std::string> sDays; static std::vector<std::string> sDays;
static std::vector<std::string> sMonths; static std::vector<std::string> sMonths;

View File

@@ -105,7 +105,7 @@ void process_generic_message(LLMessageSystem* msg, void**)
} }
else if (agent_id != gAgent.getID()) else if (agent_id != gAgent.getID())
{ {
llwarns << "GenericMessage for wrong agent" << llendl; llwarns << "GenericMessage for wrong agent " << agent_id << llendl;
return; return;
} }
else else

View File

@@ -15,21 +15,29 @@
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-20" disabled_color="BalanceTextColor" drop_shadow_visible="true" bottom="-20" disabled_color="BalanceTextColor" drop_shadow_visible="true"
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0" enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
halign="right" height="18" left="-230" mouse_opaque="true" halign="right" height="18" left="-280" mouse_opaque="true"
name="BalanceText" text_color="BalanceTextColor" tool_tip="Account Balance" name="BalanceText" text_color="BalanceTextColor" tool_tip="Account Balance"
v_pad="2" width="86"> v_pad="2" width="86">
Loading... Loading...
</text> </text>
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-20" disabled_color="BalanceTextColor" drop_shadow_visible="true"
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
halign="right" height="18" left="-350" mouse_opaque="true"
name="UPCText" text_color="BalanceTextColor" tool_tip="Upload credits"
v_pad="2" width="106">
UPC - N/A -
</text>
<button bottom="-17" enabled="true" follows="right|bottom" font="SansSerifSmall" <button bottom="-17" enabled="true" follows="right|bottom" font="SansSerifSmall"
halign="center" height="16" halign="center" height="16"
image_selected="status_buy_currency_pressed.tga" image_selected="status_buy_currency_pressed.tga"
image_unselected="status_buy_currency.tga" label="" image_unselected="status_buy_currency.tga" label=""
left="-220" mouse_opaque="true" name="buycurrency" scale_image="true" left="-340" mouse_opaque="true" name="buycurrency" scale_image="true"
tool_tip="Buy currency" width="16" /> tool_tip="Buy currency" width="16" />
<text type="string" length="12" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text type="string" length="12" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-20" disabled_color="TimeTextColor" drop_shadow_visible="true" bottom="-20" disabled_color="TimeTextColor" drop_shadow_visible="true"
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0" enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
halign="right" height="18" left="-310" mouse_opaque="true" name="TimeText" halign="right" height="18" left="-430" mouse_opaque="true" name="TimeText"
text_color="TimeTextColor" tool_tip="Current Time (Pacific)" v_pad="2" width="80"> text_color="TimeTextColor" tool_tip="Current Time (Pacific)" v_pad="2" width="80">
12:00 AM 12:00 AM
</text> </text>