diff options
Diffstat (limited to 'indra/newview/llprogressview.cpp')
-rw-r--r-- | indra/newview/llprogressview.cpp | 114 |
1 files changed, 71 insertions, 43 deletions
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 38d617e468..cde99f8d7c 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -2,31 +2,25 @@ * @file llprogressview.cpp * @brief LLProgressView class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -40,7 +34,6 @@ #include "llrender.h" #include "llui.h" #include "llfontgl.h" -#include "llimagegl.h" #include "lltimer.h" #include "lltextbox.h" #include "llglheaders.h" @@ -51,7 +44,7 @@ #include "llprogressbar.h" #include "llstartup.h" #include "llviewercontrol.h" -#include "llviewerimagelist.h" +#include "llviewertexturelist.h" #include "llviewerwindow.h" #include "llappviewer.h" #include "llweb.h" @@ -69,15 +62,17 @@ const F32 TOTAL_LOGIN_TIME = 10.f; // seconds, wild guess at time from GL contex S32 gLastStartAnimationFrame = 0; // human-style indexing, first image = 1 const S32 ANIMATION_FRAMES = 1; //13; +static LLRegisterPanelClassWrapper<LLProgressView> r("progress_view"); + + // XUI: Translate -LLProgressView::LLProgressView(const LLRect &rect) +LLProgressView::LLProgressView() : LLPanel(), mPercentDone( 0.f ), - mURLInMessage(false), - 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() @@ -92,6 +87,9 @@ BOOL LLProgressView::postBuild() getChild<LLTextBox>("message_text")->setClickedCallback(onClickMessage, this); + // hidden initially, until we need it + LLPanel::setVisible(FALSE); + sInstance = this; return TRUE; } @@ -126,17 +124,23 @@ BOOL LLProgressView::handleKeyHere(KEY key, MASK mask) void LLProgressView::setVisible(BOOL visible) { + // hiding progress view if (getVisible() && !visible) { mFadeTimer.start(); + // hiding progress view, so show menu bars + LLUI::getRootView()->getChildView("menu_bar_holder")->setVisible(TRUE); } + // showing progress view else if (!getVisible() && visible) { - gFocusMgr.setTopCtrl(this); + // showing progress view, so hide menu bars + LLUI::getRootView()->getChildView("menu_bar_holder")->setVisible(FALSE); + setFocus(TRUE); mFadeTimer.stop(); mProgressTimer.start(); - LLPanel::setVisible(visible); + LLPanel::setVisible(TRUE); } } @@ -146,11 +150,11 @@ void LLProgressView::draw() static LLTimer timer; // Paint bitmap if we've got one - glPushMatrix(); - if (gStartImageGL) + glPushMatrix(); + if (gStartTexture) { LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(gStartImageGL); + gGL.getTexUnit(0)->bind(gStartTexture.get()); 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); F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight; S32 width = getRect().getWidth(); @@ -184,9 +188,12 @@ void LLProgressView::draw() LLPanel::draw(); if (mFadeTimer.getElapsedTimeF32() > FADE_IN_TIME) { - gFocusMgr.removeTopCtrlWithoutCallback(this); + // Fade is complete, release focus + gFocusMgr.releaseFocusIfNeeded( this ); LLPanel::setVisible(FALSE); - gStartImageGL = NULL; + mFadeTimer.stop(); + + gStartTexture = NULL; } return; } @@ -197,7 +204,7 @@ void LLProgressView::draw() void LLProgressView::setText(const std::string& text) { - getChild<LLTextBox>("progress_text")->setWrappedText(LLStringExplicit(text)); + getChild<LLUICtrl>("progress_text")->setValue(text); } void LLProgressView::setPercent(const F32 percent) @@ -208,12 +215,7 @@ void LLProgressView::setPercent(const F32 percent) void LLProgressView::setMessage(const std::string& msg) { mMessage = msg; - mURLInMessage = (mMessage.find( "https://" ) != std::string::npos || - mMessage.find( "http://" ) != std::string::npos || - mMessage.find( "ftp://" ) != std::string::npos); - - getChild<LLTextBox>("message_text")->setWrappedText(LLStringExplicit(mMessage)); - getChild<LLTextBox>("message_text")->setHoverActive(mURLInMessage); + getChild<LLUICtrl>("message_text")->setValue(mMessage); } void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label) @@ -227,7 +229,10 @@ void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label) // static void LLProgressView::onCancelButtonClicked(void*) { - 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(); } @@ -266,3 +271,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; +} |