diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp index 9dbdb8a8e..0443c480a 100644 --- a/indra/llui/llprogressbar.cpp +++ b/indra/llui/llprogressbar.cpp @@ -73,19 +73,19 @@ LLProgressBar::~LLProgressBar() void LLProgressBar::draw() { static LLTimer timer; - - LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga"); + F32 alpha = getDrawContext().mAlpha; + + //LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga"); LLUIImagePtr bar_fg_imagep = LLUI::getUIImage("progressbar_fill.tga"); LLUIImagePtr bar_bg_imagep = LLUI::getUIImage("progressbar_track.tga"); - LLUIImagePtr bar_imagep = LLUI::getUIImage("rounded_square.tga"); + //LLUIImagePtr bar_imagep = LLUI::getUIImage("rounded_square.tga"); LLColor4 background_color = LLUI::sColorsGroup->getColor("LoginProgressBarBgColor"); - bar_bg_imagep->draw(getLocalRect(), - background_color); + bar_bg_imagep->draw(getLocalRect(), background_color % alpha); LLRect progress_rect = getLocalRect(); progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f)); - bar_fg_imagep->draw(progress_rect); + bar_fg_imagep->draw(progress_rect, LLColor4::white % alpha); } void LLProgressBar::setPercent(const F32 percent) diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index ad6ab788f..394dfce31 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -46,6 +46,7 @@ #include "llagent.h" #include "llbutton.h" +#include "llcallbacklist.h" #include "llfocusmgr.h" #include "llprogressbar.h" #include "llstartup.h" @@ -55,28 +56,28 @@ #include "llappviewer.h" #include "llweb.h" #include "lluictrlfactory.h" +#include "llpanellogin.h" LLProgressView* LLProgressView::sInstance = NULL; S32 gStartImageWidth = 1; S32 gStartImageHeight = 1; -const F32 FADE_IN_TIME = 1.f; - -const std::string ANIMATION_FILENAME = "Login Sequence "; -const std::string ANIMATION_SUFFIX = ".jpg"; -const F32 TOTAL_LOGIN_TIME = 10.f; // seconds, wild guess at time from GL context to actual world view -S32 gLastStartAnimationFrame = 0; // human-style indexing, first image = 1 -const S32 ANIMATION_FRAMES = 1; //13; +const F32 FADE_TO_WORLD_TIME = 1.0f; // XUI:translate LLProgressView::LLProgressView(const std::string& name, const LLRect &rect) : LLPanel(name, rect, FALSE), mPercentDone( 0.f ), mURLInMessage(false), - mMouseDownInActiveArea( false ) + mMouseDownInActiveArea( false ), + mFadeToWorldTimer(), + mFadeFromLoginTimer(), + mStartupComplete(false) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_progress.xml"); reshape(rect.getWidth(), rect.getHeight()); + mFadeToWorldTimer.stop(); + mFadeFromLoginTimer.stop(); } BOOL LLProgressView::postBuild() @@ -85,12 +86,13 @@ BOOL LLProgressView::postBuild() mCancelBtn = getChild("cancel_btn"); mCancelBtn->setClickedCallback( boost::bind(&LLProgressView::onCancelButtonClicked) ); - mFadeTimer.stop(); getChild("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle())); getChild("message_text")->setClickedCallback(boost::bind(&LLProgressView::onClickMessage, this)); + // hidden initially, until we need it + setVisible(FALSE); sInstance = this; return TRUE; } @@ -98,6 +100,9 @@ BOOL LLProgressView::postBuild() LLProgressView::~LLProgressView() { + // Just in case something went wrong, make sure we deregister our idle callback. + gIdleCallbacks.deleteFunction(onIdle, this); + gFocusMgr.releaseFocusIfNeeded( this ); sInstance = NULL; @@ -123,34 +128,44 @@ BOOL LLProgressView::handleKeyHere(KEY key, MASK mask) return TRUE; } +void LLProgressView::revealIntroPanel() +{ + getParent()->sendChildToFront(this); + mFadeFromLoginTimer.start(); + gIdleCallbacks.addFunction(onIdle, this); +} +void LLProgressView::setStartupComplete() +{ + mStartupComplete = true; + + mFadeFromLoginTimer.stop(); + mFadeToWorldTimer.start(); +} void LLProgressView::setVisible(BOOL visible) { + // hiding progress view if (getVisible() && !visible) { - mFadeTimer.start(); + LLPanel::setVisible(FALSE); } - else if (!getVisible() && visible) + // showing progress view + else if (visible && (!getVisible() || mFadeToWorldTimer.getStarted())) { - gFocusMgr.setTopCtrl(this); setFocus(TRUE); - mFadeTimer.stop(); - mProgressTimer.start(); - LLPanel::setVisible(visible); - } + mFadeToWorldTimer.stop(); + LLPanel::setVisible(TRUE); + } } -void LLProgressView::draw() +void LLProgressView::drawStartTexture(F32 alpha) { - static LLTimer timer; - - // Paint bitmap if we've got one gGL.pushMatrix(); if (gStartTexture) { LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(gStartTexture); - gGL.color4f(1.f, 1.f, 1.f, mFadeTimer.getStarted() ? clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, FADE_IN_TIME, 1.f, 0.f) : 1.f); + gGL.getTexUnit(0)->bind(gStartTexture.get()); + gGL.color4f(1.f, 1.f, 1.f, alpha); F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight; S32 width = getRect().getWidth(); S32 height = getRect().getHeight(); @@ -176,20 +191,51 @@ void LLProgressView::draw() gl_rect_2d(getRect()); } gGL.popMatrix(); +} - // Handle fade-in animation - if (mFadeTimer.getStarted()) + +void LLProgressView::draw() +{ + static LLTimer timer; + + if (mFadeFromLoginTimer.getStarted()) { + F32 alpha = clamp_rescale(mFadeFromLoginTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 0.f, 1.f); + LLViewDrawContext context(alpha); + + drawStartTexture(alpha); + LLPanel::draw(); - if (mFadeTimer.getElapsedTimeF32() > FADE_IN_TIME) + return; + } + + // handle fade out to world view when we're asked to + if (mFadeToWorldTimer.getStarted()) + { + // draw fading panel + F32 alpha = clamp_rescale(mFadeToWorldTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 1.f, 0.f); + LLViewDrawContext context(alpha); + + drawStartTexture(alpha); + LLPanel::draw(); + + // faded out completely - remove panel and reveal world + if (mFadeToWorldTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME ) { - gFocusMgr.removeTopCtrlWithoutCallback(this); - LLPanel::setVisible(FALSE); + mFadeToWorldTimer.stop(); + + // Fade is complete, release focus + gFocusMgr.releaseFocusIfNeeded( this ); + + // turn off panel that hosts intro so we see the world + setVisible(FALSE); + gStartTexture = NULL; } return; } + drawStartTexture(1.0f); // draw children LLPanel::draw(); } @@ -226,7 +272,10 @@ void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label) // static void LLProgressView::onCancelButtonClicked() { - if (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE) + // Quitting viewer here should happen only when "Quit" button is pressed while starting up. + // Check for startup state is used here instead of teleport state to avoid quitting when + // cancel is pressed while teleporting inside region (EXT-4911) + if (LLStartUp::getStartupState() < STATE_STARTED) { LLAppViewer::instance()->requestQuit(); } @@ -265,3 +314,21 @@ void LLProgressView::onClickMessage(void* data) } } } + + +// static +void LLProgressView::onIdle(void* user_data) +{ + LLProgressView* self = (LLProgressView*) user_data; + + // Close login panel on mFadeToWorldTimer expiration. + if (self->mFadeFromLoginTimer.getStarted() && + self->mFadeFromLoginTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME) + { + self->mFadeFromLoginTimer.stop(); + LLPanelLogin::close(); + + // Nothing to do anymore. + gIdleCallbacks.deleteFunction(onIdle, user_data); + } +} diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 79f107112..bff970e29 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -49,6 +49,7 @@ public: BOOL postBuild(); /*virtual*/ void draw(); + void drawStartTexture(F32 alpha); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); @@ -60,6 +61,10 @@ public: // Set it to NULL when you want to eliminate the message. void setMessage(const std::string& msg); + void revealIntroPanel(); + + void setStartupComplete(); + void setCancelButtonVisible(BOOL b, const std::string& label); static void onCancelButtonClicked(); @@ -70,13 +75,14 @@ protected: F32 mPercentDone; std::string mMessage; LLButton* mCancelBtn; - LLFrameTimer mFadeTimer; - LLFrameTimer mProgressTimer; + LLFrameTimer mFadeToWorldTimer; + LLFrameTimer mFadeFromLoginTimer; LLRect mOutlineRect; bool mMouseDownInActiveArea; + bool mStartupComplete; bool mURLInMessage; - static LLProgressView* sInstance; + static void onIdle(void* user_data); }; #endif // LL_LLPROGRESSVIEW_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6224935fc..e539c358f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1096,7 +1096,7 @@ bool idle_startup() LLURLSimString::setString( location ); */ // END TODO - LLPanelLogin::close(); + //LLPanelLogin::close(); } //For HTML parsing in text boxes. @@ -1150,6 +1150,7 @@ bool idle_startup() gViewerWindow->setShowProgress(!gSavedSettings.getBOOL("AscentDisableLogoutScreens")); gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit")); + gViewerWindow->revealIntroPanel(); // Poke the VFS, which could potentially block for a while if // Windows XP is acting up set_startup_status(0.07f, LLTrans::getString("LoginVerifyingCache"), LLStringUtil::null); @@ -1786,9 +1787,6 @@ bool idle_startup() handleCloudSettingsChanged(LLSD()); display_startup(); - // Move the progress view in front of the UI - gViewerWindow->moveProgressViewToFront(); - display_startup(); LLError::logToFixedBuffer(gDebugView->mDebugConsolep); display_startup(); @@ -2641,7 +2639,8 @@ bool idle_startup() gViewerWindow->getWindow()->resetBusyCount(); gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL; - gViewerWindow->setShowProgress(FALSE); + + gViewerWindow->setStartupComplete(); gViewerWindow->setProgressCancelButtonVisible(FALSE); display_startup(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6b3c27489..825470f6c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3347,15 +3347,6 @@ class LLAvatarGiveCard : public view_listener_t } }; - -void login_done(S32 which, void *user) -{ - llinfos << "Login done " << which << llendl; - - LLPanelLogin::close(); -} - - bool callback_leave_group(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 122ac3f10..7b1bc5133 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1653,7 +1653,8 @@ LLViewerWindow::LLViewerWindow( mResDirty(false), //mStatesDirty(false), //Singu Note: No longer needed. State update is now in restoreGL. mIsFullscreenChecked(false), - mCurrResolutionIndex(0) + mCurrResolutionIndex(0), + mProgressView(NULL) { LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert")); LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal")); @@ -2218,6 +2219,7 @@ void LLViewerWindow::initWorldUI_postLogin() LLFloaterChatterBox::createInstance(LLSD()); } + mRootView->sendChildToFront(mProgressView); } // Destroy the UI @@ -5159,6 +5161,13 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset) glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } +void LLViewerWindow::revealIntroPanel() +{ + if (mProgressView) + { + mProgressView->revealIntroPanel(); + } +} void LLViewerWindow::setShowProgress(const BOOL show) { @@ -5168,12 +5177,11 @@ void LLViewerWindow::setShowProgress(const BOOL show) } } -void LLViewerWindow::moveProgressViewToFront() +void LLViewerWindow::setStartupComplete() { - if (mProgressView && mRootView) + if (mProgressView) { - mRootView->removeChild(mProgressView); - mRootView->addChild(mProgressView); + mProgressView->setStartupComplete(); } } diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 5af0ad7b7..9d47812d9 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -274,12 +274,13 @@ public: void setShowProgress(const BOOL show); BOOL getShowProgress() const; - void moveProgressViewToFront(); void setProgressString(const std::string& string); void setProgressPercent(const F32 percent); void setProgressMessage(const std::string& msg); void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; + void revealIntroPanel(); + void setStartupComplete(); void updateObjectUnderCursor(); diff --git a/indra/newview/skins/default/xui/en-us/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en-us/panel_prim_media_controls.xml index 7e53073ac..5e0a6141e 100644 --- a/indra/newview/skins/default/xui/en-us/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en-us/panel_prim_media_controls.xml @@ -65,7 +65,7 @@ bottom="-45" left="0" border_size="0" - mouse_opaque="true" + mouse_opaque="false" orientation="horizontal"> - + - - - - - + + + + + - +