diff options
author | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-02 13:12:39 -0700 |
---|---|---|
committer | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-02 13:12:39 -0700 |
commit | 45bf1debaa805b64ce30e3c0670a2e9f24d43e08 (patch) | |
tree | 9b00db2f91d759c3257dd5c310de4dadbd60e6c7 /indra/newview/llpanelmarketplaceoutbox.cpp | |
parent | 9778824b8c8ac3a0b6b373bbaac24f436fb23130 (diff) |
* 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
Diffstat (limited to 'indra/newview/llpanelmarketplaceoutbox.cpp')
-rw-r--r-- | indra/newview/llpanelmarketplaceoutbox.cpp | 76 |
1 files changed, 62 insertions, 14 deletions
diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 074fea546d..90c7f9728b 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -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();
+} |