summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmarketplaceoutbox.cpp
diff options
context:
space:
mode:
authorLeslie Linden <none@none>2011-06-01 12:28:49 -0700
committerLeslie Linden <none@none>2011-06-01 12:28:49 -0700
commitcbf38d7c95e5968f47850d082eee223e1cef1aff (patch)
treef7ddbc48a0bb84042d29fb03d6db2f8fd9135614 /indra/newview/llpanelmarketplaceoutbox.cpp
parente5ca2b4b82704d11172e0c32761138ec0f58fbe3 (diff)
EXP-841 FIX -- Create outbox sync button with basic enable/disable logic and animation
Functions are stubbed out. Time delay happens through basic coroutine to allow animation viewing. Reviewed by Leyla
Diffstat (limited to 'indra/newview/llpanelmarketplaceoutbox.cpp')
-rw-r--r--indra/newview/llpanelmarketplaceoutbox.cpp93
1 files changed, 91 insertions, 2 deletions
diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp
index 1f58fb33a4..0151276f99 100644
--- a/indra/newview/llpanelmarketplaceoutbox.cpp
+++ b/indra/newview/llpanelmarketplaceoutbox.cpp
@@ -24,15 +24,26 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+#include <boost/coroutine/coroutine.hpp>
+#include <boost/coroutine/future.hpp>
#include "llpanelmarketplaceoutbox.h"
+#include "llbutton.h"
+#include "llcoros.h"
+#include "lleventcoro.h"
+#include "llloadingindicator.h"
+#include "lltimer.h"
+
+
static LLRegisterPanelClassWrapper<LLPanelMarketplaceOutbox> t_panel_marketplace_outbox("panel_marketplace_outbox");
// protected
LLPanelMarketplaceOutbox::LLPanelMarketplaceOutbox()
-: LLPanel()
+ : LLPanel()
+ , mSyncButton(NULL)
+ , mSyncIndicator(NULL)
+ , mSyncInProgress(false)
{
}
@@ -43,5 +54,83 @@ LLPanelMarketplaceOutbox::~LLPanelMarketplaceOutbox()
// virtual
BOOL LLPanelMarketplaceOutbox::postBuild()
{
+ mSyncButton = getChild<LLButton>("outbox_sync_btn");
+ mSyncButton->setCommitCallback(boost::bind(&LLPanelMarketplaceOutbox::onSyncButtonClicked, this));
+
+ mSyncIndicator = getChild<LLLoadingIndicator>("outbox_sync_indicator");
+
+ mSyncButton->setEnabled(!isOutboxEmpty());
+
return TRUE;
}
+
+bool LLPanelMarketplaceOutbox::isOutboxEmpty() const
+{
+ // TODO: Check for contents of outbox
+
+ return false;
+}
+
+bool LLPanelMarketplaceOutbox::isSyncInProgress() const
+{
+ return mSyncInProgress;
+}
+
+
+std::string gTimeDelayDebugFunc = "";
+
+void timeDelay(LLCoros::self& self, LLPanelMarketplaceOutbox* outboxPanel)
+{
+ waitForEventOn(self, "mainloop");
+
+ LLTimer delayTimer;
+ delayTimer.reset();
+ delayTimer.setTimerExpirySec(5.0f);
+
+ while (!delayTimer.hasExpired())
+ {
+ waitForEventOn(self, "mainloop");
+ }
+
+ outboxPanel->onSyncComplete();
+
+ gTimeDelayDebugFunc = "";
+}
+
+void LLPanelMarketplaceOutbox::onSyncButtonClicked()
+{
+ // TODO: Actually trigger sync to marketplace
+
+ mSyncInProgress = true;
+ updateSyncButtonStatus();
+
+ // Set a timer (for testing only)
+
+ gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this));
+}
+
+void LLPanelMarketplaceOutbox::onSyncComplete()
+{
+ mSyncInProgress = false;
+
+ updateSyncButtonStatus();
+}
+
+void LLPanelMarketplaceOutbox::updateSyncButtonStatus()
+{
+ if (isSyncInProgress())
+ {
+ mSyncButton->setVisible(false);
+
+ mSyncIndicator->setVisible(true);
+ mSyncIndicator->start();
+ }
+ else
+ {
+ mSyncIndicator->stop();
+ mSyncIndicator->setVisible(false);
+
+ mSyncButton->setVisible(true);
+ mSyncButton->setEnabled(!isOutboxEmpty());
+ }
+}