Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0

master
Mark Palange (Mani) 2009-12-21 14:27:47 -08:00
commit b5ed2038fb
7 changed files with 75 additions and 35 deletions

View File

@ -76,6 +76,7 @@ LLLoginInstance::LLLoginInstance() :
mDispatcher.add("fail.login", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1));
mDispatcher.add("connect", boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1));
mDispatcher.add("disconnect", boost::bind(&LLLoginInstance::handleDisconnect, this, _1));
mDispatcher.add("indeterminate", boost::bind(&LLLoginInstance::handleIndeterminate, this, _1));
}
LLLoginInstance::~LLLoginInstance()
@ -204,6 +205,8 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event)
mTransferRate = event["transfer_rate"].asReal();
}
// Call the method registered in constructor, if any, for more specific
// handling
LLEventDispatcher::Callable method(mDispatcher.get(event["change"]));
@ -295,6 +298,22 @@ void LLLoginInstance::handleDisconnect(const LLSD& event)
// placeholder
}
void LLLoginInstance::handleIndeterminate(const LLSD& event)
{
// The indeterminate response means that the server
// gave the viewer a new url and params to try.
// The login module handles the retry, but it gives us the
// server response so that we may show
// the user some status.
LLSD message = event.get("data").get("message");
if(message.isDefined())
{
LLSD progress_update;
progress_update["desc"] = message;
LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update);
}
}
bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key)
{
if(accepted)
@ -374,28 +393,6 @@ void LLLoginInstance::updateApp(bool mandatory, const std::string& auth_msg)
mNotifications->add(notification_name, args, payload,
boost::bind(&LLLoginInstance::updateDialogCallback, this, _1, _2));
}
/* *NOTE:Mani Experiment with Event API interface.
if(!mUpdateAppResponse)
{
bool make_unique = true;
mUpdateAppResponse.reset(new LLEventStream("logininstance_updateapp", make_unique));
mUpdateAppResponse->listen("diaupdateDialogCallback",
boost::bind(&LLLoginInstance::updateDialogCallback,
this, _1
)
);
}
LLSD event;
event["op"] = "requestAdd";
event["name"] = notification_name;
event["substitutions"] = args;
event["payload"] = payload;
event["reply"] = mUpdateAppResponse->getName();
LLEventPumps::getInstance()->obtain("LLNotifications").post(event);
*/
}
bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD& response)

View File

@ -89,6 +89,7 @@ private:
void handleLoginFailure(const LLSD& event);
void handleLoginSuccess(const LLSD& event);
void handleDisconnect(const LLSD& event);
void handleIndeterminate(const LLSD& event);
bool handleTOSResponse(bool v, const std::string& key);
@ -107,7 +108,6 @@ private:
std::string mSerialNumber;
int mLastExecEvent;
UpdaterLauncherCallback mUpdaterLauncher;
boost::scoped_ptr<LLEventStream> mUpdateAppResponse;
LLEventDispatcher mDispatcher;
};

View File

@ -72,10 +72,12 @@ const S32 ANIMATION_FRAMES = 1; //13;
LLProgressView::LLProgressView(const LLRect &rect)
: LLPanel(),
mPercentDone( 0.f ),
mMouseDownInActiveArea( false )
mMouseDownInActiveArea( false ),
mUpdateEvents("LLProgressView")
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_progress.xml");
reshape(rect.getWidth(), rect.getHeight());
mUpdateEvents.listen("self", boost::bind(&LLProgressView::handleUpdate, this, _1));
}
BOOL LLProgressView::postBuild()
@ -260,3 +262,26 @@ void LLProgressView::onClickMessage(void* data)
}
}
}
bool LLProgressView::handleUpdate(const LLSD& event_data)
{
LLSD message = event_data.get("message");
LLSD desc = event_data.get("desc");
LLSD percent = event_data.get("percent");
if(message.isDefined())
{
setMessage(message.asString());
}
if(desc.isDefined())
{
setText(desc.asString());
}
if(percent.isDefined())
{
setPercent(percent.asReal());
}
return false;
}

View File

@ -35,6 +35,7 @@
#include "llpanel.h"
#include "llframetimer.h"
#include "llevents.h"
class LLImageRaw;
class LLButton;
@ -75,7 +76,12 @@ protected:
LLRect mOutlineRect;
bool mMouseDownInActiveArea;
// The LLEventStream mUpdateEvents depends upon this class being a singleton
// to avoid pump name conflicts.
static LLProgressView* sInstance;
LLEventStream mUpdateEvents;
bool handleUpdate(const LLSD& event_data);
};
#endif // LL_LLPROGRESSVIEW_H

View File

@ -1082,6 +1082,17 @@ bool idle_startup()
credentials["passwd"] = gPassword;
login->connect(credentials);
LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
return FALSE;
}
if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState())
{
// If we get here we have gotten past the potential stall
// in curl, so take "may appear frozen" out of progress bar. JC
auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
set_startup_status(progress, auth_desc, auth_message);
LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
return FALSE;
}
@ -1168,16 +1179,6 @@ bool idle_startup()
show_connect_box = true;
}
}
else
{
// Still waiting for response.
// *TODO:Mani - Actually check for login progress.
// If we get here we have gotten past the potential stall
// in curl, so take "may appear frozen" out of progress bar. JC
auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
set_startup_status(progress, auth_desc, auth_message);
}
return FALSE;
}
@ -2703,6 +2704,7 @@ std::string LLStartUp::startupStateToString(EStartupState state)
RTNENUM( STATE_LOGIN_WAIT );
RTNENUM( STATE_LOGIN_CLEANUP );
RTNENUM( STATE_LOGIN_AUTH_INIT );
RTNENUM( STATE_LOGIN_CURL_UNSTUCK );
RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
RTNENUM( STATE_WORLD_INIT );
RTNENUM( STATE_MULTIMEDIA_INIT );

View File

@ -55,6 +55,7 @@ typedef enum {
STATE_LOGIN_WAIT, // Wait for user input at login screen
STATE_LOGIN_CLEANUP, // Get rid of login screen and start login
STATE_LOGIN_AUTH_INIT, // Start login to SL servers
STATE_LOGIN_CURL_UNSTUCK, // Update progress to remove "SL appears frozen" msg.
STATE_LOGIN_PROCESS_RESPONSE, // Check authentication reply
STATE_WORLD_INIT, // Start building the world
STATE_MULTIMEDIA_INIT, // Init the rest of multimedia library

View File

@ -235,6 +235,8 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
break;
}
sendProgressEvent("offline", "indeterminate", mAuthResponse["responses"]);
// Here the login service at the current URI is redirecting us
// to some other URI ("indeterminate" -- why not "redirect"?).
// The response should contain another uri to try, with its
@ -276,7 +278,14 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
// Here we got through all the rewrittenURIs without succeeding. Tell
// caller this didn't work out so well. Of course, the only failure data
// we can reasonably show are from the last of the rewrittenURIs.
sendProgressEvent("offline", "fail.login", mAuthResponse["responses"]);
// *NOTE: The response from LLXMLRPCListener's Poller::poll method returns an
// llsd with no "responses" node. To make the output from an incomplete login symmetrical
// to success, add a data/message and data/reason fields.
LLSD error_response;
error_response["reason"] = mAuthResponse["status"];
error_response["message"] = mAuthResponse["error"];
sendProgressEvent("offline", "fail.login", error_response);
}
void LLLogin::Impl::disconnect()