* Fixed up outbox UI alignment to match inbox

* Added outbox item count to outbox button title
* Updated sync loading indicator to keep moving until http request complete
* Updated outbox panel display to use user_status http get response
* Removed inbox/outbox folder name hack from LLInventoryPanel
meow-7.2.2
leslie@leslie-HPz600.lindenlab.com 2011-08-02 13:12:39 -07:00
parent 9778824b8c
commit 45bf1debaa
8 changed files with 118 additions and 98 deletions

View File

@ -163,49 +163,6 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params)
{
root_id = gInventory.getLibraryRootFolderID();
}
// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type
else if (preferred_type == LLFolderType::FT_INBOX)
{
LLInventoryModel::cat_array_t* cats;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items);
if (cats)
{
for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it)
{
LLInventoryCategory* cat = *cat_it;
if (cat->getName() == "Received Items")
{
root_id = cat->getUUID();
}
}
}
}
// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type
/*else if (preferred_type == LLFolderType::FT_OUTBOX)
{
LLInventoryModel::cat_array_t* cats;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items);
if (cats)
{
for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it)
{
LLInventoryCategory* cat = *cat_it;
if (cat->getName() == "Merchant Outbox")
{
root_id = cat->getUUID();
}
}
}
}*/
// leslie -- end temporary HACK
else
{
root_id = (preferred_type != LLFolderType::FT_NONE)

View File

@ -147,7 +147,7 @@ BOOL LLPanelMarketplaceOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL d
{
BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
if (!handled && mInventoryPanel->getRootFolder())
if (!handled && mInventoryPanel && mInventoryPanel->getRootFolder())
{
handled = mInventoryPanel->getRootFolder()->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg);
@ -197,54 +197,65 @@ void timeDelay(LLCoros::self& self, LLPanelMarketplaceOutbox* outboxPanel)
class LLInventorySyncResponder : public LLHTTPClient::Responder
{
public:
LLInventorySyncResponder()
LLInventorySyncResponder(LLPanelMarketplaceOutbox * outboxPanel)
: LLCurl::Responder()
, mOutboxPanel(outboxPanel)
{
}
void completed(U32 status, const std::string& reason, const LLSD& content)
{
llinfos << "inventory_import complete status: " << status << llendl;
if (isGoodStatus(status))
{
// Complete success
llinfos << "sync complete" << llendl;
llinfos << "success" << llendl;
}
else
{
llwarns << "sync failed" << llendl;
llwarns << "failed" << llendl;
}
mOutboxPanel->onSyncComplete();
}
private:
LLPanelMarketplaceOutbox * mOutboxPanel;
};
void LLPanelMarketplaceOutbox::onSyncButtonClicked()
{
std::string url = "http://pdp24.lindenlab.com/3000"; /*"https://marketplace.secondlife.com/";
// Get the sync animation going
mSyncInProgress = true;
updateSyncButtonStatus();
// Make the url for the inventory import request
std::string url = "https://marketplace.secondlife.com/";
if (!LLGridManager::getInstance()->isInProductionGrid())
{
std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
// TEMP for Jim's pdp
//url = "http://pdp24.lindenlab.com:3000/";
}
*/
url += "api/1/users/";
url += gAgent.getID().getString();
url += "/inventory_import";
LLHTTPClient::get(url, new LLInventorySyncResponder(), LLViewerMedia::getHeaders());
mSyncInProgress = true;
updateSyncButtonStatus();
llinfos << "http get: " << url << llendl;
LLHTTPClient::get(url, new LLInventorySyncResponder(this), LLViewerMedia::getHeaders());
// Set a timer (for testing only)
gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this));
//gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this));
}
void LLPanelMarketplaceOutbox::onSyncComplete()
{
mSyncInProgress = false;
updateSyncButtonStatus();
}
@ -267,3 +278,40 @@ void LLPanelMarketplaceOutbox::updateSyncButtonStatus()
mSyncButton->setEnabled(!isOutboxEmpty());
}
}
U32 LLPanelMarketplaceOutbox::getTotalItemCount() const
{
U32 item_count = 0;
if (mInventoryPanel)
{
const LLFolderViewFolder * outbox_folder = mInventoryPanel->getRootFolder();
if (outbox_folder)
{
item_count += outbox_folder->getFoldersCount();
}
}
return item_count;
}
void LLPanelMarketplaceOutbox::draw()
{
U32 item_count = getTotalItemCount();
if (item_count > 0)
{
std::string item_count_str = llformat("%d", item_count);
LLStringUtil::format_map_t args;
args["[NUM]"] = item_count_str;
getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelWithArg", args));
}
else
{
getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelNoArg"));
}
LLPanel::draw();
}

View File

@ -54,8 +54,12 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void draw();
void setupInventoryPanel();
U32 getTotalItemCount() const;
bool isOutboxEmpty() const;
bool isSyncInProgress() const;

View File

@ -301,8 +301,7 @@ void LLSidepanelInventory::handleLoginComplete()
observeOutboxModifications(outbox_id);
// Enable the display of the outbox if it exists
//enableOutbox(true);
// leslie NOTE: Disabling outbox until we support it officially.
enableOutbox(true);
}
}

View File

@ -1378,13 +1378,18 @@ public:
{
if (isGoodStatus(status))
{
std::string merchantStatus = content[gAgent.getID().getString()].asString();
llinfos << "Marketplace merchant status: " << merchantStatus << llendl;
// Complete success
gSavedSettings.setBOOL("InventoryDisplayInbox", true);
gSavedSettings.setBOOL("InventoryDisplayOutbox", (merchantStatus == "merchant"));
}
else if (status == 401)
{
// API is available for use but OpenID authorization failed
gSavedSettings.setBOOL("InventoryDisplayInbox", true);
//gSavedSettings.setBOOL("InventoryDisplayOutbox", true);
}
else
{
@ -1395,6 +1400,28 @@ public:
};
void doOnetimeEarlyHTTPRequests()
{
std::string url = "https://marketplace.secondlife.com/";
if (!LLGridManager::getInstance()->isInProductionGrid())
{
std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
// TEMP for Jim's pdp
//url = "http://pdp24.lindenlab.com:3000/";
}
url += "api/1/users/";
url += gAgent.getID().getString();
url += "/user_status";
llinfos << "http get: " << url << llendl;
LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), LLViewerMedia::getHeaders());
}
LLSD LLViewerMedia::getHeaders()
{
LLSD headers = LLSD::emptyMap();
@ -1452,24 +1479,7 @@ void LLViewerMedia::setOpenIDCookie()
new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
headers);
std::string url = "https://marketplace.secondlife.com/";
if (!LLGridManager::getInstance()->isInProductionGrid())
{
std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
}
url += "api/1/users/";
url += gAgent.getID().getString();
url += "/user_status";
headers = LLSD::emptyMap();
headers["Accept"] = "*/*";
headers["Cookie"] = sOpenIDCookie;
headers["User-Agent"] = getCurrentUserAgent();
LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), headers);
doOnetimeEarlyHTTPRequests();
}
}

View File

@ -4,7 +4,7 @@
start_folder="Received Items"
follows="all" layout="topleft"
top="0" left="0" height="165" width="308"
top_pad="0"
top_pad="0"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"

View File

@ -4,7 +4,7 @@
start_folder="Outbox"
follows="all" layout="topleft"
top="0" left="0" height="165" width="308"
top_pad="0"
top_pad="0"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"

View File

@ -129,41 +129,43 @@
</panel>
</layout_panel>
<layout_panel
width="330"
auto_resize="true"
user_resize="false"
follows="bottom|left|right"
name="outbox_layout_panel"
visible="false"
min_dim="35"
max_dim="200"
expanded_min_dim="90"
height="200">
width="330"
auto_resize="true"
user_resize="false"
follows="bottom|left|right"
name="outbox_layout_panel"
visible="false"
min_dim="35"
max_dim="200"
expanded_min_dim="90"
height="200">
<panel
follows="all"
layout="topleft"
left="10"
left="0"
name="marketplace_outbox"
class="panel_marketplace_outbox"
top="0"
label=""
height="200"
width="310">
width="330">
<string name="OutboxLabelWithArg">Merchant Outbox ([NUM])</string>
<string name="OutboxLabelNoArg">Merchant Outbox</string>
<button
label="Merchant Outbox"
is_toggle="true"
handle_right_mouse="false"
name="outbox_btn"
follows="top|left|right"
height="35"
width="308"
image_unselected="MarketplaceBtn_Off"
image_selected="MarketplaceBtn_Selected"
height="35"
tab_stop="false"
width="308"
halign="left"
handle_right_mouse="false"
follows="top|left|right"
is_toggle="true"
tab_stop="false"
pad_left="35"
top="0"
left="0" />
left="10" />
<button
image_unselected="OutboxPush_Off"
image_selected="OutboxPush_Selected"