From 816cf7db82f2e633631c334f44547714de6cbebc Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 29 Jul 2010 19:49:13 -0700 Subject: Adding a simple region debug console. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterregiondebugconsole.cpp | 93 ++++++++++++++++++++++ indra/newview/llfloaterregiondebugconsole.h | 55 +++++++++++++ indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewerregion.cpp | 1 + .../xui/en/floater_region_debug_console.xml | 37 +++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 12 +++ 8 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 indra/newview/llfloaterregiondebugconsole.cpp create mode 100644 indra/newview/llfloaterregiondebugconsole.h create mode 100644 indra/newview/skins/default/xui/en/floater_region_debug_console.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 92f701551b..53941af355 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -197,6 +197,7 @@ set(viewer_SOURCE_FILES llfloaterpostprocess.cpp llfloaterpreference.cpp llfloaterproperties.cpp + llfloaterregiondebugconsole.cpp llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterscriptdebug.cpp @@ -723,6 +724,7 @@ set(viewer_HEADER_FILES llfloaterpostprocess.h llfloaterpreference.h llfloaterproperties.h + llfloaterregiondebugconsole.h llfloaterregioninfo.h llfloaterreporter.h llfloaterscriptdebug.h diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp new file mode 100644 index 0000000000..058f894800 --- /dev/null +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -0,0 +1,93 @@ +/** + * @file llfloaterregiondebugconsole.h + * @author Brad Kittenbrink + * @brief Quick and dirty console for region debug settings + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010-2010, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterregiondebugconsole.h" + +#include "llagent.h" +#include "llhttpclient.h" +#include "lllineeditor.h" +#include "lltexteditor.h" +#include "llviewerregion.h" + +class Responder : public LLHTTPClient::Responder { +public: + Responder(LLTextEditor *output) : mOutput(output) + { + } + + /*virtual*/ + void error(U32 status, const std::string& reason) + { + } + + /*virtual*/ + void result(const LLSD& content) + { + std::string text = mOutput->getText(); + text += '\n'; + text += content.asString(); + text += '\n'; + mOutput->setText(text); + }; + + LLTextEditor * mOutput; +}; + +LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key) +: LLFloater(key), mOutput(NULL) +{ +} + +BOOL LLFloaterRegionDebugConsole::postBuild() +{ + getChild("region_debug_console_input")->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + mOutput = getChild("region_debug_console_output"); + return TRUE; +} + +void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) +{ + LLLineEditor * input = static_cast(ctrl); + std::string text = mOutput->getText(); + text += "\n\POST: "; + text += input->getText(); + mOutput->setText(text); + + std::string url = gAgent.getRegion()->getCapability("SimConsole"); + LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); + + input->setText(std::string("")); +} + diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h new file mode 100644 index 0000000000..69d7773fec --- /dev/null +++ b/indra/newview/llfloaterregiondebugconsole.h @@ -0,0 +1,55 @@ +/** + * @file llfloaterregiondebugconsole.h + * @author Brad Kittenbrink + * @brief Quick and dirty console for region debug settings + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010-2010, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERREGIONDEBUGCONSOLE_H +#define LL_LLFLOATERREGIONDEBUGCONSOLE_H + +#include "llfloater.h" +#include "llhttpclient.h" + +class LLTextEditor; + +class LLFloaterRegionDebugConsole : public LLFloater, public LLHTTPClient::Responder +{ +public: + LLFloaterRegionDebugConsole(LLSD const & key); + + // virtual + BOOL postBuild(); + + void onInput(LLUICtrl* ctrl, const LLSD& param); + + LLTextEditor * mOutput; +}; + +#endif // LL_LLFLOATERREGIONDEBUGCONSOLE_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index efe59744bc..9e256864d2 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -87,6 +87,7 @@ #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" #include "llfloaterproperties.h" +#include "llfloaterregiondebugconsole.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" @@ -236,6 +237,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 635cc361f3..0822295ba1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -558,7 +558,7 @@ class LLAdvancedCheckConsole : public view_listener_t new_value = get_visibility( (void*)gDebugView->mMemoryView ); } #endif - + return new_value; } }; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index da240cedbb..93666ee5f2 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1517,6 +1517,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("SendUserReport"); capabilityNames.append("SendUserReportWithScreenshot"); capabilityNames.append("ServerReleaseNotes"); + capabilityNames.append("SimConsole"); capabilityNames.append("StartGroupProposal"); capabilityNames.append("TextureStats"); capabilityNames.append("UntrustedSimulatorMessage"); diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml new file mode 100644 index 0000000000..591d77340a --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -0,0 +1,37 @@ + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 3557318705..8a3785d7c1 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2542,6 +2542,18 @@ function="ToggleControl" parameter="DoubleClickAutoPilot" /> + + + + Date: Tue, 24 Aug 2010 09:41:35 -0700 Subject: fix for sim console not staying scrolled to bottom --- indra/llui/lltextbase.cpp | 5 ++++- indra/newview/llfloaterregiondebugconsole.cpp | 13 +++++-------- .../skins/default/xui/en/floater_region_debug_console.xml | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 17e41d9e24..3ba9bd4d1b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1569,7 +1569,10 @@ void LLTextBase::setText(const LLStringExplicit &utf8str, const LLStyle::Params& // appendText modifies mCursorPos... appendText(text, false, input_params); // ...so move cursor to top after appending text - startOfDoc(); + if (!mTrackEnd) + { + startOfDoc(); + } onValueChange(0, getLength()); } diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index 058f894800..8885fa0cb1 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -55,11 +55,9 @@ public: /*virtual*/ void result(const LLSD& content) { - std::string text = mOutput->getText(); + std::string text = content.asString(); text += '\n'; - text += content.asString(); - text += '\n'; - mOutput->setText(text); + mOutput->appendText(text, true); }; LLTextEditor * mOutput; @@ -80,14 +78,13 @@ BOOL LLFloaterRegionDebugConsole::postBuild() void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) { LLLineEditor * input = static_cast(ctrl); - std::string text = mOutput->getText(); - text += "\n\POST: "; + std::string text = "\\POST: "; text += input->getText(); - mOutput->setText(text); + mOutput->appendText(text, true); std::string url = gAgent.getRegion()->getCapability("SimConsole"); LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); - input->setText(std::string("")); + input->clear(); } diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index 591d77340a..976fa35d3c 100644 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -9,6 +9,7 @@ width="600"> -- cgit v1.2.3 From 4b9abaaab9448df7e0773cdbaf1a5202a1f9e6c7 Mon Sep 17 00:00:00 2001 From: "Matthew Breindel (Falcon)" Date: Thu, 26 Aug 2010 17:09:15 -0700 Subject: Cleaned up the debug console a bit. Gave it a command history and proper scrolling to the bottom of the returned data. --- indra/llui/lllineeditor.cpp | 6 +-- indra/newview/llfloaterregiondebugconsole.cpp | 48 ++++++++++++++++------ .../xui/en/floater_region_debug_console.xml | 10 +++-- 3 files changed, 45 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index c93ca1af88..69b4c73e48 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1272,7 +1272,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ( MASK_CONTROL == mask ) ) + if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) { if( mCurrentHistoryLine > mLineHistory.begin() ) { @@ -1287,9 +1287,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } break; - // handle ctrl-downarrow if we have a history enabled line editor + // handle [ctrl]-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ( MASK_CONTROL == mask ) ) + if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) { if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 ) { diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index 058f894800..159dee7631 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -55,11 +55,8 @@ public: /*virtual*/ void result(const LLSD& content) { - std::string text = mOutput->getText(); - text += '\n'; - text += content.asString(); - text += '\n'; - mOutput->setText(text); + std::string text = content.asString() + "\n\n> "; + mOutput->appendText(text, false); }; LLTextEditor * mOutput; @@ -72,22 +69,47 @@ LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key) BOOL LLFloaterRegionDebugConsole::postBuild() { - getChild("region_debug_console_input")->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + LLLineEditor* input = getChild("region_debug_console_input"); + input->setEnableLineHistory(true); + input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + input->setFocus(true); + input->setCommitOnFocusLost(false); + mOutput = getChild("region_debug_console_output"); + + std::string url = gAgent.getRegion()->getCapability("SimConsole"); + if ( url.size() == 0 ) + { + mOutput->appendText("This region does not support the simulator console.\n\n> ", false); + } + else + { + mOutput->appendText("> ", false); + } + + return TRUE; } void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) { - LLLineEditor * input = static_cast(ctrl); - std::string text = mOutput->getText(); - text += "\n\POST: "; - text += input->getText(); - mOutput->setText(text); + LLLineEditor* input = static_cast(ctrl); + std::string text = input->getText() + "\n"; + std::string url = gAgent.getRegion()->getCapability("SimConsole"); - LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); - input->setText(std::string("")); + if ( url.size() > 0 ) + { + LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); + } + else + { + text += "\nError: No console available for this region/simulator.\n\n> "; + } + + mOutput->appendText(text, false); + + input->clear(); } diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index 591d77340a..cf95257b0a 100644 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -6,7 +6,8 @@ min_height="300" min_width="300" height="400" - width="600"> + width="600" + default_tab_group="1"> + word_wrap="true" + track_end="true" + read_only="true"> + width="576" /> -- cgit v1.2.3 From 301112ac7a89266d7378a413f15200ea1bb44d9e Mon Sep 17 00:00:00 2001 From: "Matthew Breindel (Falcon)" Date: Thu, 26 Aug 2010 17:14:22 -0700 Subject: Fixed bad merge. --- indra/newview/skins/default/xui/en/floater_region_debug_console.xml | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index b3bf28e285..bdb890f882 100644 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -10,7 +10,6 @@ default_tab_group="1"> Date: Thu, 26 Aug 2010 17:29:33 -0700 Subject: Removed duplicate item in floater_region_Debug_console.xml --- indra/newview/skins/default/xui/en/floater_region_debug_console.xml | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index bdb890f882..cf95257b0a 100644 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -19,7 +19,6 @@ ignore_tab="false" layout="topleft" max_length="65536" - track_end="true" name="region_debug_console_output" show_line_numbers="false" word_wrap="true" -- cgit v1.2.3 From 58d6057076028c13a2dcc6130734a86933dc5864 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 12:38:12 +0100 Subject: VWR-20756 WIP - start to detect the magic llTextBox() case. --- indra/newview/lltoastnotifypanel.cpp | 40 +++++++++++++++++++++++++++++------- indra/newview/lltoastnotifypanel.h | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index ca6efa9d2f..9febcb3d8b 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -33,6 +33,7 @@ // library includes #include "lldbstrings.h" +#include "lllslconstants.h" #include "llnotifications.h" #include "lluiconstants.h" #include "llrect.h" @@ -54,6 +55,7 @@ LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), +mUserInputBox(NULL), mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), @@ -66,15 +68,43 @@ mCloseNotificationOnDestroy(true) { this->setShape(rect); } + // get a form for the notification + LLNotificationFormPtr form(notification->getForm()); + // get number of elements + mNumOptions = form->getNumElements(); + mInfoPanel = getChild("info_panel"); mControlPanel = getChild("control_panel"); BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); + // customize panel's attributes - // is it intended for displaying a tip + + // is it intended for displaying a tip? mIsTip = notification->getType() == "notifytip"; - // is it a script dialog + // is it a script dialog? mIsScriptDialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); - // is it a caution + // is it a script dialog with llTextBox()? + mIsScriptTextBox = false; + if (mIsScriptDialog) + { + // if ANY of the buttons have the magic lltextbox string as name, then + // treat the whole dialog as a simple text entry box (i.e. mixed button + // and textbox forms are not supported) + for (int i=0; igetElement(i); + llwarns << form_element << llendl; + if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) + { + mIsScriptTextBox = true; + break; + } + } + } + llwarns << "FORM ELEMS " << int(form->getNumElements()) << llendl; + llwarns << "isScriptDialog? " << int(mIsScriptDialog) << llendl; + llwarns << "isScriptTextBox? " << int(mIsScriptTextBox) << llendl; + // is it a caution? // // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution @@ -94,10 +124,6 @@ mCloseNotificationOnDestroy(true) setIsChrome(TRUE); // initialize setFocusRoot(!mIsTip); - // get a form for the notification - LLNotificationFormPtr form(notification->getForm()); - // get number of elements - mNumOptions = form->getNumElements(); // customize panel's outfit // preliminary adjust panel's layout diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 9e1eac90b3..f90fca3eaa 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -99,6 +99,7 @@ protected: // panel elements LLTextBase* mTextBox; + LLTextEditor* mUserInputBox; LLPanel* mInfoPanel; // a panel, that contains an information LLPanel* mControlPanel; // a panel, that contains buttons (if present) @@ -121,6 +122,7 @@ protected: void disableRespondedOptions(LLNotificationPtr& notification); bool mIsTip; + bool mIsScriptTextBox; bool mAddedDefaultBtn; bool mIsScriptDialog; bool mIsCaution; -- cgit v1.2.3 From 17d913fef4778234c97b48d26167d6e1f62d8add Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 13:56:29 +0100 Subject: VWR-20756 WIP - very limping display of llTextBox --- indra/newview/lltoastnotifypanel.cpp | 19 +++++++++++++++++-- .../skins/default/xui/en/panel_notification.xml | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9febcb3d8b..6413874863 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -148,6 +148,11 @@ mCloseNotificationOnDestroy(true) mTextBox->setVisible(TRUE); mTextBox->setValue(notification->getMessage()); + mUserInputBox = getChild("user_input_box"); + mUserInputBox->setMaxTextLength(254);// FIXME + mUserInputBox->setVisible(FALSE); + mUserInputBox->setEnabled(FALSE); + // add buttons for a script notification if (mIsTip) { @@ -164,6 +169,16 @@ mCloseNotificationOnDestroy(true) LLSD form_element = form->getElement(i); if (form_element["type"].asString() != "button") { + // not a button. + continue; + } + if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) + { + // a textbox pretending to be a button. + // (re)enable the textbox for this panel, and continue. + mUserInputBox->setVisible(TRUE); + mUserInputBox->setEnabled(TRUE); + mUserInputBox->insertText("FOOOOOO!!!!"); continue; } LLButton* new_button = createButton(form_element, TRUE); @@ -278,7 +293,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); } - // for the scriptdialog buttons we use fixed button size. This is a limit! + // for the scriptdialog buttons we use fixed button size. This is a limit! if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > BUTTON_WIDTH) { p.rect.width = 1; @@ -286,7 +301,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt } else if (mIsScriptDialog && is_ignore_btn) { - // this is ignore button,make it smaller + // this is ignore button, make it smaller p.rect.height = BTN_HEIGHT_SMALL; p.rect.width = 1; p.auto_resize = true; diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index 59ead84127..a816eaccb6 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -55,6 +55,28 @@ visible="false" width="285" wrap="true"/> + Date: Mon, 13 Sep 2010 19:53:08 +0100 Subject: Annoying focus hacks to unblock development. --- indra/newview/lltoastnotifypanel.cpp | 1 + indra/newview/skins/default/xui/en/panel_notification.xml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 6413874863..8cae7d0963 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -178,6 +178,7 @@ mCloseNotificationOnDestroy(true) // (re)enable the textbox for this panel, and continue. mUserInputBox->setVisible(TRUE); mUserInputBox->setEnabled(TRUE); + mUserInputBox->setFocus(TRUE); mUserInputBox->insertText("FOOOOOO!!!!"); continue; } diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index a816eaccb6..ef9e5323f9 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -1,5 +1,6 @@ Date: Mon, 13 Sep 2010 20:04:05 +0100 Subject: trivial whitespace change... --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 8cae7d0963..56f71dc43e 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -200,7 +200,7 @@ mCloseNotificationOnDestroy(true) if(h_pad < 2*HPAD) { /* - * Probably it is a scriptdialog toast + * Probably it is a scriptdialog toast * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. * In last case set default h_pad to avoid heaping of buttons */ -- cgit v1.2.3 From 89e1f3be753c7c5153261ebb94095f2dee95a991 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 20:12:50 +0100 Subject: quick stab at a submit button. --- indra/newview/skins/default/xui/en/panel_notification.xml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index ef9e5323f9..21c45aa5e3 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -104,6 +104,14 @@ wrap="true" parse_highlights="true" parse_urls="true"/> + -- cgit v1.2.3 From dfeb7abe5f690bbd3a908c84c53bbea20a5adb7c Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 4 Nov 2010 14:08:14 -0700 Subject: checker working with v1.0 update protocol. --- indra/newview/app_settings/settings.xml | 24 +++++++++- indra/newview/llappviewer.cpp | 4 +- .../viewer_components/updater/llupdatechecker.cpp | 52 ++++++++++++++-------- indra/viewer_components/updater/llupdatechecker.h | 3 +- .../updater/llupdatedownloader.cpp | 1 + .../viewer_components/updater/llupdaterservice.cpp | 28 ++++++++---- indra/viewer_components/updater/llupdaterservice.h | 6 +-- .../updater/tests/llupdaterservice_test.cpp | 11 ++--- 8 files changed, 91 insertions(+), 38 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8f5cb7c709..cc0e0a78db 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11022,7 +11022,29 @@ Type String Value - http://localhost/agni + http://update.secondlife.com + + UpdaterServicePath + + Comment + Path on the update server host. + Persist + 0 + Type + String + Value + update + + UpdaterServiceProtocolVersion + + Comment + The update protocol version to use. + Persist + 0 + Type + String + Value + v1.0 UploadBakedTexOld diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a48bc25f1..6bb25969a6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2337,9 +2337,11 @@ void LLAppViewer::initUpdater() std::string url = gSavedSettings.getString("UpdaterServiceURL"); std::string channel = LLVersionInfo::getChannel(); std::string version = LLVersionInfo::getVersion(); + std::string protocol_version = gSavedSettings.getString("UpdaterServiceProtocolVersion"); + std::string service_path = gSavedSettings.getString("UpdaterServicePath"); U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); - mUpdater->setParams(url, channel, version); + mUpdater->setParams(protocol_version, url, service_path, channel, version); mUpdater->setCheckPeriod(check_period); if(gSavedSettings.getBOOL("UpdaterServiceActive")) { diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 596b122a25..2c60636122 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -41,7 +41,8 @@ public: Implementation(Client & client); ~Implementation(); - void check(std::string const & host, std::string channel, std::string version); + void check(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); // Responder: virtual void completed(U32 status, @@ -50,7 +51,8 @@ public: virtual void error(U32 status, const std::string & reason); private: - std::string buildUrl(std::string const & host, std::string channel, std::string version); + std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); Client & mClient; LLHTTPClient mHttpClient; @@ -74,9 +76,10 @@ LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client): } -void LLUpdateChecker::check(std::string const & host, std::string channel, std::string version) +void LLUpdateChecker::check(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version) { - mImplementation->check(host, channel, version); + mImplementation->check(protocolVersion, hostUrl, servicePath, channel, version); } @@ -100,13 +103,14 @@ LLUpdateChecker::Implementation::~Implementation() } -void LLUpdateChecker::Implementation::check(std::string const & host, std::string channel, std::string version) +void LLUpdateChecker::Implementation::check(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version) { // llassert(!mInProgress); mInProgress = true; mVersion = version; - std::string checkUrl = buildUrl(host, channel, version); + std::string checkUrl = buildUrl(protocolVersion, hostUrl, servicePath, channel, version); LL_INFOS("UpdateCheck") << "checking for updates at " << checkUrl << llendl; // The HTTP client will wrap a raw pointer in a boost::intrusive_ptr causing the @@ -125,17 +129,17 @@ void LLUpdateChecker::Implementation::completed(U32 status, if(status != 200) { LL_WARNS("UpdateCheck") << "html error " << status << " (" << reason << ")" << llendl; mClient.error(reason); - } else if(!content["valid"].asBoolean()) { - LL_INFOS("UpdateCheck") << "version invalid" << llendl; - LLURI uri(content["download_url"].asString()); - mClient.requiredUpdate(content["latest_version"].asString(), uri); - } else if(content["latest_version"].asString() != mVersion) { - LL_INFOS("UpdateCheck") << "newer version " << content["latest_version"].asString() << " available" << llendl; - LLURI uri(content["download_url"].asString()); - mClient.optionalUpdate(content["latest_version"].asString(), uri); - } else { + } else if(!content.asBoolean()) { LL_INFOS("UpdateCheck") << "up to date" << llendl; mClient.upToDate(); + } else if(content["required"].asBoolean()) { + LL_INFOS("UpdateCheck") << "version invalid" << llendl; + LLURI uri(content["url"].asString()); + mClient.requiredUpdate(content["version"].asString(), uri); + } else { + LL_INFOS("UpdateCheck") << "newer version " << content["version"].asString() << " available" << llendl; + LLURI uri(content["url"].asString()); + mClient.optionalUpdate(content["version"].asString(), uri); } } @@ -144,14 +148,26 @@ void LLUpdateChecker::Implementation::error(U32 status, const std::string & reas { mInProgress = false; LL_WARNS("UpdateCheck") << "update check failed; " << reason << llendl; + mClient.error(reason); } -std::string LLUpdateChecker::Implementation::buildUrl(std::string const & host, std::string channel, std::string version) +std::string LLUpdateChecker::Implementation::buildUrl(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version) { +#ifdef LL_WINDOWS + static const char * platform = "win"; +#elif LL_DARWIN + static const char * platform = "mac"; +#else + static const char * platform = "lnx"; +#endif + LLSD path; - path.append("version"); + path.append(servicePath); + path.append(protocolVersion); path.append(channel); path.append(version); - return LLURI::buildHTTP(host, path).asString(); + path.append(platform); + return LLURI::buildHTTP(hostUrl, path).asString(); } diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index 1f8c6d8a91..58aaee4e3d 100644 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -41,7 +41,8 @@ public: LLUpdateChecker(Client & client); // Check status of current app on the given host for the channel and version provided. - void check(std::string const & hostUrl, std::string channel, std::string version); + void check(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); private: boost::shared_ptr mImplementation; diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 21e4ce94cc..087d79f804 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -222,6 +222,7 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u CURLcode code; code = curl_easy_setopt(mCurl, CURLOPT_NOSIGNAL, true); + code = curl_easy_setopt(mCurl, CURLOPT_FOLLOWLOCATION, true); code = curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, &write_function); code = curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, this); code = curl_easy_setopt(mCurl, CURLOPT_HEADERFUNCTION, &header_function); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index a1b6de38e5..e865552fb3 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -48,7 +48,9 @@ class LLUpdaterServiceImpl : { static const std::string sListenerName; + std::string mProtocolVersion; std::string mUrl; + std::string mPath; std::string mChannel; std::string mVersion; @@ -74,10 +76,12 @@ public: virtual void pluginLaunchFailed(); virtual void pluginDied(); - void setParams(const std::string& url, + void setParams(const std::string& protocol_version, + const std::string& url, + const std::string& path, const std::string& channel, const std::string& version); - + void setCheckPeriod(unsigned int seconds); void startChecking(); @@ -134,7 +138,9 @@ void LLUpdaterServiceImpl::pluginDied() { }; -void LLUpdaterServiceImpl::setParams(const std::string& url, +void LLUpdaterServiceImpl::setParams(const std::string& protocol_version, + const std::string& url, + const std::string& path, const std::string& channel, const std::string& version) { @@ -144,7 +150,9 @@ void LLUpdaterServiceImpl::setParams(const std::string& url, " before setting params."); } + mProtocolVersion = protocol_version; mUrl = url; + mPath = path; mChannel = channel; mVersion = version; } @@ -165,7 +173,7 @@ void LLUpdaterServiceImpl::startChecking() } mIsChecking = true; - mUpdateChecker.check(mUrl, mChannel, mVersion); + mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); } } @@ -218,7 +226,7 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) { mTimer.stop(); LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); - mUpdateChecker.check(mUrl, mChannel, mVersion); + mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); } else { // Keep on waiting... } @@ -247,11 +255,13 @@ LLUpdaterService::~LLUpdaterService() { } -void LLUpdaterService::setParams(const std::string& url, - const std::string& chan, - const std::string& vers) +void LLUpdaterService::setParams(const std::string& protocol_version, + const std::string& url, + const std::string& path, + const std::string& channel, + const std::string& version) { - mImpl->setParams(url, chan, vers); + mImpl->setParams(protocol_version, url, path, channel, version); } void LLUpdaterService::setCheckPeriod(unsigned int seconds) diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 313ae8ada3..83b09c4bdd 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -42,9 +42,9 @@ public: LLUpdaterService(); ~LLUpdaterService(); - // The base URL. - // *NOTE:Mani The grid, if any, would be embedded in the base URL. - void setParams(const std::string& url, + void setParams(const std::string& version, + const std::string& url, + const std::string& path, const std::string& channel, const std::string& version); diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 0ffc1f2c70..958526e35b 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -60,9 +60,10 @@ LLPluginMessage::LLPluginMessage(LLPluginMessage const&) {} LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client) {} -void LLUpdateChecker::check(std::string const & host, std::string channel, std::string version){} -LLUpdateDownloader::LLUpdateDownloader(LLUpdateDownloader::Client & client) +void LLUpdateChecker::check(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version) {} +LLUpdateDownloader::LLUpdateDownloader(Client & ) {} void LLUpdateDownloader::download(LLURI const & ){} /***************************************************************************** @@ -113,9 +114,9 @@ namespace tut bool got_usage_error = false; try { - updater.setParams(test_url, test_channel, test_version); + updater.setParams("1.0",test_url, "update" ,test_channel, test_version); updater.startChecking(); - updater.setParams("other_url", test_channel, test_version); + updater.setParams("1.0", "other_url", "update", test_channel, test_version); } catch(LLUpdaterService::UsageError) { @@ -129,7 +130,7 @@ namespace tut { DEBUG; LLUpdaterService updater; - updater.setParams(test_url, test_channel, test_version); + updater.setParams("1.0", test_url, "update", test_channel, test_version); updater.startChecking(); ensure(updater.isChecking()); updater.stopChecking(); -- cgit v1.2.3 From e45ba2957630f6319f8c633a409d78be56c264bd Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 4 Nov 2010 15:09:10 -0700 Subject: Fix for linux eol error. --- indra/viewer_components/updater/llupdatedownloader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h index 6118c4338e..395d19d6bf 100644 --- a/indra/viewer_components/updater/llupdatedownloader.h +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -76,4 +76,4 @@ public: }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From 191e164a503b72c7feae0a46ad0422740b365556 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 4 Nov 2010 15:49:19 -0700 Subject: some better error handling. --- .../viewer_components/updater/llupdatechecker.cpp | 35 ++++-- indra/viewer_components/updater/llupdatechecker.h | 11 +- .../updater/llupdatedownloader.cpp | 122 +++++++++++++-------- .../viewer_components/updater/llupdatedownloader.h | 11 +- .../viewer_components/updater/llupdaterservice.cpp | 20 +++- .../updater/tests/llupdaterservice_test.cpp | 2 +- 6 files changed, 136 insertions(+), 65 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 2c60636122..d31244cc9b 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -24,21 +24,35 @@ */ #include "linden_common.h" +#include #include #include "llhttpclient.h" #include "llsd.h" #include "llupdatechecker.h" #include "lluri.h" + #if LL_WINDOWS #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #endif + +class LLUpdateChecker::CheckError: + public std::runtime_error +{ +public: + CheckError(const char * message): + std::runtime_error(message) + { + ; // No op. + } +}; + + class LLUpdateChecker::Implementation: public LLHTTPClient::Responder { public: - Implementation(Client & client); ~Implementation(); void check(std::string const & protocolVersion, std::string const & hostUrl, @@ -50,9 +64,8 @@ public: const LLSD& content); virtual void error(U32 status, const std::string & reason); -private: - std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, - std::string const & servicePath, std::string channel, std::string version); +private: + static const char * sProtocolVersion; Client & mClient; LLHTTPClient mHttpClient; @@ -60,6 +73,9 @@ private: LLHTTPClient::ResponderPtr mMe; std::string mVersion; + std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); + LOG_CLASS(LLUpdateChecker::Implementation); }; @@ -88,6 +104,9 @@ void LLUpdateChecker::check(std::string const & protocolVersion, std::string con //----------------------------------------------------------------------------- +const char * LLUpdateChecker::Implementation::sProtocolVersion = "v1.0"; + + LLUpdateChecker::Implementation::Implementation(LLUpdateChecker::Client & client): mClient(client), mInProgress(false), @@ -106,7 +125,9 @@ LLUpdateChecker::Implementation::~Implementation() void LLUpdateChecker::Implementation::check(std::string const & protocolVersion, std::string const & hostUrl, std::string const & servicePath, std::string channel, std::string version) { - // llassert(!mInProgress); + llassert(!mInProgress); + + if(protocolVersion != sProtocolVersion) throw CheckError("unsupported protocol"); mInProgress = true; mVersion = version; @@ -135,11 +156,11 @@ void LLUpdateChecker::Implementation::completed(U32 status, } else if(content["required"].asBoolean()) { LL_INFOS("UpdateCheck") << "version invalid" << llendl; LLURI uri(content["url"].asString()); - mClient.requiredUpdate(content["version"].asString(), uri); + mClient.requiredUpdate(content["version"].asString(), uri, content["hash"].asString()); } else { LL_INFOS("UpdateCheck") << "newer version " << content["version"].asString() << " available" << llendl; LLURI uri(content["url"].asString()); - mClient.optionalUpdate(content["version"].asString(), uri); + mClient.optionalUpdate(content["version"].asString(), uri, content["hash"].asString()); } } diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index 58aaee4e3d..cea1f13647 100644 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -38,6 +38,9 @@ public: class Client; class Implementation; + // An exception that may be raised on check errors. + class CheckError; + LLUpdateChecker(Client & client); // Check status of current app on the given host for the channel and version provided. @@ -62,10 +65,14 @@ public: virtual void error(std::string const & message) = 0; // A newer version is available, but the current version may still be used. - virtual void optionalUpdate(std::string const & newVersion, LLURI const & uri) = 0; + virtual void optionalUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash) = 0; // A newer version is available, and the current version is no longer valid. - virtual void requiredUpdate(std::string const & newVersion, LLURI const & uri) = 0; + virtual void requiredUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash) = 0; // The checked version is up to date; no newer version exists. virtual void upToDate(void) = 0; diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 087d79f804..23772e021e 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -24,6 +24,7 @@ */ #include "linden_common.h" +#include #include #include #include "lldir.h" @@ -41,33 +42,56 @@ public: Implementation(LLUpdateDownloader::Client & client); ~Implementation(); void cancel(void); - void download(LLURI const & uri); + void download(LLURI const & uri, std::string const & hash); bool isDownloading(void); void onHeader(void * header, size_t size); void onBody(void * header, size_t size); private: - static const char * sSecondLifeUpdateRecord; - LLUpdateDownloader::Client & mClient; CURL * mCurl; + LLSD mDownloadData; llofstream mDownloadStream; std::string mDownloadRecordPath; void initializeCurlGet(std::string const & url); void resumeDownloading(LLSD const & downloadData); void run(void); - bool shouldResumeOngoingDownload(LLURI const & uri, LLSD & downloadData); - void startDownloading(LLURI const & uri); + void startDownloading(LLURI const & uri, std::string const & hash); + void throwOnCurlError(CURLcode code); LOG_CLASS(LLUpdateDownloader::Implementation); }; +namespace { + class DownloadError: + public std::runtime_error + { + public: + DownloadError(const char * message): + std::runtime_error(message) + { + ; // No op. + } + }; + + + const char * gSecondLifeUpdateRecord = "SecondLifeUpdateDownload.xml"; +}; + + // LLUpdateDownloader //----------------------------------------------------------------------------- + +std::string LLUpdateDownloader::downloadMarkerPath(void) +{ + return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, gSecondLifeUpdateRecord); +} + + LLUpdateDownloader::LLUpdateDownloader(Client & client): mImplementation(new LLUpdateDownloader::Implementation(client)) { @@ -81,9 +105,9 @@ void LLUpdateDownloader::cancel(void) } -void LLUpdateDownloader::download(LLURI const & uri) +void LLUpdateDownloader::download(LLURI const & uri, std::string const & hash) { - mImplementation->download(uri); + mImplementation->download(uri, hash); } @@ -115,15 +139,11 @@ namespace { } -const char * LLUpdateDownloader::Implementation::sSecondLifeUpdateRecord = - "SecondLifeUpdateDownload.xml"; - - LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & client): LLThread("LLUpdateDownloader"), mClient(client), mCurl(0), - mDownloadRecordPath(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, sSecondLifeUpdateRecord)) + mDownloadRecordPath(LLUpdateDownloader::downloadMarkerPath()) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case. llassert(code = CURLE_OK); // TODO: real error handling here. @@ -142,13 +162,15 @@ void LLUpdateDownloader::Implementation::cancel(void) } -void LLUpdateDownloader::Implementation::download(LLURI const & uri) +void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash) { - LLSD downloadData; - if(shouldResumeOngoingDownload(uri, downloadData)){ - startDownloading(uri); // TODO: Implement resume. - } else { - startDownloading(uri); + if(isDownloading()) mClient.downloadError("download in progress"); + + mDownloadData = LLSD(); + try { + startDownloading(uri, hash); + } catch(DownloadError const & e) { + mClient.downloadError(e.what()); } } @@ -173,14 +195,10 @@ void LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) size_t size = boost::lexical_cast(contentLength); LL_INFOS("UpdateDownload") << "download size is " << size << LL_ENDL; - LLSD downloadData; - llifstream idataStream(mDownloadRecordPath); - LLSDSerialize parser; - parser.fromXMLDocument(downloadData, idataStream); - idataStream.close(); - downloadData["size"] = LLSD(LLSD::Integer(size)); + mDownloadData["size"] = LLSD(LLSD::Integer(size)); llofstream odataStream(mDownloadRecordPath); - parser.toPrettyXML(downloadData, odataStream); + LLSDSerialize parser; + parser.toPrettyXML(mDownloadData, odataStream); } catch (std::exception const & e) { LL_WARNS("UpdateDownload") << "unable to read content length (" << e.what() << ")" << LL_ENDL; @@ -218,17 +236,16 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u curl_easy_reset(mCurl); } - llassert(mCurl != 0); // TODO: real error handling here. + if(mCurl == 0) throw DownloadError("failed to initialize curl"); - CURLcode code; - code = curl_easy_setopt(mCurl, CURLOPT_NOSIGNAL, true); - code = curl_easy_setopt(mCurl, CURLOPT_FOLLOWLOCATION, true); - code = curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, &write_function); - code = curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, this); - code = curl_easy_setopt(mCurl, CURLOPT_HEADERFUNCTION, &header_function); - code = curl_easy_setopt(mCurl, CURLOPT_HEADERDATA, this); - code = curl_easy_setopt(mCurl, CURLOPT_HTTPGET, true); - code = curl_easy_setopt(mCurl, CURLOPT_URL, url.c_str()); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_NOSIGNAL, true)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_FOLLOWLOCATION, true)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, &write_function)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, this)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERFUNCTION, &header_function)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERDATA, this)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPGET, true)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_URL, url.c_str())); } @@ -236,7 +253,7 @@ void LLUpdateDownloader::Implementation::resumeDownloading(LLSD const & download { } - +/* bool LLUpdateDownloader::Implementation::shouldResumeOngoingDownload(LLURI const & uri, LLSD & downloadData) { if(!LLFile::isfile(mDownloadRecordPath)) return false; @@ -259,23 +276,42 @@ bool LLUpdateDownloader::Implementation::shouldResumeOngoingDownload(LLURI const return true; } + */ -void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri) +void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std::string const & hash) { - LLSD downloadData; - downloadData["url"] = uri.asString(); + mDownloadData["url"] = uri.asString(); + mDownloadData["hash"] = hash; LLSD path = uri.pathArray(); + if(path.size() == 0) throw DownloadError("no file path"); std::string fileName = path[path.size() - 1].asString(); std::string filePath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, fileName); - LL_INFOS("UpdateDownload") << "downloading " << filePath << LL_ENDL; - LL_INFOS("UpdateDownload") << "from " << uri.asString() << LL_ENDL; - downloadData["path"] = filePath; + mDownloadData["path"] = filePath; + + LL_INFOS("UpdateDownload") << "downloading " << filePath << "\n" + << "from " << uri.asString() << LL_ENDL; + llofstream dataStream(mDownloadRecordPath); LLSDSerialize parser; - parser.toPrettyXML(downloadData, dataStream); + parser.toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath, std::ios_base::out | std::ios_base::binary); initializeCurlGet(uri.asString()); start(); } + + +void LLUpdateDownloader::Implementation::throwOnCurlError(CURLcode code) +{ + if(code != CURLE_OK) { + const char * errorString = curl_easy_strerror(code); + if(errorString != 0) { + throw DownloadError(curl_easy_strerror(code)); + } else { + throw DownloadError("unknown curl error"); + } + } else { + ; // No op. + } +} diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h index 6118c4338e..8754ea329c 100644 --- a/indra/viewer_components/updater/llupdatedownloader.h +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -27,7 +27,6 @@ #define LL_UPDATE_DOWNLOADER_H -#include #include #include #include "lluri.h" @@ -39,20 +38,20 @@ class LLUpdateDownloader { public: - class BusyError; class Client; class Implementation; + // Returns the path to the download marker file containing details of the + // latest download. + static std::string downloadMarkerPath(void); + LLUpdateDownloader(Client & client); // Cancel any in progress download; a no op if none is in progress. void cancel(void); // Start a new download. - // - // This method will throw a BusyException instance if a download is already - // in progress. - void download(LLURI const & uri); + void download(LLURI const & uri, std::string const & hash); // Returns true if a download is in progress. bool isDownloading(void); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index e865552fb3..1e0c393539 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -90,8 +90,12 @@ public: // LLUpdateChecker::Client: virtual void error(std::string const & message); - virtual void optionalUpdate(std::string const & newVersion, LLURI const & uri); - virtual void requiredUpdate(std::string const & newVersion, LLURI const & uri); + virtual void optionalUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash); + virtual void requiredUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash); virtual void upToDate(void); // LLUpdateDownloader::Client @@ -195,14 +199,18 @@ void LLUpdaterServiceImpl::error(std::string const & message) retry(); } -void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion, LLURI const & uri) +void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash) { - mUpdateDownloader.download(uri); + mUpdateDownloader.download(uri, hash); } -void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion, LLURI const & uri) +void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion, + LLURI const & uri, + std::string const & hash) { - mUpdateDownloader.download(uri); + mUpdateDownloader.download(uri, hash); } void LLUpdaterServiceImpl::upToDate(void) diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 958526e35b..20d0f8fa09 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -64,7 +64,7 @@ void LLUpdateChecker::check(std::string const & protocolVersion, std::string con std::string const & servicePath, std::string channel, std::string version) {} LLUpdateDownloader::LLUpdateDownloader(Client & ) {} -void LLUpdateDownloader::download(LLURI const & ){} +void LLUpdateDownloader::download(LLURI const & , std::string const &){} /***************************************************************************** * TUT -- cgit v1.2.3 From 4d1e45f20f924f070d0f0139878c2c96e698fb07 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 4 Nov 2010 17:14:12 -0700 Subject: added hash validation of downloaded file. --- .../updater/llupdatedownloader.cpp | 41 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 23772e021e..59e929d99f 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -29,6 +29,7 @@ #include #include "lldir.h" #include "llfile.h" +#include "llmd5.h" #include "llsd.h" #include "llsdserialize.h" #include "llthread.h" @@ -58,6 +59,7 @@ private: void run(void); void startDownloading(LLURI const & uri, std::string const & hash); void throwOnCurlError(CURLcode code); + bool validateDownload(void); LOG_CLASS(LLUpdateDownloader::Implementation); }; @@ -130,6 +132,7 @@ namespace { return bytes; } + size_t header_function(void * data, size_t blockSize, size_t blocks, void * downloader) { size_t bytes = blockSize * blocks; @@ -219,10 +222,18 @@ void LLUpdateDownloader::Implementation::run(void) { CURLcode code = curl_easy_perform(mCurl); if(code == CURLE_OK) { - LL_INFOS("UpdateDownload") << "download successful" << LL_ENDL; - mClient.downloadComplete(); + if(validateDownload()) { + LL_INFOS("UpdateDownload") << "download successful" << LL_ENDL; + mClient.downloadComplete(); + } else { + LL_INFOS("UpdateDownload") << "download failed hash check" << LL_ENDL; + std::string filePath = mDownloadData["path"].asString(); + if(filePath.size() != 0) LLFile::remove(filePath); + mClient.downloadError("failed hash check"); + } } else { - LL_WARNS("UpdateDownload") << "download failed with error " << code << LL_ENDL; + LL_WARNS("UpdateDownload") << "download failed with error '" << + curl_easy_strerror(code) << "'" << LL_ENDL; mClient.downloadError("curl error"); } } @@ -253,6 +264,7 @@ void LLUpdateDownloader::Implementation::resumeDownloading(LLSD const & download { } + /* bool LLUpdateDownloader::Implementation::shouldResumeOngoingDownload(LLURI const & uri, LLSD & downloadData) { @@ -289,8 +301,9 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std std::string filePath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, fileName); mDownloadData["path"] = filePath; - LL_INFOS("UpdateDownload") << "downloading " << filePath << "\n" - << "from " << uri.asString() << LL_ENDL; + LL_INFOS("UpdateDownload") << "downloading " << filePath + << " from " << uri.asString() << LL_ENDL; + LL_INFOS("UpdateDownload") << "hash of file is " << hash << LL_ENDL; llofstream dataStream(mDownloadRecordPath); LLSDSerialize parser; @@ -315,3 +328,21 @@ void LLUpdateDownloader::Implementation::throwOnCurlError(CURLcode code) ; // No op. } } + + +bool LLUpdateDownloader::Implementation::validateDownload(void) +{ + std::string filePath = mDownloadData["path"].asString(); + llifstream fileStream(filePath); + if(!fileStream) return false; + + std::string hash = mDownloadData["hash"].asString(); + if(hash.size() != 0) { + LL_INFOS("UpdateDownload") << "checking hash..." << LL_ENDL; + char digest[33]; + LLMD5(fileStream).hex_digest(digest); + return hash == digest; + } else { + return true; // No hash check provided. + } +} -- cgit v1.2.3 From 95d39166faecec2c851285775422c3f668641de2 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 4 Nov 2010 19:11:40 -0700 Subject: Fix for windows build breakage in teamcity. --- indra/viewer_components/updater/llupdaterservice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 83b09c4bdd..04adf461b6 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -42,7 +42,7 @@ public: LLUpdaterService(); ~LLUpdaterService(); - void setParams(const std::string& version, + void setParams(const std::string& protocol_version, const std::string& url, const std::string& path, const std::string& channel, -- cgit v1.2.3 From 9d7cdc17e311ba5f1f62112e316c531b68f67046 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 5 Nov 2010 11:12:54 -0700 Subject: resume feature (untested). --- .../updater/llupdatedownloader.cpp | 104 ++++++++++++++------- .../viewer_components/updater/llupdatedownloader.h | 5 +- .../viewer_components/updater/llupdaterservice.cpp | 2 +- 3 files changed, 77 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 59e929d99f..102f2f9eec 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -25,6 +25,7 @@ #include "linden_common.h" #include +#include #include #include #include "lldir.h" @@ -47,6 +48,8 @@ public: bool isDownloading(void); void onHeader(void * header, size_t size); void onBody(void * header, size_t size); + void resume(void); + private: LLUpdateDownloader::Client & mClient; CURL * mCurl; @@ -54,8 +57,8 @@ private: llofstream mDownloadStream; std::string mDownloadRecordPath; - void initializeCurlGet(std::string const & url); - void resumeDownloading(LLSD const & downloadData); + void initializeCurlGet(std::string const & url, bool processHeader); + void resumeDownloading(size_t startByte); void run(void); void startDownloading(LLURI const & uri, std::string const & hash); void throwOnCurlError(CURLcode code); @@ -119,6 +122,12 @@ bool LLUpdateDownloader::isDownloading(void) } +void LLUpdateDownloader::resume(void) +{ + mImplementation->resume(); +} + + // LLUpdateDownloader::Implementation //----------------------------------------------------------------------------- @@ -183,6 +192,45 @@ bool LLUpdateDownloader::Implementation::isDownloading(void) return !isStopped(); } + +void LLUpdateDownloader::Implementation::resume(void) +{ + llifstream dataStream(mDownloadRecordPath); + if(!dataStream) { + mClient.downloadError("no download marker"); + return; + } + + LLSDSerialize parser; + parser.fromXMLDocument(mDownloadData, dataStream); + + if(!mDownloadData.asBoolean()) { + mClient.downloadError("no download information in marker"); + return; + } + + std::string filePath = mDownloadData["path"].asString(); + try { + if(LLFile::isfile(filePath)) { + llstat fileStatus; + LLFile::stat(filePath, &fileStatus); + if(fileStatus.st_size != mDownloadData["size"].asInteger()) { + resumeDownloading(fileStatus.st_size); + } else if(!validateDownload()) { + LLFile::remove(filePath); + download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString()); + } else { + mClient.downloadComplete(mDownloadData); + } + } else { + download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString()); + } + } catch(DownloadError & e) { + mClient.downloadError(e.what()); + } +} + + void LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) { char const * headerPtr = reinterpret_cast (buffer); @@ -221,10 +269,11 @@ void LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size) void LLUpdateDownloader::Implementation::run(void) { CURLcode code = curl_easy_perform(mCurl); + LLFile::remove(mDownloadRecordPath); if(code == CURLE_OK) { if(validateDownload()) { LL_INFOS("UpdateDownload") << "download successful" << LL_ENDL; - mClient.downloadComplete(); + mClient.downloadComplete(mDownloadData); } else { LL_INFOS("UpdateDownload") << "download failed hash check" << LL_ENDL; std::string filePath = mDownloadData["path"].asString(); @@ -239,7 +288,7 @@ void LLUpdateDownloader::Implementation::run(void) } -void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & url) +void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & url, bool processHeader) { if(mCurl == 0) { mCurl = curl_easy_init(); @@ -253,42 +302,33 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_FOLLOWLOCATION, true)); throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, &write_function)); throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, this)); - throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERFUNCTION, &header_function)); - throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERDATA, this)); + if(processHeader) { + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERFUNCTION, &header_function)); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HEADERDATA, this)); + } throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPGET, true)); throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_URL, url.c_str())); } -void LLUpdateDownloader::Implementation::resumeDownloading(LLSD const & downloadData) -{ -} - - -/* -bool LLUpdateDownloader::Implementation::shouldResumeOngoingDownload(LLURI const & uri, LLSD & downloadData) +void LLUpdateDownloader::Implementation::resumeDownloading(size_t startByte) { - if(!LLFile::isfile(mDownloadRecordPath)) return false; + initializeCurlGet(mDownloadData["url"].asString(), false); - llifstream dataStream(mDownloadRecordPath); - LLSDSerialize parser; - parser.fromXMLDocument(downloadData, dataStream); + // The header 'Range: bytes n-' will request the bytes remaining in the + // source begining with byte n and ending with the last byte. + boost::format rangeHeaderFormat("Range: bytes=%u-"); + rangeHeaderFormat % startByte; + curl_slist * headerList = 0; + headerList = curl_slist_append(headerList, rangeHeaderFormat.str().c_str()); + if(headerList == 0) throw DownloadError("cannot add Range header"); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, headerList)); + curl_slist_free_all(headerList); - if(downloadData["url"].asString() != uri.asString()) return false; - - std::string downloadedFilePath = downloadData["path"].asString(); - if(LLFile::isfile(downloadedFilePath)) { - llstat fileStatus; - LLFile::stat(downloadedFilePath, &fileStatus); - downloadData["bytes_downloaded"] = LLSD(LLSD::Integer(fileStatus.st_size)); - return true; - } else { - return false; - } - - return true; + mDownloadStream.open(mDownloadData["path"].asString(), + std::ios_base::out | std::ios_base::binary | std::ios_base::app); + start(); } - */ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std::string const & hash) @@ -310,7 +350,7 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std parser.toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath, std::ios_base::out | std::ios_base::binary); - initializeCurlGet(uri.asString()); + initializeCurlGet(uri.asString(), true); start(); } diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h index 8754ea329c..7bfb430879 100644 --- a/indra/viewer_components/updater/llupdatedownloader.h +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -56,6 +56,9 @@ public: // Returns true if a download is in progress. bool isDownloading(void); + // Resume a partial download. + void resume(void); + private: boost::shared_ptr mImplementation; }; @@ -68,7 +71,7 @@ class LLUpdateDownloader::Client { public: // The download has completed successfully. - virtual void downloadComplete(void) = 0; + virtual void downloadComplete(LLSD const & data) = 0; // The download failed. virtual void downloadError(std::string const & message) = 0; diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 1e0c393539..dc48606cbc 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -99,7 +99,7 @@ public: virtual void upToDate(void); // LLUpdateDownloader::Client - void downloadComplete(void) { retry(); } + void downloadComplete(LLSD const & data) { retry(); } void downloadError(std::string const & message) { retry(); } bool onMainLoop(LLSD const & event); -- cgit v1.2.3 From ab42f31608a2abc0982119d6aebdb0972d41427f Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 5 Nov 2010 14:30:09 -0400 Subject: SH-410 Opaque Water Project version 2.0 First implementation with UI changes. --- indra/newview/app_settings/settings.xml | 11 +++ indra/newview/featuretable.txt | 5 + indra/newview/featuretable_mac.txt | 5 + indra/newview/featuretable_xp.txt | 5 + indra/newview/lldrawpoolwater.cpp | 102 ++++++++++++++++++++- indra/newview/lldrawpoolwater.h | 4 + indra/newview/llviewercontrol.cpp | 14 +++ indra/newview/llvowater.cpp | 18 +++- .../default/xui/en/panel_preferences_graphics1.xml | 18 +++- 9 files changed, 169 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3f23fee865..7b3f50e4e2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8318,6 +8318,17 @@ Value 1.0 + RenderTransparentWater + + Comment + Render water as transparent. Setting to false renders water as opaque with a simple texture applied. + Persist + 1 + Type + Boolean + Value + 1 + RenderTreeLODFactor Comment diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index d69842d5f1..a95abd7dd1 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -42,6 +42,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 4 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 @@ -80,6 +81,7 @@ RenderObjectBump 1 0 RenderReflectionDetail 1 0 RenderTerrainDetail 1 0 RenderTerrainLODFactor 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 @@ -108,6 +110,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -135,6 +138,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 2 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -162,6 +166,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 4 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 2.0 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index f030c9f8e5..6dabef53a8 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -43,6 +43,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 3 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 @@ -80,6 +81,7 @@ RenderObjectBump 1 0 RenderReflectionDetail 1 0 RenderTerrainDetail 1 0 RenderTerrainLODFactor 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 @@ -107,6 +109,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -133,6 +136,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 2 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -159,6 +163,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 3 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 2.0 diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index dae7705971..a09ba17c62 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -42,6 +42,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 4 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVBOEnable 1 1 @@ -80,6 +81,7 @@ RenderObjectBump 1 0 RenderReflectionDetail 1 0 RenderTerrainDetail 1 0 RenderTerrainLODFactor 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 @@ -108,6 +110,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -135,6 +138,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 2 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 @@ -162,6 +166,7 @@ RenderObjectBump 1 1 RenderReflectionDetail 1 4 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 RenderVolumeLODFactor 1 2.0 diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 6126908231..f6b3ec7764 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -48,7 +48,8 @@ #include "llviewershadermgr.h" #include "llwaterparammanager.h" -const LLUUID WATER_TEST("2bfd3884-7e27-69b9-ba3a-3e673f680004"); +const LLUUID TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004"); +const LLUUID OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055"); static float sTime; @@ -71,10 +72,14 @@ LLDrawPoolWater::LLDrawPoolWater() : gGL.getTexUnit(0)->bind(mHBTex[1]); mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); - mWaterImagep = LLViewerTextureManager::getFetchedTexture(WATER_TEST); - mWaterImagep->setNoDelete() ; + + mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE); + llassert(mWaterImagep); + mWaterImagep->setNoDelete(); + mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); + llassert(mOpaqueWaterImagep); mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); - mWaterNormp->setNoDelete() ; + mWaterNormp->setNoDelete(); restoreGL(); } @@ -161,6 +166,14 @@ void LLDrawPoolWater::render(S32 pass) std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); + // See if we are rendering water as opaque or not + if (!gSavedSettings.getBOOL("RenderTransparentWater")) + { + // render water for low end hardware + renderOpaqueLegacyWater(); + return; + } + LLGLEnable blend(GL_BLEND); if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) @@ -314,6 +327,87 @@ void LLDrawPoolWater::render(S32 pass) gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } +// for low end hardware +void LLDrawPoolWater::renderOpaqueLegacyWater() +{ + LLVOSky *voskyp = gSky.mVOSkyp; + + stop_glerror(); + + // Depth sorting and write to depth buffer + // since this is opaque, we should see nothing + // behind the water. No blending because + // of no transparency. And no face culling so + // that the underside of the water is also opaque. + LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); + LLGLDisable no_cull(GL_CULL_FACE); + LLGLDisable no_blend(GL_BLEND); + + gPipeline.disableLights(); + + mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); + + // Activate the texture binding and bind one + // texture since all images will have the same texture + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); + + // Automatically generate texture coords for water texture + glEnable(GL_TEXTURE_GEN_S); //texture unit 0 + glEnable(GL_TEXTURE_GEN_T); //texture unit 0 + glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + + // Use the fact that we know all water faces are the same size + // to save some computation + + // Slowly move texture coordinates over time so the watter appears + // to be moving. + F32 movement_period_secs = 50.f; + + F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); + + if (movement_period_secs != 0) + { + offset /= movement_period_secs; + } + else + { + offset = 0; + } + + F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; + F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; + + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + + glColor3f(1.f, 1.f, 1.f); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + + face->renderIndexed(); + } + + stop_glerror(); + + // Reset the settings back to expected values + glDisable(GL_TEXTURE_GEN_S); //texture unit 0 + glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); +} + + void LLDrawPoolWater::renderReflection(LLFace* face) { LLVOSky *voskyp = gSky.mVOSkyp; diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h index 3ab4bc5e2c..dff1830129 100644 --- a/indra/newview/lldrawpoolwater.h +++ b/indra/newview/lldrawpoolwater.h @@ -39,6 +39,7 @@ class LLDrawPoolWater: public LLFacePool protected: LLPointer mHBTex[2]; LLPointer mWaterImagep; + LLPointer mOpaqueWaterImagep; LLPointer mWaterNormp; public: @@ -81,6 +82,9 @@ public: void renderReflection(LLFace* face); void shade(); + +protected: + void renderOpaqueLegacyWater(); }; void cgErrorCallback(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index fbec2a7b9e..117e49d67f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -117,10 +117,23 @@ static bool handleSetShaderChanged(const LLSD& newvalue) gBumpImageList.destroyGL(); gBumpImageList.restoreGL(); + // Changing shader also changes the terrain detail to high, reflect that change here + if (newvalue.asBoolean()) + { + // shaders enabled, set terrain detail to high + gSavedSettings.setS32("RenderTerrainDetail", 1); + } + // else, leave terrain detail as is LLViewerShaderMgr::instance()->setShaders(); return true; } +bool handleRenderTransparentWaterChanged(const LLSD& newvalue) +{ + LLWorld::getInstance()->updateWaterObjects(); + return true; +} + static bool handleReleaseGLBufferChanged(const LLSD& newvalue) { if (gPipeline.isInit()) @@ -637,6 +650,7 @@ void settings_setup_listeners() gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2)); + gSavedSettings.getControl("RenderTransparentWater")->getSignal()->connect(boost::bind(&handleRenderTransparentWaterChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 9280eb8fa4..71f08ec36d 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -60,8 +60,10 @@ const U32 WIDTH = (N_RES * WAVE_STEP); //128.f //64 // width of wave tile, in const F32 WAVE_STEP_INV = (1. / WAVE_STEP); -LLVOWater::LLVOWater(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLStaticViewerObject(id, pcode, regionp), +LLVOWater::LLVOWater(const LLUUID &id, + const LLPCode pcode, + LLViewerRegion *regionp) : + LLStaticViewerObject(id, pcode, regionp), mRenderType(LLPipeline::RENDER_TYPE_WATER) { // Terrain must draw during selection passes so it can block objects behind it. @@ -153,11 +155,17 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable) LLStrider indicesp; U16 index_offset; - S32 size = 16; - S32 num_quads = size*size; - face->setSize(4*num_quads, 6*num_quads); + // A quad is 4 vertices and 6 indices (making 2 triangles) + static const unsigned int vertices_per_quad = 4; + static const unsigned int indices_per_quad = 6; + const S32 size = gSavedSettings.getBOOL("RenderTransparentWater") ? 16 : 1; + + const S32 num_quads = size * size; + face->setSize(vertices_per_quad * num_quads, + indices_per_quad * num_quads); + if (face->mVertexBuffer.isNull()) { face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index aae373ed33..3ceee60927 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -174,6 +174,16 @@ width="128"> Shaders: + Date: Fri, 5 Nov 2010 13:56:36 -0700 Subject: Fixed windows build error. --- indra/viewer_components/updater/llupdatedownloader.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 102f2f9eec..75f896cc76 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -201,8 +201,7 @@ void LLUpdateDownloader::Implementation::resume(void) return; } - LLSDSerialize parser; - parser.fromXMLDocument(mDownloadData, dataStream); + LLSDSerialize::fromXMLDocument(mDownloadData, dataStream); if(!mDownloadData.asBoolean()) { mClient.downloadError("no download information in marker"); @@ -248,8 +247,7 @@ void LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) mDownloadData["size"] = LLSD(LLSD::Integer(size)); llofstream odataStream(mDownloadRecordPath); - LLSDSerialize parser; - parser.toPrettyXML(mDownloadData, odataStream); + LLSDSerialize::toPrettyXML(mDownloadData, odataStream); } catch (std::exception const & e) { LL_WARNS("UpdateDownload") << "unable to read content length (" << e.what() << ")" << LL_ENDL; @@ -346,8 +344,7 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std LL_INFOS("UpdateDownload") << "hash of file is " << hash << LL_ENDL; llofstream dataStream(mDownloadRecordPath); - LLSDSerialize parser; - parser.toPrettyXML(mDownloadData, dataStream); + LLSDSerialize::toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath, std::ios_base::out | std::ios_base::binary); initializeCurlGet(uri.asString(), true); -- cgit v1.2.3 From a13acfc9073b0e29d84e1633fc11ff08e285be8f Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Fri, 5 Nov 2010 15:08:27 -0700 Subject: Fixed build error due to unreferenced local variable. --- indra/viewer_components/updater/llupdatedownloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 75f896cc76..efb55ab83a 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -158,7 +158,7 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & mDownloadRecordPath(LLUpdateDownloader::downloadMarkerPath()) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case. - llassert(code = CURLE_OK); // TODO: real error handling here. + llverify(code == CURLE_OK); // TODO: real error handling here. } -- cgit v1.2.3 From 02c362b8ccad08f290ca99a738ca6ad1546c7df6 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 5 Nov 2010 15:56:33 -0700 Subject: implement download cancel (untested). --- .../updater/llupdatedownloader.cpp | 37 +++++++++++++++------- .../viewer_components/updater/llupdatedownloader.h | 3 +- 2 files changed, 27 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 102f2f9eec..eaef230a8f 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -46,11 +46,12 @@ public: void cancel(void); void download(LLURI const & uri, std::string const & hash); bool isDownloading(void); - void onHeader(void * header, size_t size); - void onBody(void * header, size_t size); + size_t onHeader(void * header, size_t size); + size_t onBody(void * header, size_t size); void resume(void); private: + bool mCancelled; LLUpdateDownloader::Client & mClient; CURL * mCurl; LLSD mDownloadData; @@ -137,28 +138,27 @@ namespace { size_t write_function(void * data, size_t blockSize, size_t blocks, void * downloader) { size_t bytes = blockSize * blocks; - reinterpret_cast(downloader)->onBody(data, bytes); - return bytes; + return reinterpret_cast(downloader)->onBody(data, bytes); } size_t header_function(void * data, size_t blockSize, size_t blocks, void * downloader) { size_t bytes = blockSize * blocks; - reinterpret_cast(downloader)->onHeader(data, bytes); - return bytes; + return reinterpret_cast(downloader)->onHeader(data, bytes); } } LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & client): LLThread("LLUpdateDownloader"), + mCancelled(false), mClient(client), mCurl(0), mDownloadRecordPath(LLUpdateDownloader::downloadMarkerPath()) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case. - llassert(code = CURLE_OK); // TODO: real error handling here. + llassert(code == CURLE_OK); // TODO: real error handling here. } @@ -170,7 +170,7 @@ LLUpdateDownloader::Implementation::~Implementation() void LLUpdateDownloader::Implementation::cancel(void) { - llassert(!"not implemented"); + mCancelled = true; } @@ -231,12 +231,12 @@ void LLUpdateDownloader::Implementation::resume(void) } -void LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) +size_t LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) { char const * headerPtr = reinterpret_cast (buffer); std::string header(headerPtr, headerPtr + size); size_t colonPosition = header.find(':'); - if(colonPosition == std::string::npos) return; // HTML response; ignore. + if(colonPosition == std::string::npos) return size; // HTML response; ignore. if(header.substr(0, colonPosition) == "Content-Length") { try { @@ -257,20 +257,25 @@ void LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) } else { ; // No op. } + + return size; } -void LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size) +size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size) { + if(mCancelled) return 0; // Forces a write error which will halt curl thread. + mDownloadStream.write(reinterpret_cast(buffer), size); + return size; } void LLUpdateDownloader::Implementation::run(void) { CURLcode code = curl_easy_perform(mCurl); - LLFile::remove(mDownloadRecordPath); if(code == CURLE_OK) { + LLFile::remove(mDownloadRecordPath); if(validateDownload()) { LL_INFOS("UpdateDownload") << "download successful" << LL_ENDL; mClient.downloadComplete(mDownloadData); @@ -280,9 +285,13 @@ void LLUpdateDownloader::Implementation::run(void) if(filePath.size() != 0) LLFile::remove(filePath); mClient.downloadError("failed hash check"); } + } else if(mCancelled && (code == CURLE_WRITE_ERROR)) { + LL_INFOS("UpdateDownload") << "download canceled by user" << LL_ENDL; + // Do not call back client. } else { LL_WARNS("UpdateDownload") << "download failed with error '" << curl_easy_strerror(code) << "'" << LL_ENDL; + LLFile::remove(mDownloadRecordPath); mClient.downloadError("curl error"); } } @@ -381,6 +390,10 @@ bool LLUpdateDownloader::Implementation::validateDownload(void) LL_INFOS("UpdateDownload") << "checking hash..." << LL_ENDL; char digest[33]; LLMD5(fileStream).hex_digest(digest); + if(hash != digest) { + LL_WARNS("UpdateDownload") << "download hash mismatch; expeted " << hash << + " but download is " << digest << LL_ENDL; + } return hash == digest; } else { return true; // No hash check provided. diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h index dc8ecc378a..491a638f9a 100644 --- a/indra/viewer_components/updater/llupdatedownloader.h +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -47,7 +47,8 @@ public: LLUpdateDownloader(Client & client); - // Cancel any in progress download; a no op if none is in progress. + // Cancel any in progress download; a no op if none is in progress. The + // client will not receive a complete or error callback. void cancel(void); // Start a new download. -- cgit v1.2.3 From 1a711b3fd5912776424012fcfcb472baf6c195af Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Fri, 5 Nov 2010 18:33:25 -0700 Subject: "Fix" for linux link errors due to library ordering problems on the linker command line. --- indra/viewer_components/updater/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index 64a0f98c2a..563b64655d 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -49,7 +49,6 @@ target_link_libraries(llupdaterservice ${LLMESSAGE_LIBRARIES} ${LLPLUGIN_LIBRARIES} ${LLVFS_LIBRARIES} - ${CURL_LIBRARIES} ) if(LL_TESTS) -- cgit v1.2.3 From e1016b5bc7cda03fed98b10f1ee5615245495e00 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Mon, 8 Nov 2010 09:49:38 -0800 Subject: Removed refrences to SLPlugin from LLUpdaterService and test. --- .../viewer_components/updater/llupdaterservice.cpp | 30 ---------------------- .../updater/tests/llupdaterservice_test.cpp | 18 ------------- 2 files changed, 48 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index dc48606cbc..4292da1528 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -31,7 +31,6 @@ #include "llupdaterservice.h" #include "llupdatechecker.h" -#include "llpluginprocessparent.h" #include #include @@ -42,7 +41,6 @@ boost::weak_ptr gUpdater; class LLUpdaterServiceImpl : - public LLPluginProcessParentOwner, public LLUpdateChecker::Client, public LLUpdateDownloader::Client { @@ -56,7 +54,6 @@ class LLUpdaterServiceImpl : unsigned int mCheckPeriod; bool mIsChecking; - boost::scoped_ptr mPlugin; LLUpdateChecker mUpdateChecker; LLUpdateDownloader mUpdateDownloader; @@ -70,12 +67,6 @@ public: LLUpdaterServiceImpl(); virtual ~LLUpdaterServiceImpl(); - // LLPluginProcessParentOwner interfaces - virtual void receivePluginMessage(const LLPluginMessage &message); - virtual bool receivePluginMessageEarly(const LLPluginMessage &message); - virtual void pluginLaunchFailed(); - virtual void pluginDied(); - void setParams(const std::string& protocol_version, const std::string& url, const std::string& path, @@ -110,12 +101,9 @@ const std::string LLUpdaterServiceImpl::sListenerName = "LLUpdaterServiceImpl"; LLUpdaterServiceImpl::LLUpdaterServiceImpl() : mIsChecking(false), mCheckPeriod(0), - mPlugin(0), mUpdateChecker(*this), mUpdateDownloader(*this) { - // Create the plugin parent, this is the owner. - mPlugin.reset(new LLPluginProcessParent(this)); } LLUpdaterServiceImpl::~LLUpdaterServiceImpl() @@ -124,24 +112,6 @@ LLUpdaterServiceImpl::~LLUpdaterServiceImpl() LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); } -// LLPluginProcessParentOwner interfaces -void LLUpdaterServiceImpl::receivePluginMessage(const LLPluginMessage &message) -{ -} - -bool LLUpdaterServiceImpl::receivePluginMessageEarly(const LLPluginMessage &message) -{ - return false; -}; - -void LLUpdaterServiceImpl::pluginLaunchFailed() -{ -}; - -void LLUpdaterServiceImpl::pluginDied() -{ -}; - void LLUpdaterServiceImpl::setParams(const std::string& protocol_version, const std::string& url, const std::string& path, diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 20d0f8fa09..7f45ae51fb 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -36,28 +36,10 @@ #include "../../../test/debug.h" #include "llevents.h" -#include "llpluginprocessparent.h" /***************************************************************************** * MOCK'd *****************************************************************************/ -LLPluginProcessParentOwner::~LLPluginProcessParentOwner() {} -LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) -: mOwner(owner), - mIncomingQueueMutex(gAPRPoolp) -{ -} - -LLPluginProcessParent::~LLPluginProcessParent() {} -LLPluginMessagePipeOwner::LLPluginMessagePipeOwner(){} -LLPluginMessagePipeOwner::~LLPluginMessagePipeOwner(){} -void LLPluginProcessParent::receiveMessageRaw(const std::string &message) {} -int LLPluginMessagePipeOwner::socketError(int) { return 0; } -void LLPluginProcessParent::setMessagePipe(LLPluginMessagePipe *message_pipe) {} -void LLPluginMessagePipeOwner::setMessagePipe(class LLPluginMessagePipe *) {} -LLPluginMessage::~LLPluginMessage() {} -LLPluginMessage::LLPluginMessage(LLPluginMessage const&) {} - LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client) {} void LLUpdateChecker::check(std::string const & protocolVersion, std::string const & hostUrl, -- cgit v1.2.3 From 3fa059409aad9d7b5aedb4ed112cb52da6990ac4 Mon Sep 17 00:00:00 2001 From: Bill Curtis Date: Mon, 8 Nov 2010 10:54:58 -0800 Subject: changes to read max-agent-groups from login.cgi response --- indra/llcommon/indra_constants.h | 3 --- indra/newview/llagent.cpp | 3 ++- indra/newview/llfloatergroups.cpp | 5 +++-- indra/newview/lllogininstance.cpp | 1 + indra/newview/llstartup.cpp | 6 +++++- indra/newview/llstartup.h | 1 + indra/newview/llviewermessage.cpp | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index b0618bfe59..ccdb8a413d 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -245,9 +245,6 @@ const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only const U8 SIM_ACCESS_DOWN = 254; const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; -// group constants -const S32 MAX_AGENT_GROUPS = 25; - // attachment constants const S32 MAX_AGENT_ATTACHMENTS = 38; const U8 ATTACHMENT_ADD = 0x80; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b202cb5098..9350e50305 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -58,6 +58,7 @@ #include "llsidetray.h" #include "llsky.h" #include "llsmoothstep.h" +#include "llstartup.h" #include "llstatusbar.h" #include "llteleportflags.h" #include "lltool.h" @@ -2427,7 +2428,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return mGroups.count() < MAX_AGENT_GROUPS; + return mGroups.count() < gMaxAgentGroups; } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 3cd2154531..679c932995 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -41,6 +41,7 @@ #include "llbutton.h" #include "llgroupactions.h" #include "llscrolllistctrl.h" +#include "llstartup.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "lltrans.h" @@ -171,7 +172,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",MAX_AGENT_GROUPS)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -182,7 +183,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",MAX_AGENT_GROUPS)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 7b2f5984a7..9461bfbc32 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -146,6 +146,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia requested_options.append("newuser-config"); requested_options.append("ui-config"); #endif + requested_options.append("max-agent-groups"); requested_options.append("map-server-url"); requested_options.append("voice-config"); requested_options.append("tutorial_setting"); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 975d1f9f32..5781398faa 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -198,6 +198,7 @@ // exported globals // bool gAgentMovementCompleted = false; +S32 gMaxAgentGroups; std::string SCREEN_HOME_FILENAME = "screen_home.bmp"; std::string SCREEN_LAST_FILENAME = "screen_last.bmp"; @@ -2944,7 +2945,7 @@ bool process_login_success_response() text = response["circuit_code"].asString(); if(!text.empty()) { - gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10); + gMessageSystem->mOurCircuitCode = strtoult(ext.c_str(), NULL, 10); } std::string sim_ip_str = response["sim_ip"]; std::string sim_port_str = response["sim_port"]; @@ -3148,6 +3149,9 @@ bool process_login_success_response() LLViewerMedia::openIDSetup(openid_url, openid_token); } + std::string max_agent_groups(response["max-agent-groups"]); + gMaxAgentGroups = atoi(max_agent_groups.c_str()); + bool success = false; // JC: gesture loading done below, when we have an asset system // in place. Don't delete/clear gUserCredentials until then. diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index e79aa0dbee..41f6f1b7ee 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -70,6 +70,7 @@ typedef enum { // exported symbols extern bool gAgentMovementCompleted; +extern S32 gMaxAgentGroups; extern LLPointer gStartTexture; class LLStartUp diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c35173a7d4..14e0d49088 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -633,7 +633,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = MAX_AGENT_GROUPS; + S32 max_groups = gMaxAgentGroups; if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.count() < max_groups) -- cgit v1.2.3 From 0836d1b1ae861ee7a226ba342166148a31cc5bdd Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Mon, 8 Nov 2010 15:51:39 -0800 Subject: Fix for linux link errors in teamcity. --- indra/newview/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f18107f673..ff099710f1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1643,7 +1643,14 @@ if (WINDOWS) endif (PACKAGE) endif (WINDOWS) +# *NOTE - this list is very sensitive to ordering, test carefully on all +# platforms if you change the releative order of the entries here. +# In particular, cmake 2.6.4 (when buidling with linux/makefile generators) +# appears to sometimes de-duplicate redundantly listed dependencies improperly. +# To work around this, higher level modules should be listed before the modules +# that they depend upon. -brad target_link_libraries(${VIEWER_BINARY_NAME} + ${UPDATER_LIBRARIES} ${LLAUDIO_LIBRARIES} ${LLCHARACTER_LIBRARIES} ${LLIMAGE_LIBRARIES} @@ -1680,7 +1687,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} ${LLLOGIN_LIBRARIES} - ${UPDATER_LIBRARIES} ${GOOGLE_PERFTOOLS_LIBRARIES} ) -- cgit v1.2.3 From d681ea89d27e0e37d77c7f57c9bc66fda3f08f4e Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 8 Nov 2010 16:10:54 -0800 Subject: Get rid of intrusive_ptr member to prevent crash on shutdown. --- indra/viewer_components/updater/llupdatechecker.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index d31244cc9b..c6aa9b0f11 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -70,7 +70,6 @@ private: Client & mClient; LLHTTPClient mHttpClient; bool mInProgress; - LLHTTPClient::ResponderPtr mMe; std::string mVersion; std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, @@ -109,8 +108,7 @@ const char * LLUpdateChecker::Implementation::sProtocolVersion = "v1.0"; LLUpdateChecker::Implementation::Implementation(LLUpdateChecker::Client & client): mClient(client), - mInProgress(false), - mMe(this) + mInProgress(false) { ; // No op. } @@ -118,7 +116,7 @@ LLUpdateChecker::Implementation::Implementation(LLUpdateChecker::Client & client LLUpdateChecker::Implementation::~Implementation() { - mMe.reset(0); + ; // No op. } @@ -136,9 +134,11 @@ void LLUpdateChecker::Implementation::check(std::string const & protocolVersion, // The HTTP client will wrap a raw pointer in a boost::intrusive_ptr causing the // passed object to be silently and automatically deleted. We pass a self- - // referential intrusive pointer stored as an attribute of this class to keep - // the client from deletig the update checker implementation instance. - mHttpClient.get(checkUrl, mMe); + // referential intrusive pointer to which we add a reference to keep the + // client from deleting the update checker implementation instance. + LLHTTPClient::ResponderPtr temporaryPtr(this); + boost::intrusive_ptr_add_ref(temporaryPtr.get()); + mHttpClient.get(checkUrl, temporaryPtr); } void LLUpdateChecker::Implementation::completed(U32 status, -- cgit v1.2.3 From 8cce8827e01dab6bfcd3e94e56b6041f8f487c76 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Mon, 8 Nov 2010 17:12:43 -0800 Subject: Fix for breakpad symbol files failing to be generated on linux. --- indra/newview/CMakeLists.txt | 8 ++++---- indra/newview/generate_breakpad_symbols.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ff099710f1..a9d1fd9064 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1837,13 +1837,13 @@ if (PACKAGE) set(VIEWER_COPY_MANIFEST copy_l_viewer_manifest) endif (LINUX) - if(CMAKE_CONFIGURATION_TYPES) + if(CMAKE_CFG_INTDIR STREQUAL ".") + set(LLBUILD_CONFIG ${CMAKE_BUILD_TYPE}) + else(CMAKE_CFG_INTDIR STREQUAL ".") # set LLBUILD_CONFIG to be a shell variable evaluated at build time # reflecting the configuration we are currently building. set(LLBUILD_CONFIG ${CMAKE_CFG_INTDIR}) - else(CMAKE_CONFIGURATION_TYPES) - set(LLBUILD_CONFIG ${CMAKE_BUILD_TYPE}) - endif(CMAKE_CONFIGURATION_TYPES) + endif(CMAKE_CFG_INTDIR STREQUAL ".") add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" COMMAND "${PYTHON_EXECUTABLE}" ARGS diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index 0e61bee1ef..4fd04d780e 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -31,6 +31,7 @@ import fnmatch import itertools import operator import os +import re import sys import shlex import subprocess @@ -48,7 +49,7 @@ class MissingModuleError(Exception): def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): print "generate_breakpad_symbols run with args: %s" % str((configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) - if configuration != "Release": + if not re.match("release", configuration, re.IGNORECASE): print "skipping breakpad symbol generation for non-release build." return 0 -- cgit v1.2.3 From 2cfcdfe2ffd97384324c940447a4197cbf85a38e Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 09:14:50 -0800 Subject: Fix some stream bugs that were affecting windows download and validation. --- indra/viewer_components/updater/llupdatedownloader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index ca1d2d25de..2794f80c47 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -272,6 +272,7 @@ size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size) void LLUpdateDownloader::Implementation::run(void) { CURLcode code = curl_easy_perform(mCurl); + mDownloadStream.close(); if(code == CURLE_OK) { LLFile::remove(mDownloadRecordPath); if(validateDownload()) { @@ -379,7 +380,7 @@ void LLUpdateDownloader::Implementation::throwOnCurlError(CURLcode code) bool LLUpdateDownloader::Implementation::validateDownload(void) { std::string filePath = mDownloadData["path"].asString(); - llifstream fileStream(filePath); + llifstream fileStream(filePath, std::ios_base::in | std::ios_base::binary); if(!fileStream) return false; std::string hash = mDownloadData["hash"].asString(); -- cgit v1.2.3 From cc3e288e9ab21bad3f836928c49fd4619b38ea43 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 9 Nov 2010 11:31:21 -0600 Subject: SH-412 Only blank screen if the actual window resized, fixes blinking on snapshot etc. --- indra/newview/llviewerdisplay.cpp | 32 +++++++++++++------------------- indra/newview/llviewerdisplay.h | 1 + indra/newview/llviewerwindow.cpp | 3 +++ 3 files changed, 17 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 1d5caabebb..ddb11829df 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -95,6 +95,7 @@ BOOL gForceRenderLandFence = FALSE; BOOL gDisplaySwapBuffers = FALSE; BOOL gDepthDirty = FALSE; BOOL gResizeScreenTexture = FALSE; +BOOL gWindowResized = FALSE; BOOL gSnapshot = FALSE; U32 gRecentFrameCount = 0; // number of 'recent' frames @@ -218,22 +219,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLMemType mt_render(LLMemType::MTYPE_RENDER); LLFastTimer t(FTM_RENDER); - if (gResizeScreenTexture) - { //skip render on frames where screen texture is resizing + if (gWindowResized) + { //skip render on frames where window has been resized gGL.flush(); - if (!for_snapshot) - { - glClear(GL_COLOR_BUFFER_BIT); - gViewerWindow->mWindow->swapBuffers(); - } - - gResizeScreenTexture = FALSE; + glClear(GL_COLOR_BUFFER_BIT); + gViewerWindow->mWindow->swapBuffers(); gPipeline.resizeScreenTexture(); - - if (!for_snapshot) - { - return; - } + gResizeScreenTexture = FALSE; + gWindowResized = FALSE; + return; } if (LLPipeline::sRenderDeferred) @@ -666,11 +660,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLVertexBuffer::clientCopy(0.016); } - //if (gResizeScreenTexture) - //{ - // gResizeScreenTexture = FALSE; - // gPipeline.resizeScreenTexture(); - //} + if (gResizeScreenTexture) + { + gResizeScreenTexture = FALSE; + gPipeline.resizeScreenTexture(); + } gGL.setColorMask(true, true); glClearColor(0,0,0,0); diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index c6e86751e8..f6467d7f93 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -40,5 +40,6 @@ extern BOOL gTeleportDisplay; extern LLFrameTimer gTeleportDisplayTimer; extern BOOL gForceRenderLandFence; extern BOOL gResizeScreenTexture; +extern BOOL gWindowResized; #endif // LL_LLVIEWERDISPLAY_H diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ea407c8f29..fda6f316e6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1863,6 +1863,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) return; } + gWindowResized = TRUE; + // update our window rectangle mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width; mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height; @@ -4439,6 +4441,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) LLVOAvatar::restoreGL(); gResizeScreenTexture = TRUE; + gWindowResized = TRUE; if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) { -- cgit v1.2.3 From 31e0c9122ecaa8aed1c5449acc3cb773441d6858 Mon Sep 17 00:00:00 2001 From: Bill Curtis Date: Tue, 9 Nov 2010 10:25:11 -0800 Subject: fixing transposed characters --- indra/newview/llstartup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 5781398faa..ac320ba761 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2945,7 +2945,7 @@ bool process_login_success_response() text = response["circuit_code"].asString(); if(!text.empty()) { - gMessageSystem->mOurCircuitCode = strtoult(ext.c_str(), NULL, 10); + gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10); } std::string sim_ip_str = response["sim_ip"]; std::string sim_port_str = response["sim_port"]; -- cgit v1.2.3 From 73b6d4d058107137425cd202e79fb0a2d9c22896 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 11:15:01 -0800 Subject: Fix crash if thread is manually shut down before it is destroyed. --- indra/llcommon/llthread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index d7b7c3699c..2408be74b9 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -153,10 +153,12 @@ void LLThread::shutdown() } delete mRunCondition; + mRunCondition = 0; - if (mIsLocalPool) + if (mIsLocalPool && mAPRPoolp) { apr_pool_destroy(mAPRPoolp); + mAPRPoolp = 0; } } -- cgit v1.2.3 From 5da253fdde8737361333161517c1173358bd17ff Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 11:16:28 -0800 Subject: Shut down thread if viewer closed while downloading; fix problem of download marker path failing to expand correctly because it was happening too early in start up. --- indra/viewer_components/updater/llupdatedownloader.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 2794f80c47..208cc48c12 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -154,8 +154,7 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & LLThread("LLUpdateDownloader"), mCancelled(false), mClient(client), - mCurl(0), - mDownloadRecordPath(LLUpdateDownloader::downloadMarkerPath()) + mCurl(0) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case. llverify(code == CURLE_OK); // TODO: real error handling here. @@ -164,6 +163,12 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & LLUpdateDownloader::Implementation::~Implementation() { + if(isDownloading()) { + cancel(); + shutdown(); + } else { + ; // No op. + } if(mCurl) curl_easy_cleanup(mCurl); } @@ -177,7 +182,8 @@ void LLUpdateDownloader::Implementation::cancel(void) void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash) { if(isDownloading()) mClient.downloadError("download in progress"); - + + mDownloadRecordPath = downloadMarkerPath(); mDownloadData = LLSD(); try { startDownloading(uri, hash); @@ -195,6 +201,9 @@ bool LLUpdateDownloader::Implementation::isDownloading(void) void LLUpdateDownloader::Implementation::resume(void) { + if(isDownloading()) mClient.downloadError("download in progress"); + + mDownloadRecordPath = downloadMarkerPath(); llifstream dataStream(mDownloadRecordPath); if(!dataStream) { mClient.downloadError("no download marker"); -- cgit v1.2.3 From fdf616c59d87219e2d5ad6e12687cf2793cfba1e Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 11:23:32 -0800 Subject: beginnings of the update installer (with simple install script for darwin). --- indra/newview/viewer_manifest.py | 4 +++ indra/viewer_components/updater/CMakeLists.txt | 23 ++++++++---- .../updater/llupdateinstaller.cpp | 38 ++++++++++++++++++++ .../viewer_components/updater/llupdateinstaller.h | 42 ++++++++++++++++++++++ .../updater/scripts/darwin/update_install | 6 ++++ 5 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 indra/viewer_components/updater/llupdateinstaller.cpp create mode 100644 indra/viewer_components/updater/llupdateinstaller.h create mode 100755 indra/viewer_components/updater/scripts/darwin/update_install (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 4596938775..f95697adb6 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -575,6 +575,10 @@ class DarwinManifest(ViewerManifest): # most everything goes in the Resources directory if self.prefix(src="", dst="Resources"): super(DarwinManifest, self).construct() + + if self.prefix(src="../viewer_components/updater", dst=""): + self.path("update_install") + self.end_prefix() if self.prefix("cursors_mac"): self.path("*.tif") diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index 563b64655d..c3607dff39 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -6,6 +6,7 @@ include(00-Common) if(LL_TESTS) include(LLAddBuildTest) endif(LL_TESTS) +include(CMakeCopyIfDifferent) include(CURL) include(LLCommon) include(LLMessage) @@ -24,12 +25,14 @@ set(updater_service_SOURCE_FILES llupdaterservice.cpp llupdatechecker.cpp llupdatedownloader.cpp + llupdateinstaller.cpp ) set(updater_service_HEADER_FILES llupdaterservice.h llupdatechecker.h llupdatedownloader.h + llupdateinstaller.h ) set_source_files_properties(${updater_service_HEADER_FILES} @@ -56,12 +59,6 @@ if(LL_TESTS) llupdaterservice.cpp ) -# set_source_files_properties( -# llupdaterservice.cpp -# PROPERTIES -# LL_TEST_ADDITIONAL_LIBRARIES "${PTH_LIBRARIES}" -# ) - LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") endif(LL_TESTS) @@ -74,3 +71,17 @@ set(UPDATER_LIBRARIES llupdaterservice CACHE INTERNAL "" ) + +# Copy install script. +if(DARWIN) + copy_if_different( + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/darwin" + "${CMAKE_CURRENT_BINARY_DIR}" + update_installer_targets + "update_install" + ) +endif() +add_custom_target(copy_update_install ALL DEPENDS ${update_installer_targets}) + + + \ No newline at end of file diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp new file mode 100644 index 0000000000..4d7c78d36c --- /dev/null +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -0,0 +1,38 @@ +/** + * @file llupdateinstaller.cpp + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llprocesslauncher.h" +#include "llupdateinstaller.h" + + +void ll_install_update(std::string const & script, std::string const & updatePath) +{ + LLProcessLauncher launcher; + launcher.setExecutable(script); + launcher.addArgument(updatePath); + launcher.launch(); + launcher.orphan(); +} \ No newline at end of file diff --git a/indra/viewer_components/updater/llupdateinstaller.h b/indra/viewer_components/updater/llupdateinstaller.h new file mode 100644 index 0000000000..a6068e9025 --- /dev/null +++ b/indra/viewer_components/updater/llupdateinstaller.h @@ -0,0 +1,42 @@ +/** + * @file llupdateinstaller.h + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_UPDATE_INSTALLER_H +#define LL_UPDATE_INSTALLER_H + + +#include + + +// +// Launch the installation script. +// +// The updater will overwrite the current installation, so it is highly recommended +// that the current application terminate once this function is called. +// +void ll_install_update(std::string const & script, std::string const & updatePath); + + +#endif \ No newline at end of file diff --git a/indra/viewer_components/updater/scripts/darwin/update_install b/indra/viewer_components/updater/scripts/darwin/update_install new file mode 100755 index 0000000000..24d344ca52 --- /dev/null +++ b/indra/viewer_components/updater/scripts/darwin/update_install @@ -0,0 +1,6 @@ +#! /bin/bash + +hdiutil attach -nobrowse $1 +cp -R /Volumes/Second\ Life\ Installer/Second\ Life\ Viewer\ 2.app /Applications +hdiutil detach /Volumes/Second\ Life\ Installer +open /Applications/Second\ Life\ Viewer\ 2.app \ No newline at end of file -- cgit v1.2.3 From 656b936915d5fd29f213f8eb7cd3873baed19109 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 9 Nov 2010 14:40:32 -0500 Subject: Add name, value info to convert_from_llsd<> specialization LL_ERRS. Prior to this, you could get a viewer crash whose ERROR: message said only: convert_from_llsd: Invalid string value This gave no hint as to *which value* was wrong, or where to go fix it. Ironically, each convert_from_llsd<> specialization already has the control_name and LLSD value in hand; added these to each such LL_ERRS message. --- indra/llxml/llcontrol.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index f9a39826f5..27c694dde9 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -1107,7 +1107,7 @@ bool convert_from_llsd(const LLSD& sd, eControlType type, const std::strin return sd.asBoolean(); else { - CONTROL_ERRS << "Invalid BOOL value" << llendl; + CONTROL_ERRS << "Invalid BOOL value for " << control_name << ": " << sd << llendl; return FALSE; } } @@ -1119,7 +1119,7 @@ S32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& return sd.asInteger(); else { - CONTROL_ERRS << "Invalid S32 value" << llendl; + CONTROL_ERRS << "Invalid S32 value for " << control_name << ": " << sd << llendl; return 0; } } @@ -1131,7 +1131,7 @@ U32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& return sd.asInteger(); else { - CONTROL_ERRS << "Invalid U32 value" << llendl; + CONTROL_ERRS << "Invalid U32 value for " << control_name << ": " << sd << llendl; return 0; } } @@ -1143,7 +1143,7 @@ F32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& return (F32) sd.asReal(); else { - CONTROL_ERRS << "Invalid F32 value" << llendl; + CONTROL_ERRS << "Invalid F32 value for " << control_name << ": " << sd << llendl; return 0.0f; } } @@ -1155,7 +1155,7 @@ std::string convert_from_llsd(const LLSD& sd, eControlType type, co return sd.asString(); else { - CONTROL_ERRS << "Invalid string value" << llendl; + CONTROL_ERRS << "Invalid string value for " << control_name << ": " << sd << llendl; return LLStringUtil::null; } } @@ -1173,7 +1173,7 @@ LLVector3 convert_from_llsd(const LLSD& sd, eControlType type, const return (LLVector3)sd; else { - CONTROL_ERRS << "Invalid LLVector3 value" << llendl; + CONTROL_ERRS << "Invalid LLVector3 value for " << control_name << ": " << sd << llendl; return LLVector3::zero; } } @@ -1185,7 +1185,7 @@ LLVector3d convert_from_llsd(const LLSD& sd, eControlType type, cons return (LLVector3d)sd; else { - CONTROL_ERRS << "Invalid LLVector3d value" << llendl; + CONTROL_ERRS << "Invalid LLVector3d value for " << control_name << ": " << sd << llendl; return LLVector3d::zero; } } @@ -1197,7 +1197,7 @@ LLRect convert_from_llsd(const LLSD& sd, eControlType type, const std::s return LLRect(sd); else { - CONTROL_ERRS << "Invalid rect value" << llendl; + CONTROL_ERRS << "Invalid rect value for " << control_name << ": " << sd << llendl; return LLRect::null; } } @@ -1211,19 +1211,19 @@ LLColor4 convert_from_llsd(const LLSD& sd, eControlType type, const st LLColor4 color(sd); if (color.mV[VRED] < 0.f || color.mV[VRED] > 1.f) { - llwarns << "Color " << control_name << " value out of range " << llendl; + llwarns << "Color " << control_name << " red value out of range: " << color << llendl; } else if (color.mV[VGREEN] < 0.f || color.mV[VGREEN] > 1.f) { - llwarns << "Color " << control_name << " value out of range " << llendl; + llwarns << "Color " << control_name << " green value out of range: " << color << llendl; } else if (color.mV[VBLUE] < 0.f || color.mV[VBLUE] > 1.f) { - llwarns << "Color " << control_name << " value out of range " << llendl; + llwarns << "Color " << control_name << " blue value out of range: " << color << llendl; } else if (color.mV[VALPHA] < 0.f || color.mV[VALPHA] > 1.f) { - llwarns << "Color " << control_name << " value out of range " << llendl; + llwarns << "Color " << control_name << " alpha value out of range: " << color << llendl; } return LLColor4(sd); @@ -1242,7 +1242,7 @@ LLColor3 convert_from_llsd(const LLSD& sd, eControlType type, const st return sd; else { - CONTROL_ERRS << "Invalid LLColor3 value" << llendl; + CONTROL_ERRS << "Invalid LLColor3 value for " << control_name << ": " << sd << llendl; return LLColor3::white; } } -- cgit v1.2.3 From 9ae2891a3afefcbf0c72cadaef203426cb0e5954 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 15:04:44 -0800 Subject: start of a thread safe queue --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llthreadsafequeue.cpp | 109 +++++++++++++++++++ indra/llcommon/llthreadsafequeue.h | 205 +++++++++++++++++++++++++++++++++++ indra/newview/CMakeLists.txt | 2 + indra/newview/llappviewer.cpp | 5 + indra/newview/llmainlooprepeater.cpp | 82 ++++++++++++++ indra/newview/llmainlooprepeater.h | 65 +++++++++++ 7 files changed, 470 insertions(+) create mode 100644 indra/llcommon/llthreadsafequeue.cpp create mode 100644 indra/llcommon/llthreadsafequeue.h create mode 100644 indra/newview/llmainlooprepeater.cpp create mode 100644 indra/newview/llmainlooprepeater.h (limited to 'indra') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 7bad780dd8..7d53667f35 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -92,6 +92,7 @@ set(llcommon_SOURCE_FILES llstringtable.cpp llsys.cpp llthread.cpp + llthreadsafequeue.cpp lltimer.cpp lluri.cpp lluuid.cpp @@ -223,6 +224,7 @@ set(llcommon_HEADER_FILES llstringtable.h llsys.h llthread.h + llthreadsafequeue.h lltimer.h lltreeiterators.h lluri.h diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp new file mode 100644 index 0000000000..a7141605ef --- /dev/null +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -0,0 +1,109 @@ +/** + * @file llthread.cpp + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include +#include +#include "llthreadsafequeue.h" + + + +// LLThreadSafeQueueImplementation +//----------------------------------------------------------------------------- + + +LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity): + mOwnsPool(pool == 0), + mPool(pool), + mQueue(0) +{ + if(mOwnsPool) { + apr_status_t status = apr_pool_create(&mPool, 0); + if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate pool"); + } else { + ; // No op. + } + + apr_status_t status = apr_queue_create(&mQueue, capacity, mPool); + if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate queue"); +} + + +LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() +{ + if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); + if(mQueue != 0) { + if(apr_queue_size(mQueue) != 0) llwarns << + "terminating queue which still contains elements;" << + "memory will be leaked" << LL_ENDL; + apr_queue_term(mQueue); + } +} + + +void LLThreadSafeQueueImplementation::pushFront(void * element) +{ + apr_status_t status = apr_queue_push(mQueue, element); + + if(status == APR_EINTR) { + throw LLThreadSafeQueueInterrupt(); + } else if(status != APR_SUCCESS) { + throw LLThreadSafeQueueError("push failed"); + } else { + ; // Success. + } +} + + +bool LLThreadSafeQueueImplementation::tryPushFront(void * element){ + return apr_queue_trypush(mQueue, element) == APR_SUCCESS; +} + + +void * LLThreadSafeQueueImplementation::popBack(void) +{ + void * element; + apr_status_t status = apr_queue_pop(mQueue, &element); + + if(status == APR_EINTR) { + throw LLThreadSafeQueueInterrupt(); + } else if(status != APR_SUCCESS) { + throw LLThreadSafeQueueError("pop failed"); + } else { + return element; + } +} + + +bool LLThreadSafeQueueImplementation::tryPopBack(void *& element) +{ + return apr_queue_trypop(mQueue, &element) == APR_SUCCESS; +} + + +size_t LLThreadSafeQueueImplementation::size() +{ + return apr_queue_size(mQueue); +} diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h new file mode 100644 index 0000000000..46c8b91932 --- /dev/null +++ b/indra/llcommon/llthreadsafequeue.h @@ -0,0 +1,205 @@ +/** + * @file llthreadsafequeue.h + * @brief Base classes for thread, mutex and condition handling. + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTHREADSAFEQUEUE_H +#define LL_LLTHREADSAFEQUEUE_H + + +#include +#include + + +struct apr_pool_t; // From apr_pools.h +class LLThreadSafeQueueImplementation; // See below. + + +// +// A general queue exception. +// +class LLThreadSafeQueueError: +public std::runtime_error +{ +public: + LLThreadSafeQueueError(std::string const & message): + std::runtime_error(message) + { + ; // No op. + } +}; + + +// +// An exception raised when blocking operations are interrupted. +// +class LLThreadSafeQueueInterrupt: + public LLThreadSafeQueueError +{ +public: + LLThreadSafeQueueInterrupt(void): + LLThreadSafeQueueError("queue operation interrupted") + { + ; // No op. + } +}; + + +struct apr_queue_t; // From apr_queue.h + + +// +// Implementation details. +// +class LLThreadSafeQueueImplementation +{ +public: + LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity); + ~LLThreadSafeQueueImplementation(); + void pushFront(void * element); + bool tryPushFront(void * element); + void * popBack(void); + bool tryPopBack(void *& element); + size_t size(); + +private: + bool mOwnsPool; + apr_pool_t * mPool; + apr_queue_t * mQueue; +}; + + +// +// Implements a thread safe FIFO. +// +template +class LLThreadSafeQueue +{ +public: + typedef ElementT value_type; + + // If the pool is set to NULL one will be allocated and managed by this + // queue. + LLThreadSafeQueue(apr_pool_t * pool = 0, unsigned int capacity = 1024); + + // Add an element to the front of queue (will block if the queue has + // reached capacity). + // + // This call will raise an interrupt error if the queue is deleted while + // the caller is blocked. + void pushFront(ElementT const & element); + + // Try to add an element to the front ofqueue without blocking. Returns + // true only if the element was actually added. + bool tryPushFront(ElementT const & element); + + // Pop the element at the end of the queue (will block if the queue is + // empty). + // + // This call will raise an interrupt error if the queue is deleted while + // the caller is blocked. + ElementT popBack(void); + + // Pop an element from the end of the queue if there is one available. + // Returns true only if an element was popped. + bool tryPopBack(ElementT & element); + + // Returns the size of the queue. + size_t size(); + +private: + LLThreadSafeQueueImplementation mImplementation; +}; + + + +// LLThreadSafeQueue +//----------------------------------------------------------------------------- + + +template +LLThreadSafeQueue::LLThreadSafeQueue(apr_pool_t * pool, unsigned int capacity): + mImplementation(pool, capacity) +{ + ; // No op. +} + + +template +void LLThreadSafeQueue::pushFront(ElementT const & element) +{ + ElementT * elementCopy = new ElementT(element); + try { + mImplementation.pushFront(elementCopy); + } catch (LLThreadSafeQueueInterrupt) { + delete elementCopy; + throw; + } +} + + +template +bool LLThreadSafeQueue::tryPushFront(ElementT const & element) +{ + ElementT * elementCopy = new ElementT(element); + bool result = mImplementation.tryPushFront(elementCopy); + if(!result) delete elementCopy; + return result; +} + + +template +ElementT LLThreadSafeQueue::popBack(void) +{ + ElementT * element = reinterpret_cast (mImplementation.popBack()); + ElementT result(*element); + delete element; + return result; +} + + +template +bool LLThreadSafeQueue::tryPopBack(ElementT & element) +{ + void * storedElement; + bool result = mImplementation.tryPopBack(storedElement); + if(result) { + ElementT * elementPtr = reinterpret_cast(storedElement); + element = *elementPtr; + delete elementPtr; + } else { + ; // No op. + } + return result; +} + + +template +size_t LLThreadSafeQueue::size(void) +{ + return mImplementation.size(); +} + + +#endif diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a9d1fd9064..36cfa615f0 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -283,6 +283,7 @@ set(viewer_SOURCE_FILES llloginhandler.cpp lllogininstance.cpp llmachineid.cpp + llmainlooprepeater.cpp llmanip.cpp llmaniprotate.cpp llmanipscale.cpp @@ -815,6 +816,7 @@ set(viewer_HEADER_FILES llloginhandler.h lllogininstance.h llmachineid.h + llmainlooprepeater.h llmanip.h llmaniprotate.h llmanipscale.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c0ec15f436..438f8668ae 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -197,6 +197,8 @@ #include "llsecapi.h" #include "llmachineid.h" +#include "llmainlooprepeater.h" + // *FIX: These extern globals should be cleaned up. // The globals either represent state/config/resource-storage of either // this app, or another 'component' of the viewer. App globals should be @@ -801,6 +803,9 @@ bool LLAppViewer::init() return 1; } + // Initialize the repeater service. + LLMainLoopRepeater::getInstance()->start(); + // // Initialize the window // diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp new file mode 100644 index 0000000000..c2eba97641 --- /dev/null +++ b/indra/newview/llmainlooprepeater.cpp @@ -0,0 +1,82 @@ +/** + * @file llmachineid.cpp + * @brief retrieves unique machine ids + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llapr.h" +#include "llevents.h" +#include "llmainlooprepeater.h" + + + +// LLMainLoopRepeater +//----------------------------------------------------------------------------- + + +LLMainLoopRepeater::LLMainLoopRepeater(void): + mQueue(gAPRPoolp, 1024) +{ + ; // No op. +} + + +void LLMainLoopRepeater::start(void) +{ + mMainLoopConnection = LLEventPumps::instance(). + obtain("mainloop").listen("stupid name here", boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1)); + mRepeaterConnection = LLEventPumps::instance(). + obtain("mainlooprepeater").listen("other stupid name here", boost::bind(&LLMainLoopRepeater::onMessage, this, _1)); +} + + +void LLMainLoopRepeater::stop(void) +{ + mMainLoopConnection.release(); + mRepeaterConnection.release(); +} + + +bool LLMainLoopRepeater::onMainLoop(LLSD const &) +{ + LLSD message; + while(mQueue.tryPopBack(message)) { + std::string pump = message["pump"].asString(); + if(pump.length() == 0 ) continue; // No pump. + LLEventPumps::instance().obtain(pump).post(message["payload"]); + } + return false; +} + + +bool LLMainLoopRepeater::onMessage(LLSD const & event) +{ + try { + mQueue.pushFront(event); + } catch(LLThreadSafeQueueError & e) { + llwarns << "could not repeat message (" << e.what() << ")" << + event.asString() << LL_ENDL; + } + return false; +} diff --git a/indra/newview/llmainlooprepeater.h b/indra/newview/llmainlooprepeater.h new file mode 100644 index 0000000000..96b83b4916 --- /dev/null +++ b/indra/newview/llmainlooprepeater.h @@ -0,0 +1,65 @@ +/** + * @file llmainlooprepeater.h + * @brief a service for repeating messages on the main loop. + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLMAINLOOPREPEATER_H +#define LL_LLMAINLOOPREPEATER_H + + +#include "llsd.h" +#include "llthreadsafequeue.h" + + +// +// A service which creates the pump 'mainlooprepeater' to which any thread can +// post a message that will be re-posted on the main loop. +// +// The posted message should contain two map elements: pump and payload. The +// pump value is a string naming the pump to which the message should be +// re-posted. The payload value is what will be posted to the designated pump. +// +class LLMainLoopRepeater: + public LLSingleton +{ +public: + LLMainLoopRepeater(void); + + // Start the repeater service. + void start(void); + + // Stop the repeater service. + void stop(void); + +private: + LLTempBoundListener mMainLoopConnection; + LLTempBoundListener mRepeaterConnection; + LLThreadSafeQueue mQueue; + + bool onMainLoop(LLSD const &); + bool onMessage(LLSD const & event); +}; + + +#endif -- cgit v1.2.3 From 3493da8c41a157f2cd52632c2ac69b67e4091644 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Tue, 9 Nov 2010 17:42:05 -0800 Subject: Fix for linux eol failures. --- indra/viewer_components/updater/llupdateinstaller.cpp | 2 +- indra/viewer_components/updater/llupdateinstaller.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 4d7c78d36c..1bb2101df1 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -35,4 +35,4 @@ void ll_install_update(std::string const & script, std::string const & updatePat launcher.addArgument(updatePath); launcher.launch(); launcher.orphan(); -} \ No newline at end of file +} diff --git a/indra/viewer_components/updater/llupdateinstaller.h b/indra/viewer_components/updater/llupdateinstaller.h index a6068e9025..991fe2afe1 100644 --- a/indra/viewer_components/updater/llupdateinstaller.h +++ b/indra/viewer_components/updater/llupdateinstaller.h @@ -39,4 +39,4 @@ void ll_install_update(std::string const & script, std::string const & updatePath); -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From e87b447a0ca7c6e4aeb5f87e6767db918682499c Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Tue, 9 Nov 2010 17:42:13 -0800 Subject: Fix for dll linkage errors. --- indra/llcommon/llthreadsafequeue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 46c8b91932..58cac38769 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -39,7 +39,7 @@ class LLThreadSafeQueueImplementation; // See below. // // A general queue exception. // -class LLThreadSafeQueueError: +class LL_COMMON_API LLThreadSafeQueueError: public std::runtime_error { public: @@ -54,7 +54,7 @@ public: // // An exception raised when blocking operations are interrupted. // -class LLThreadSafeQueueInterrupt: +class LL_COMMON_API LLThreadSafeQueueInterrupt: public LLThreadSafeQueueError { public: @@ -72,7 +72,7 @@ struct apr_queue_t; // From apr_queue.h // // Implementation details. // -class LLThreadSafeQueueImplementation +class LL_COMMON_API LLThreadSafeQueueImplementation { public: LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity); -- cgit v1.2.3 From deaaad5e3350a57153d7eaf8635e492ab1062c27 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 10 Nov 2010 10:03:37 -0800 Subject: Add dependency to fix viewer manifest exception in build modes other than all. --- indra/viewer_components/updater/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index c3607dff39..7657dd4517 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -82,6 +82,7 @@ if(DARWIN) ) endif() add_custom_target(copy_update_install ALL DEPENDS ${update_installer_targets}) +add_dependencies(llupdaterservice copy_update_install) \ No newline at end of file -- cgit v1.2.3 From f42bb00627f756b277496ec203d567cac31b3438 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 10 Nov 2010 14:25:03 -0800 Subject: CHOP-151 Imported patch from server-trunk to support preprocessor at unit tests. Rev. by Brad --- indra/cmake/LLAddBuildTest.cmake | 538 ++++++++++++++++++++------------------- 1 file changed, 273 insertions(+), 265 deletions(-) (limited to 'indra') diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 79c3bb7da2..29e2492551 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -1,265 +1,273 @@ -# -*- cmake -*- -include(LLTestCommand) -include(GoogleMock) - -MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) - # Given a project name and a list of sourcefiles (with optional properties on each), - # add targets to build and run the tests specified. - # ASSUMPTIONS: - # * this macro is being executed in the project file that is passed in - # * current working SOURCE dir is that project dir - # * there is a subfolder tests/ with test code corresponding to the filenames passed in - # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT) - # - # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code - # - # WARNING: do NOT modify this code without working with poppy - - # there is another branch that will conflict heavily with any changes here. -INCLUDE(GoogleMock) - - - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") - ENDIF(LL_TEST_VERBOSE) - - # Start with the header and project-wide setup before making targets - #project(UNITTEST_PROJECT_${project}) - # Setup includes, paths, etc - SET(alltest_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ) - SET(alltest_DEP_TARGETS - # needed by the test harness itself - ${APRUTIL_LIBRARIES} - ${APR_LIBRARIES} - llcommon - ) - IF(NOT "${project}" STREQUAL "llmath") - # add llmath as a dep unless the tested module *is* llmath! - LIST(APPEND alltest_DEP_TARGETS - llmath - ) - ENDIF(NOT "${project}" STREQUAL "llmath") - SET(alltest_INCLUDE_DIRS - ${LLMATH_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LIBS_OPEN_DIR}/test - ${GOOGLEMOCK_INCLUDE_DIRS} - ) - SET(alltest_LIBRARIES - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ${WINDOWS_LIBRARIES} - ) - # Headers, for convenience in targets. - SET(alltest_HEADER_FILES - ${CMAKE_SOURCE_DIR}/test/test.h - ) - - # Use the default flags - if (LINUX) - SET(CMAKE_EXE_LINKER_FLAGS "") - endif (LINUX) - - # start the source test executable definitions - SET(${project}_TEST_OUTPUT "") - FOREACH (source ${sources}) - STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) - STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") - ENDIF(LL_TEST_VERBOSE) - - # - # Per-codefile additional / external source, header, and include dir property extraction - # - # Source - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES) - IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) - SET(${name}_test_additional_SOURCE_FILES "") - ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) - SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") - ENDIF(LL_TEST_VERBOSE) - # Headers - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES) - IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) - SET(${name}_test_additional_HEADER_FILES "") - ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) - SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) - set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) - LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") - ENDIF(LL_TEST_VERBOSE) - # Include dirs - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS) - IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) - SET(${name}_test_additional_INCLUDE_DIRS "") - ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) - INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}") - ENDIF(LL_TEST_VERBOSE) - - - # Setup target - ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) - SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") - - # - # Per-codefile additional / external project dep and lib dep property extraction - # - # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19 - # Projects - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS) - IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) - SET(${name}_test_additional_PROJECTS "") - ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) - # Libraries - GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES) - IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) - SET(${name}_test_additional_LIBRARIES "") - ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") - ENDIF(LL_TEST_VERBOSE) - # Add to project - TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) - - # - # Setup test targets - # - GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION) - SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) - SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) - - # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19 - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") - ENDIF(LL_TEST_VERBOSE) - - SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") - ENDIF(LL_TEST_VERBOSE) - # Add test - ADD_CUSTOM_COMMAND( - OUTPUT ${TEST_OUTPUT} - COMMAND ${TEST_SCRIPT_CMD} - DEPENDS PROJECT_${project}_TEST_${name} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - # Why not add custom target and add POST_BUILD command? - # Slightly less uncertain behavior - # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19 - # > I did not use a post build step as I could not make it notify of a - # > failure after the first time you build and fail a test. - daveh 2009-04-20 - LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) - ENDFOREACH (source) - - # Add the test runner target per-project - # (replaces old _test_ok targets all over the place) - ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) - ADD_DEPENDENCIES(${project} ${project}_tests) -ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS) - -FUNCTION(LL_ADD_INTEGRATION_TEST - testname - additional_source_files - library_dependencies -# variable args - ) - if(TEST_DEBUG) - message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on") - endif(TEST_DEBUG) - - SET(source_files - tests/${testname}_test.cpp - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ${additional_source_files} - ) - - SET(libraries - ${library_dependencies} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ) - - # Add test executable build target - if(TEST_DEBUG) - message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})") - endif(TEST_DEBUG) - ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files}) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") - - # Add link deps to the executable - if(TEST_DEBUG) - message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") - endif(TEST_DEBUG) - TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries}) - - # Create the test running command - SET(test_command ${ARGN}) - GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION) - LIST(FIND test_command "{}" test_exe_pos) - IF(test_exe_pos LESS 0) - # The {} marker means "the full pathname of the test executable." - # test_exe_pos -1 means we didn't find it -- so append the test executable - # name to $ARGN, the variable part of the arg list. This is convenient - # shorthand for both straightforward execution of the test program (empty - # $ARGN) and for running a "wrapper" program of some kind accepting the - # pathname of the test program as the last of its args. You need specify - # {} only if the test program's pathname isn't the last argument in the - # desired command line. - LIST(APPEND test_command "${TEST_EXE}") - ELSE (test_exe_pos LESS 0) - # Found {} marker at test_exe_pos. Remove the {}... - LIST(REMOVE_AT test_command test_exe_pos) - # ...and replace it with the actual name of the test executable. - LIST(INSERT test_command test_exe_pos "${TEST_EXE}") - ENDIF (test_exe_pos LESS 0) - - SET_TEST_PATH(LD_LIBRARY_PATH) - LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) - - if(TEST_DEBUG) - message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") - endif(TEST_DEBUG) - - ADD_CUSTOM_COMMAND( - TARGET INTEGRATION_TEST_${testname} - POST_BUILD - COMMAND ${TEST_SCRIPT_CMD} - ) - - # Use CTEST? Not sure how to yet... - # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) - -ENDFUNCTION(LL_ADD_INTEGRATION_TEST) - -MACRO(SET_TEST_PATH LISTVAR) - IF(WINDOWS) - # We typically build/package only Release variants of third-party - # libraries, so append the Release staging dir in case the library being - # sought doesn't have a debug variant. - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release) - ELSEIF(DARWIN) - # We typically build/package only Release variants of third-party - # libraries, so append the Release staging dir in case the library being - # sought doesn't have a debug variant. - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib) - ELSE(WINDOWS) - # Linux uses a single staging directory anyway. - IF (STANDALONE) - set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib) - ELSE (STANDALONE) - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) - ENDIF (STANDALONE) - ENDIF(WINDOWS) -ENDMACRO(SET_TEST_PATH) +# -*- cmake -*- +include(LLTestCommand) +include(GoogleMock) + +MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) + # Given a project name and a list of sourcefiles (with optional properties on each), + # add targets to build and run the tests specified. + # ASSUMPTIONS: + # * this macro is being executed in the project file that is passed in + # * current working SOURCE dir is that project dir + # * there is a subfolder tests/ with test code corresponding to the filenames passed in + # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT) + # + # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code + # + # WARNING: do NOT modify this code without working with poppy - + # there is another branch that will conflict heavily with any changes here. +INCLUDE(GoogleMock) + + + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") + ENDIF(LL_TEST_VERBOSE) + + # Start with the header and project-wide setup before making targets + #project(UNITTEST_PROJECT_${project}) + # Setup includes, paths, etc + SET(alltest_SOURCE_FILES + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ) + SET(alltest_DEP_TARGETS + # needed by the test harness itself + ${APRUTIL_LIBRARIES} + ${APR_LIBRARIES} + llcommon + ) + IF(NOT "${project}" STREQUAL "llmath") + # add llmath as a dep unless the tested module *is* llmath! + LIST(APPEND alltest_DEP_TARGETS + llmath + ) + ENDIF(NOT "${project}" STREQUAL "llmath") + SET(alltest_INCLUDE_DIRS + ${LLMATH_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LIBS_OPEN_DIR}/test + ${GOOGLEMOCK_INCLUDE_DIRS} + ) + SET(alltest_LIBRARIES + ${GOOGLEMOCK_LIBRARIES} + ${PTHREAD_LIBRARY} + ${WINDOWS_LIBRARIES} + ) + # Headers, for convenience in targets. + SET(alltest_HEADER_FILES + ${CMAKE_SOURCE_DIR}/test/test.h + ) + + # Use the default flags + if (LINUX) + SET(CMAKE_EXE_LINKER_FLAGS "") + endif (LINUX) + + # start the source test executable definitions + SET(${project}_TEST_OUTPUT "") + FOREACH (source ${sources}) + STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) + STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") + ENDIF(LL_TEST_VERBOSE) + + # + # Per-codefile additional / external source, header, and include dir property extraction + # + # Source + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES) + IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) + SET(${name}_test_additional_SOURCE_FILES "") + ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND) + SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") + ENDIF(LL_TEST_VERBOSE) + # Headers + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES) + IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) + SET(${name}_test_additional_HEADER_FILES "") + ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND) + SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) + set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) + LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") + ENDIF(LL_TEST_VERBOSE) + # Include dirs + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS) + IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) + SET(${name}_test_additional_INCLUDE_DIRS "") + ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND) + INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}") + ENDIF(LL_TEST_VERBOSE) + + + # Setup target + ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) + SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") + + # + # Per-codefile additional / external project dep and lib dep property extraction + # + # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19 + # Projects + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS) + IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) + SET(${name}_test_additional_PROJECTS "") + ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND) + # Libraries + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES) + IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) + SET(${name}_test_additional_LIBRARIES "") + ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") + ENDIF(LL_TEST_VERBOSE) + # Add to project + TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) + # Compile-time Definitions + GET_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS) + IF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) + SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES COMPILE_FLAGS ${${name}_test_additional_CFLAGS} ) + IF(LL_TEST_VERBOSE) + MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}") + ENDIF(LL_TEST_VERBOSE) + ENDIF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND) + + # + # Setup test targets + # + GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION) + SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) + SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) + + # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19 + IF(LL_TEST_VERBOSE) + MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") + ENDIF(LL_TEST_VERBOSE) + + SET_TEST_PATH(LD_LIBRARY_PATH) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) + IF(LL_TEST_VERBOSE) + MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") + ENDIF(LL_TEST_VERBOSE) + # Add test + ADD_CUSTOM_COMMAND( + OUTPUT ${TEST_OUTPUT} + COMMAND ${TEST_SCRIPT_CMD} + DEPENDS PROJECT_${project}_TEST_${name} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + # Why not add custom target and add POST_BUILD command? + # Slightly less uncertain behavior + # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19 + # > I did not use a post build step as I could not make it notify of a + # > failure after the first time you build and fail a test. - daveh 2009-04-20 + LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) + ENDFOREACH (source) + + # Add the test runner target per-project + # (replaces old _test_ok targets all over the place) + ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) + ADD_DEPENDENCIES(${project} ${project}_tests) +ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS) + +FUNCTION(LL_ADD_INTEGRATION_TEST + testname + additional_source_files + library_dependencies +# variable args + ) + if(TEST_DEBUG) + message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on") + endif(TEST_DEBUG) + + SET(source_files + tests/${testname}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ${additional_source_files} + ) + + SET(libraries + ${library_dependencies} + ${GOOGLEMOCK_LIBRARIES} + ${PTHREAD_LIBRARY} + ) + + # Add test executable build target + if(TEST_DEBUG) + message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})") + endif(TEST_DEBUG) + ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files}) + SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") + + # Add link deps to the executable + if(TEST_DEBUG) + message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") + endif(TEST_DEBUG) + TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries}) + + # Create the test running command + SET(test_command ${ARGN}) + GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION) + LIST(FIND test_command "{}" test_exe_pos) + IF(test_exe_pos LESS 0) + # The {} marker means "the full pathname of the test executable." + # test_exe_pos -1 means we didn't find it -- so append the test executable + # name to $ARGN, the variable part of the arg list. This is convenient + # shorthand for both straightforward execution of the test program (empty + # $ARGN) and for running a "wrapper" program of some kind accepting the + # pathname of the test program as the last of its args. You need specify + # {} only if the test program's pathname isn't the last argument in the + # desired command line. + LIST(APPEND test_command "${TEST_EXE}") + ELSE (test_exe_pos LESS 0) + # Found {} marker at test_exe_pos. Remove the {}... + LIST(REMOVE_AT test_command test_exe_pos) + # ...and replace it with the actual name of the test executable. + LIST(INSERT test_command test_exe_pos "${TEST_EXE}") + ENDIF (test_exe_pos LESS 0) + + SET_TEST_PATH(LD_LIBRARY_PATH) + LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) + + if(TEST_DEBUG) + message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") + endif(TEST_DEBUG) + + ADD_CUSTOM_COMMAND( + TARGET INTEGRATION_TEST_${testname} + POST_BUILD + COMMAND ${TEST_SCRIPT_CMD} + ) + + # Use CTEST? Not sure how to yet... + # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) + +ENDFUNCTION(LL_ADD_INTEGRATION_TEST) + +MACRO(SET_TEST_PATH LISTVAR) + IF(WINDOWS) + # We typically build/package only Release variants of third-party + # libraries, so append the Release staging dir in case the library being + # sought doesn't have a debug variant. + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release) + ELSEIF(DARWIN) + # We typically build/package only Release variants of third-party + # libraries, so append the Release staging dir in case the library being + # sought doesn't have a debug variant. + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib) + ELSE(WINDOWS) + # Linux uses a single staging directory anyway. + IF (STANDALONE) + set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib) + ELSE (STANDALONE) + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) + ENDIF (STANDALONE) + ENDIF(WINDOWS) +ENDMACRO(SET_TEST_PATH) -- cgit v1.2.3 From b2e84d739b4f5c00b497e57e892fc10d78af8b76 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 10 Nov 2010 14:26:14 -0800 Subject: CHOP-151 Adding startup updater flow to drive update installation and resume. --- indra/newview/llappviewer.cpp | 2 +- indra/viewer_components/updater/CMakeLists.txt | 7 +- .../viewer_components/updater/llupdatedownloader.h | 5 + .../viewer_components/updater/llupdaterservice.cpp | 111 +++++++++++++++++++-- indra/viewer_components/updater/llupdaterservice.h | 20 +++- .../updater/tests/llupdaterservice_test.cpp | 71 ++++++++++++- 6 files changed, 195 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6bb25969a6..335998767c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2341,7 +2341,7 @@ void LLAppViewer::initUpdater() std::string service_path = gSavedSettings.getString("UpdaterServicePath"); U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); - mUpdater->setParams(protocol_version, url, service_path, channel, version); + mUpdater->initialize(protocol_version, url, service_path, channel, version); mUpdater->setCheckPeriod(check_period); if(gSavedSettings.getBOOL("UpdaterServiceActive")) { diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index 64a0f98c2a..980599dd48 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -57,10 +57,13 @@ if(LL_TESTS) llupdaterservice.cpp ) -# set_source_files_properties( +# *NOTE:Mani - I was trying to use the preprocessor seam to mock out +# llifstream (and other) llcommon classes. I didn't work +# because of the windows declspec(dllimport)attribute. +#set_source_files_properties( # llupdaterservice.cpp # PROPERTIES -# LL_TEST_ADDITIONAL_LIBRARIES "${PTH_LIBRARIES}" +# LL_TEST_ADDITIONAL_CFLAGS "-Dllifstream=llus_mock_llifstream" # ) LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h index dc8ecc378a..fb628c99eb 100644 --- a/indra/viewer_components/updater/llupdatedownloader.h +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -71,6 +71,11 @@ class LLUpdateDownloader::Client { public: // The download has completed successfully. + // data is a map containing the following items: + // url - source (remote) location + // hash - the md5 sum that should match the installer file. + // path - destination (local) location + // size - the size of the installer in bytes virtual void downloadComplete(LLSD const & data) = 0; // The download failed. diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 4292da1528..4eb317e668 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -33,12 +33,26 @@ #include #include +#include "lldir.h" +#include "llsdserialize.h" +#include "llfile.h" #if LL_WINDOWS #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #endif -boost::weak_ptr gUpdater; + +namespace +{ + boost::weak_ptr gUpdater; + + const std::string UPDATE_MARKER_FILENAME("SecondLifeUpdateReady.xml"); + std::string update_marker_path() + { + return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, + UPDATE_MARKER_FILENAME); + } +} class LLUpdaterServiceImpl : public LLUpdateChecker::Client, @@ -59,7 +73,7 @@ class LLUpdaterServiceImpl : LLUpdateDownloader mUpdateDownloader; LLTimer mTimer; - void retry(void); + LLUpdaterService::app_exit_callback_t mAppExitCallback; LOG_CLASS(LLUpdaterServiceImpl); @@ -67,7 +81,7 @@ public: LLUpdaterServiceImpl(); virtual ~LLUpdaterServiceImpl(); - void setParams(const std::string& protocol_version, + void initialize(const std::string& protocol_version, const std::string& url, const std::string& path, const std::string& channel, @@ -79,6 +93,11 @@ public: void stopChecking(); bool isChecking(); + void setAppExitCallback(LLUpdaterService::app_exit_callback_t aecb) { mAppExitCallback = aecb;} + + bool checkForInstall(); // Test if a local install is ready. + bool checkForResume(); // Test for resumeable d/l. + // LLUpdateChecker::Client: virtual void error(std::string const & message); virtual void optionalUpdate(std::string const & newVersion, @@ -90,10 +109,14 @@ public: virtual void upToDate(void); // LLUpdateDownloader::Client - void downloadComplete(LLSD const & data) { retry(); } - void downloadError(std::string const & message) { retry(); } + void downloadComplete(LLSD const & data); + void downloadError(std::string const & message); bool onMainLoop(LLSD const & event); + +private: + void retry(void); + }; const std::string LLUpdaterServiceImpl::sListenerName = "LLUpdaterServiceImpl"; @@ -112,8 +135,8 @@ LLUpdaterServiceImpl::~LLUpdaterServiceImpl() LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); } -void LLUpdaterServiceImpl::setParams(const std::string& protocol_version, - const std::string& url, +void LLUpdaterServiceImpl::initialize(const std::string& protocol_version, + const std::string& url, const std::string& path, const std::string& channel, const std::string& version) @@ -129,6 +152,12 @@ void LLUpdaterServiceImpl::setParams(const std::string& protocol_version, mPath = path; mChannel = channel; mVersion = version; + + // Check to see if an install is ready. + if(!checkForInstall()) + { + checkForResume(); + } } void LLUpdaterServiceImpl::setCheckPeriod(unsigned int seconds) @@ -146,7 +175,7 @@ void LLUpdaterServiceImpl::startChecking() "LLUpdaterService::startCheck()."); } mIsChecking = true; - + mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); } } @@ -164,6 +193,45 @@ bool LLUpdaterServiceImpl::isChecking() return mIsChecking; } +bool LLUpdaterServiceImpl::checkForInstall() +{ + bool result = false; // return true if install is found. + + llifstream update_marker(update_marker_path(), + std::ios::in | std::ios::binary); + + if(update_marker.is_open()) + { + // Found an update info - now lets see if its valid. + LLSD update_info; + LLSDSerialize::fromXMLDocument(update_info, update_marker); + + // Get the path to the installer file. + LLSD path = update_info.get("path"); + if(path.isDefined() && !path.asString().empty()) + { + // install! + } + + update_marker.close(); + LLFile::remove(update_marker_path()); + result = true; + } + return result; +} + +bool LLUpdaterServiceImpl::checkForResume() +{ + bool result = false; + llstat stat_info; + if(0 == LLFile::stat(mUpdateDownloader.downloadMarkerPath(), &stat_info)) + { + mUpdateDownloader.resume(); + result = true; + } + return false; +} + void LLUpdaterServiceImpl::error(std::string const & message) { retry(); @@ -188,6 +256,24 @@ void LLUpdaterServiceImpl::upToDate(void) retry(); } +void LLUpdaterServiceImpl::downloadComplete(LLSD const & data) +{ + // Save out the download data to the SecondLifeUpdateReady + // marker file. + llofstream update_marker(update_marker_path()); + LLSDSerialize::toPrettyXML(data, update_marker); + + // Stop checking. + stopChecking(); + + // Wait for restart...? +} + +void LLUpdaterServiceImpl::downloadError(std::string const & message) +{ + retry(); +} + void LLUpdaterServiceImpl::retry(void) { LL_INFOS("UpdaterService") << "will check for update again in " << @@ -233,13 +319,13 @@ LLUpdaterService::~LLUpdaterService() { } -void LLUpdaterService::setParams(const std::string& protocol_version, +void LLUpdaterService::initialize(const std::string& protocol_version, const std::string& url, const std::string& path, const std::string& channel, const std::string& version) { - mImpl->setParams(protocol_version, url, path, channel, version); + mImpl->initialize(protocol_version, url, path, channel, version); } void LLUpdaterService::setCheckPeriod(unsigned int seconds) @@ -261,3 +347,8 @@ bool LLUpdaterService::isChecking() { return mImpl->isChecking(); } + +void LLUpdaterService::setImplAppExitCallback(LLUpdaterService::app_exit_callback_t aecb) +{ + return mImpl->setAppExitCallback(aecb); +} diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 04adf461b6..42ec3a2cab 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -27,6 +27,7 @@ #define LL_UPDATERSERVICE_H #include +#include class LLUpdaterServiceImpl; @@ -42,11 +43,11 @@ public: LLUpdaterService(); ~LLUpdaterService(); - void setParams(const std::string& protocol_version, - const std::string& url, - const std::string& path, - const std::string& channel, - const std::string& version); + void initialize(const std::string& protocol_version, + const std::string& url, + const std::string& path, + const std::string& channel, + const std::string& version); void setCheckPeriod(unsigned int seconds); @@ -54,8 +55,17 @@ public: void stopChecking(); bool isChecking(); + typedef boost::function app_exit_callback_t; + template + void setAppExitCallback(F const &callable) + { + app_exit_callback_t aecb = callable; + setImplAppExitCallback(aecb); + } + private: boost::shared_ptr mImpl; + void setImplAppExitCallback(app_exit_callback_t aecb); }; #endif // LL_UPDATERSERVICE_H diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 7f45ae51fb..57732ad0a5 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -36,6 +36,7 @@ #include "../../../test/debug.h" #include "llevents.h" +#include "lldir.h" /***************************************************************************** * MOCK'd @@ -48,6 +49,70 @@ void LLUpdateChecker::check(std::string const & protocolVersion, std::string con LLUpdateDownloader::LLUpdateDownloader(Client & ) {} void LLUpdateDownloader::download(LLURI const & , std::string const &){} +class LLDir_Mock : public LLDir +{ + void initAppDirs(const std::string &app_name, + const std::string& app_read_only_data_dir = "") {} + U32 countFilesInDir(const std::string &dirname, const std::string &mask) + { + return 0; + } + + BOOL getNextFileInDir(const std::string &dirname, + const std::string &mask, + std::string &fname, BOOL wrap) + { + return false; + } + void getRandomFileInDir(const std::string &dirname, + const std::string &mask, + std::string &fname) {} + std::string getCurPath() { return ""; } + BOOL fileExists(const std::string &filename) const { return false; } + std::string getLLPluginLauncher() { return ""; } + std::string getLLPluginFilename(std::string base_name) { return ""; } + +} gDirUtil; +LLDir* gDirUtilp = &gDirUtil; +LLDir::LLDir() {} +LLDir::~LLDir() {} +S32 LLDir::deleteFilesInDir(const std::string &dirname, + const std::string &mask) +{ return 0; } + +void LLDir::setChatLogsDir(const std::string &path){} +void LLDir::setPerAccountChatLogsDir(const std::string &username){} +void LLDir::setLindenUserDir(const std::string &username){} +void LLDir::setSkinFolder(const std::string &skin_folder){} +bool LLDir::setCacheDir(const std::string &path){ return true; } +void LLDir::dumpCurrentDirectories() {} + +std::string LLDir::getExpandedFilename(ELLPath location, + const std::string &filename) const +{ + return ""; +} + +std::string LLUpdateDownloader::downloadMarkerPath(void) +{ + return ""; +} + +void LLUpdateDownloader::resume(void) {} + +/* +#pragma warning(disable: 4273) +llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, + ios_base::openmode _Mode, + int _Prot) : + std::basic_istream >(NULL,true) +{} + +llus_mock_llifstream::~llus_mock_llifstream() {} +bool llus_mock_llifstream::is_open() const {return true;} +void llus_mock_llifstream::close() {} +*/ + /***************************************************************************** * TUT *****************************************************************************/ @@ -96,9 +161,9 @@ namespace tut bool got_usage_error = false; try { - updater.setParams("1.0",test_url, "update" ,test_channel, test_version); + updater.initialize("1.0",test_url, "update" ,test_channel, test_version); updater.startChecking(); - updater.setParams("1.0", "other_url", "update", test_channel, test_version); + updater.initialize("1.0", "other_url", "update", test_channel, test_version); } catch(LLUpdaterService::UsageError) { @@ -112,7 +177,7 @@ namespace tut { DEBUG; LLUpdaterService updater; - updater.setParams("1.0", test_url, "update", test_channel, test_version); + updater.initialize("1.0", test_url, "update", test_channel, test_version); updater.startChecking(); ensure(updater.isChecking()); updater.stopChecking(); -- cgit v1.2.3 From 41ec2e01ddf12c7d9fc57a115b1e6047560c7e5e Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 10 Nov 2010 14:30:11 -0800 Subject: copy script to temp if needed before installing. --- .../updater/llupdateinstaller.cpp | 44 ++++++++++++++++++++-- .../viewer_components/updater/llupdateinstaller.h | 10 ++++- 2 files changed, 50 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 1bb2101df1..52744b0479 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -24,15 +24,53 @@ */ #include "linden_common.h" +#include +#include "llapr.h" #include "llprocesslauncher.h" #include "llupdateinstaller.h" +#include "lldir.h" -void ll_install_update(std::string const & script, std::string const & updatePath) +namespace { + class RelocateError {}; + + + std::string copy_to_temp(std::string const & path) + { + std::string scriptFile = gDirUtilp->getBaseFileName(path); + std::string newPath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, scriptFile); + apr_status_t status = apr_file_copy(path.c_str(), newPath.c_str(), APR_FILE_SOURCE_PERMS, gAPRPoolp); + if(status != APR_SUCCESS) throw RelocateError(); + + return newPath; + } +} + + +int ll_install_update(std::string const & script, std::string const & updatePath, LLInstallScriptMode mode) { + std::string finalPath; + switch(mode) { + case LL_COPY_INSTALL_SCRIPT_TO_TEMP: + try { + finalPath = copy_to_temp(updatePath); + } + catch (RelocateError &) { + return -1; + } + break; + case LL_RUN_INSTALL_SCRIPT_IN_PLACE: + finalPath = updatePath; + break; + default: + llassert(!"unpossible copy mode"); + } + LLProcessLauncher launcher; launcher.setExecutable(script); - launcher.addArgument(updatePath); - launcher.launch(); + launcher.addArgument(finalPath); + int result = launcher.launch(); launcher.orphan(); + + return result; } diff --git a/indra/viewer_components/updater/llupdateinstaller.h b/indra/viewer_components/updater/llupdateinstaller.h index 991fe2afe1..310bfe4348 100644 --- a/indra/viewer_components/updater/llupdateinstaller.h +++ b/indra/viewer_components/updater/llupdateinstaller.h @@ -30,13 +30,21 @@ #include +enum LLInstallScriptMode { + LL_RUN_INSTALL_SCRIPT_IN_PLACE, + LL_COPY_INSTALL_SCRIPT_TO_TEMP +}; + // // Launch the installation script. // // The updater will overwrite the current installation, so it is highly recommended // that the current application terminate once this function is called. // -void ll_install_update(std::string const & script, std::string const & updatePath); +int ll_install_update( + std::string const & script, // Script to execute. + std::string const & updatePath, // Path to update file. + LLInstallScriptMode mode=LL_COPY_INSTALL_SCRIPT_TO_TEMP); // Run in place or copy to temp? #endif -- cgit v1.2.3 From dcf4ddacd81e3864525c44f145514911116daebd Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 10 Nov 2010 15:15:25 -0800 Subject: fix race between resume and download check. --- indra/viewer_components/updater/llupdaterservice.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 4eb317e668..28d9075efa 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -137,9 +137,9 @@ LLUpdaterServiceImpl::~LLUpdaterServiceImpl() void LLUpdaterServiceImpl::initialize(const std::string& protocol_version, const std::string& url, - const std::string& path, - const std::string& channel, - const std::string& version) + const std::string& path, + const std::string& channel, + const std::string& version) { if(mIsChecking) { @@ -226,6 +226,7 @@ bool LLUpdaterServiceImpl::checkForResume() llstat stat_info; if(0 == LLFile::stat(mUpdateDownloader.downloadMarkerPath(), &stat_info)) { + mIsChecking = true; mUpdateDownloader.resume(); result = true; } -- cgit v1.2.3 From 94942671fa81ad0da3682af31b715ca49f8e3bef Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 10 Nov 2010 15:23:26 -0800 Subject: fix resume crash. --- .../viewer_components/updater/llupdatedownloader.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 208cc48c12..21555dc3ff 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -57,6 +57,7 @@ private: LLSD mDownloadData; llofstream mDownloadStream; std::string mDownloadRecordPath; + curl_slist * mHeaderList; void initializeCurlGet(std::string const & url, bool processHeader); void resumeDownloading(size_t startByte); @@ -154,7 +155,8 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client & LLThread("LLUpdateDownloader"), mCancelled(false), mClient(client), - mCurl(0) + mCurl(0), + mHeaderList(0) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case. llverify(code == CURLE_OK); // TODO: real error handling here. @@ -302,6 +304,11 @@ void LLUpdateDownloader::Implementation::run(void) LLFile::remove(mDownloadRecordPath); mClient.downloadError("curl error"); } + + if(mHeaderList) { + curl_slist_free_all(mHeaderList); + mHeaderList = 0; + } } @@ -330,17 +337,18 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u void LLUpdateDownloader::Implementation::resumeDownloading(size_t startByte) { + LL_INFOS("UpdateDownload") << "resuming download from " << mDownloadData["url"].asString() + << " at byte " << startByte << LL_ENDL; + initializeCurlGet(mDownloadData["url"].asString(), false); // The header 'Range: bytes n-' will request the bytes remaining in the // source begining with byte n and ending with the last byte. boost::format rangeHeaderFormat("Range: bytes=%u-"); rangeHeaderFormat % startByte; - curl_slist * headerList = 0; - headerList = curl_slist_append(headerList, rangeHeaderFormat.str().c_str()); - if(headerList == 0) throw DownloadError("cannot add Range header"); - throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, headerList)); - curl_slist_free_all(headerList); + mHeaderList = curl_slist_append(mHeaderList, rangeHeaderFormat.str().c_str()); + if(mHeaderList == 0) throw DownloadError("cannot add Range header"); + throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, mHeaderList)); mDownloadStream.open(mDownloadData["path"].asString(), std::ios_base::out | std::ios_base::binary | std::ios_base::app); -- cgit v1.2.3 From 41517715844c986aab169502c94f39a9f507eb55 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 10 Nov 2010 19:21:03 -0800 Subject: CHOP-151 Hooked up app exit callback, cleaned up early exit. Rev. by Brad --- indra/llui/llui.cpp | 5 +- indra/newview/llappviewer.cpp | 66 +++++++++++------ .../viewer_components/updater/llupdaterservice.cpp | 86 ++++++++++++++-------- .../updater/tests/llupdaterservice_test.cpp | 12 +-- 4 files changed, 111 insertions(+), 58 deletions(-) (limited to 'indra') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index ff9af21e54..19c42bf61a 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1620,7 +1620,10 @@ void LLUI::initClass(const settings_map_t& settings, void LLUI::cleanupClass() { - sImageProvider->cleanUp(); + if(sImageProvider) + { + sImageProvider->cleanUp(); + } } void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 10c03954bc..c06f0c18e8 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -661,6 +661,14 @@ bool LLAppViewer::init() initThreads(); writeSystemInfo(); + // Initialize updater service (now that we have an io pump) + initUpdater(); + if(isQuitting()) + { + // Early out here because updater set the quitting flag. + return true; + } + ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -979,9 +987,6 @@ bool LLAppViewer::mainLoop() LLHTTPClient::setPump(*gServicePump); LLCurl::setCAFile(gDirUtilp->getCAFile()); - // Initialize updater service (now that we have an io pump) - initUpdater(); - // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated. LLVoiceChannel::initClass(); @@ -1364,11 +1369,14 @@ bool LLAppViewer::cleanup() llinfos << "Cleaning Up" << llendflush; // Must clean up texture references before viewer window is destroyed. - LLHUDManager::getInstance()->updateEffects(); - LLHUDObject::updateAll(); - LLHUDManager::getInstance()->cleanupEffects(); - LLHUDObject::cleanupHUDObjects(); - llinfos << "HUD Objects cleaned up" << llendflush; + if(LLHUDManager::instanceExists()) + { + LLHUDManager::getInstance()->updateEffects(); + LLHUDObject::updateAll(); + LLHUDManager::getInstance()->cleanupEffects(); + LLHUDObject::cleanupHUDObjects(); + llinfos << "HUD Objects cleaned up" << llendflush; + } LLKeyframeDataCache::clear(); @@ -1380,8 +1388,10 @@ bool LLAppViewer::cleanup() // Note: this is where gWorldMap used to be deleted. // Note: this is where gHUDManager used to be deleted. - LLHUDManager::getInstance()->shutdownClass(); - + if(LLHUDManager::instanceExists()) + { + LLHUDManager::getInstance()->shutdownClass(); + } delete gAssetStorage; gAssetStorage = NULL; @@ -1683,7 +1693,10 @@ bool LLAppViewer::cleanup() #ifndef LL_RELEASE_FOR_DOWNLOAD llinfos << "Auditing VFS" << llendl; - gVFS->audit(); + if(gVFS) + { + gVFS->audit(); + } #endif llinfos << "Misc Cleanup" << llendflush; @@ -2383,8 +2396,13 @@ void LLAppViewer::initUpdater() std::string service_path = gSavedSettings.getString("UpdaterServicePath"); U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); - mUpdater->initialize(protocol_version, url, service_path, channel, version); - mUpdater->setCheckPeriod(check_period); + mUpdater->setAppExitCallback(boost::bind(&LLAppViewer::forceQuit, this)); + mUpdater->initialize(protocol_version, + url, + service_path, + channel, + version); + mUpdater->setCheckPeriod(check_period); if(gSavedSettings.getBOOL("UpdaterServiceActive")) { mUpdater->startChecking(); @@ -2550,15 +2568,18 @@ void LLAppViewer::cleanupSavedSettings() // save window position if not maximized // as we don't track it in callbacks - BOOL maximized = gViewerWindow->mWindow->getMaximized(); - if (!maximized) + if(NULL != gViewerWindow) { - LLCoordScreen window_pos; - - if (gViewerWindow->mWindow->getPosition(&window_pos)) + BOOL maximized = gViewerWindow->mWindow->getMaximized(); + if (!maximized) { - gSavedSettings.setS32("WindowX", window_pos.mX); - gSavedSettings.setS32("WindowY", window_pos.mY); + LLCoordScreen window_pos; + + if (gViewerWindow->mWindow->getPosition(&window_pos)) + { + gSavedSettings.setS32("WindowX", window_pos.mX); + gSavedSettings.setS32("WindowY", window_pos.mY); + } } } @@ -4297,7 +4318,10 @@ void LLAppViewer::disconnectViewer() // This is where we used to call gObjectList.destroy() and then delete gWorldp. // Now we just ask the LLWorld singleton to cleanly shut down. - LLWorld::getInstance()->destroyClass(); + if(LLWorld::instanceExists()) + { + LLWorld::getInstance()->destroyClass(); + } // call all self-registered classes LLDestroyClassList::instance().fireCallbacks(); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 28d9075efa..466b27f6fe 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -68,6 +68,7 @@ class LLUpdaterServiceImpl : unsigned int mCheckPeriod; bool mIsChecking; + bool mIsDownloading; LLUpdateChecker mUpdateChecker; LLUpdateDownloader mUpdateDownloader; @@ -115,14 +116,14 @@ public: bool onMainLoop(LLSD const & event); private: - void retry(void); - + void restartTimer(unsigned int seconds); }; const std::string LLUpdaterServiceImpl::sListenerName = "LLUpdaterServiceImpl"; LLUpdaterServiceImpl::LLUpdaterServiceImpl() : mIsChecking(false), + mIsDownloading(false), mCheckPeriod(0), mUpdateChecker(*this), mUpdateDownloader(*this) @@ -141,10 +142,10 @@ void LLUpdaterServiceImpl::initialize(const std::string& protocol_version, const std::string& channel, const std::string& version) { - if(mIsChecking) + if(mIsChecking || mIsDownloading) { - throw LLUpdaterService::UsageError("Call LLUpdaterService::stopCheck()" - " before setting params."); + throw LLUpdaterService::UsageError("LLUpdaterService::initialize call " + "while updater is running."); } mProtocolVersion = protocol_version; @@ -167,16 +168,20 @@ void LLUpdaterServiceImpl::setCheckPeriod(unsigned int seconds) void LLUpdaterServiceImpl::startChecking() { - if(!mIsChecking) + if(mUrl.empty() || mChannel.empty() || mVersion.empty()) { - if(mUrl.empty() || mChannel.empty() || mVersion.empty()) - { - throw LLUpdaterService::UsageError("Set params before call to " - "LLUpdaterService::startCheck()."); - } - mIsChecking = true; - - mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); + throw LLUpdaterService::UsageError("Set params before call to " + "LLUpdaterService::startCheck()."); + } + + mIsChecking = true; + + if(!mIsDownloading) + { + // Checking can only occur during the mainloop. + // reset the timer to 0 so that the next mainloop event + // triggers a check; + restartTimer(0); } } @@ -185,6 +190,7 @@ void LLUpdaterServiceImpl::stopChecking() if(mIsChecking) { mIsChecking = false; + mTimer.stop(); } } @@ -205,16 +211,21 @@ bool LLUpdaterServiceImpl::checkForInstall() // Found an update info - now lets see if its valid. LLSD update_info; LLSDSerialize::fromXMLDocument(update_info, update_marker); + update_marker.close(); + LLFile::remove(update_marker_path()); // Get the path to the installer file. LLSD path = update_info.get("path"); if(path.isDefined() && !path.asString().empty()) { // install! + + if(mAppExitCallback) + { + mAppExitCallback(); + } } - update_marker.close(); - LLFile::remove(update_marker_path()); result = true; } return result; @@ -226,7 +237,7 @@ bool LLUpdaterServiceImpl::checkForResume() llstat stat_info; if(0 == LLFile::stat(mUpdateDownloader.downloadMarkerPath(), &stat_info)) { - mIsChecking = true; + mIsDownloading = true; mUpdateDownloader.resume(); result = true; } @@ -235,13 +246,18 @@ bool LLUpdaterServiceImpl::checkForResume() void LLUpdaterServiceImpl::error(std::string const & message) { - retry(); + if(mIsChecking) + { + restartTimer(mCheckPeriod); + } } void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion, LLURI const & uri, std::string const & hash) { + mTimer.stop(); + mIsDownloading = true; mUpdateDownloader.download(uri, hash); } @@ -249,50 +265,60 @@ void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion, LLURI const & uri, std::string const & hash) { + mTimer.stop(); + mIsDownloading = true; mUpdateDownloader.download(uri, hash); } void LLUpdaterServiceImpl::upToDate(void) { - retry(); + if(mIsChecking) + { + restartTimer(mCheckPeriod); + } } void LLUpdaterServiceImpl::downloadComplete(LLSD const & data) { + mIsDownloading = false; + // Save out the download data to the SecondLifeUpdateReady - // marker file. + // marker file. llofstream update_marker(update_marker_path()); LLSDSerialize::toPrettyXML(data, update_marker); - - // Stop checking. - stopChecking(); - - // Wait for restart...? } void LLUpdaterServiceImpl::downloadError(std::string const & message) { - retry(); + mIsDownloading = false; + + // Restart the + if(mIsChecking) + { + restartTimer(mCheckPeriod); + } } -void LLUpdaterServiceImpl::retry(void) +void LLUpdaterServiceImpl::restartTimer(unsigned int seconds) { LL_INFOS("UpdaterService") << "will check for update again in " << mCheckPeriod << " seconds" << LL_ENDL; mTimer.start(); - mTimer.setTimerExpirySec(mCheckPeriod); + mTimer.setTimerExpirySec(seconds); LLEventPumps::instance().obtain("mainloop").listen( sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1)); } bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) { - if(mTimer.hasExpired()) + if(mTimer.getStarted() && mTimer.hasExpired()) { mTimer.stop(); LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); - } else { + } + else + { // Keep on waiting... } diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 57732ad0a5..aa30fa717d 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -102,12 +102,12 @@ void LLUpdateDownloader::resume(void) {} /* #pragma warning(disable: 4273) -llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, - ios_base::openmode _Mode, - int _Prot) : - std::basic_istream >(NULL,true) -{} - +llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, + ios_base::openmode _Mode, + int _Prot) : + std::basic_istream >(NULL,true) +{} + llus_mock_llifstream::~llus_mock_llifstream() {} bool llus_mock_llifstream::is_open() const {return true;} void llus_mock_llifstream::close() {} -- cgit v1.2.3 From 6e15957d909787ba612004903f04335a593b5348 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 09:40:30 -0800 Subject: run install script on successful download --- indra/newview/viewer_manifest.py | 10 ++++--- .../updater/llupdateinstaller.cpp | 13 +++++---- .../viewer_components/updater/llupdaterservice.cpp | 33 ++++++++++++++++++++-- .../updater/tests/llupdaterservice_test.cpp | 6 ++++ 4 files changed, 50 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f95697adb6..0073641ed4 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -571,14 +571,16 @@ class DarwinManifest(ViewerManifest): # copy additional libs in /Contents/MacOS/ self.path("../../libraries/universal-darwin/lib_release/libndofdev.dylib", dst="MacOS/libndofdev.dylib") + + + if self.prefix(src="../viewer_components/updater", dst="MacOS"): + self.path("update_install") + self.end_prefix() + # most everything goes in the Resources directory if self.prefix(src="", dst="Resources"): super(DarwinManifest, self).construct() - - if self.prefix(src="../viewer_components/updater", dst=""): - self.path("update_install") - self.end_prefix() if self.prefix("cursors_mac"): self.path("*.tif") diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 52744b0479..10d5edc6a0 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -49,26 +49,29 @@ namespace { int ll_install_update(std::string const & script, std::string const & updatePath, LLInstallScriptMode mode) { - std::string finalPath; + std::string actualScriptPath; switch(mode) { case LL_COPY_INSTALL_SCRIPT_TO_TEMP: try { - finalPath = copy_to_temp(updatePath); + actualScriptPath = copy_to_temp(script); } catch (RelocateError &) { return -1; } break; case LL_RUN_INSTALL_SCRIPT_IN_PLACE: - finalPath = updatePath; + actualScriptPath = script; break; default: llassert(!"unpossible copy mode"); } + llinfos << "UpdateInstaller: installing " << updatePath << " using " << + actualScriptPath << LL_ENDL; + LLProcessLauncher launcher; - launcher.setExecutable(script); - launcher.addArgument(finalPath); + launcher.setExecutable(actualScriptPath); + launcher.addArgument(updatePath); int result = launcher.launch(); launcher.orphan(); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 466b27f6fe..43551d6cea 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -30,6 +30,7 @@ #include "lltimer.h" #include "llupdaterservice.h" #include "llupdatechecker.h" +#include "llupdateinstaller.h" #include #include @@ -52,6 +53,26 @@ namespace return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, UPDATE_MARKER_FILENAME); } + + std::string install_script_path(void) + { +#ifdef LL_WINDOWS + std::string scriptFile = "update_install.bat"; +#else + std::string scriptFile = "update_install"; +#endif + return gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, scriptFile); + } + + LLInstallScriptMode install_script_mode(void) + { +#ifdef LL_WINDOWS + return LL_COPY_INSTALL_SCRIPT_TO_TEMP; +#else + return LL_RUN_INSTALL_SCRIPT_IN_PLACE; +#endif + }; + } class LLUpdaterServiceImpl : @@ -218,11 +239,17 @@ bool LLUpdaterServiceImpl::checkForInstall() LLSD path = update_info.get("path"); if(path.isDefined() && !path.asString().empty()) { - // install! - - if(mAppExitCallback) + int result = ll_install_update(install_script_path(), + update_info["path"].asString(), + install_script_mode()); + + if((result == 0) && mAppExitCallback) { mAppExitCallback(); + } else if(result != 0) { + llwarns << "failed to run update install script" << LL_ENDL; + } else { + ; // No op. } } diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index aa30fa717d..9b56a04ff6 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -30,6 +30,7 @@ #include "../llupdaterservice.h" #include "../llupdatechecker.h" #include "../llupdatedownloader.h" +#include "../llupdateinstaller.h" #include "../../../test/lltut.h" //#define DEBUG_ON @@ -100,6 +101,11 @@ std::string LLUpdateDownloader::downloadMarkerPath(void) void LLUpdateDownloader::resume(void) {} +int ll_install_update(std::string const &, std::string const &, LLInstallScriptMode) +{ + return 0; +} + /* #pragma warning(disable: 4273) llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, -- cgit v1.2.3 From 4e22d63352dd65085cfbba9c22070271ecdd4bcf Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 11:05:46 -0800 Subject: Add very basic windows install script. --- indra/newview/viewer_manifest.py | 4 ++++ indra/viewer_components/updater/CMakeLists.txt | 7 +++++++ indra/viewer_components/updater/scripts/windows/update_install.bat | 1 + 3 files changed, 12 insertions(+) create mode 100644 indra/viewer_components/updater/scripts/windows/update_install.bat (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 0073641ed4..55d64fd3a6 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -251,6 +251,10 @@ class WindowsManifest(ViewerManifest): if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']), dst=""): + if self.prefix(src="../../viewer_components/updater", dst=""): + self.path("update_install.bat") + self.end_prefix() + self.enable_crt_manifest_check() # Get kdu dll, continue if missing. diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index c5ccfbf66a..469c0cf05e 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -89,6 +89,13 @@ if(DARWIN) update_installer_targets "update_install" ) +elseif(WINDOWS) + copy_if_different( + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/windows" + "${CMAKE_CURRENT_BINARY_DIR}" + update_installer_targets + "update_install.bat" + ) endif() add_custom_target(copy_update_install ALL DEPENDS ${update_installer_targets}) add_dependencies(llupdaterservice copy_update_install) diff --git a/indra/viewer_components/updater/scripts/windows/update_install.bat b/indra/viewer_components/updater/scripts/windows/update_install.bat new file mode 100644 index 0000000000..def33c1346 --- /dev/null +++ b/indra/viewer_components/updater/scripts/windows/update_install.bat @@ -0,0 +1 @@ +start /WAIT %1 \ No newline at end of file -- cgit v1.2.3 From 7a7f89db6d9c5e6b2c6c89ea39c0302907a0442b Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 11:46:24 -0800 Subject: fix termination issues with thread safe queue in main loop repeater service. --- indra/llcommon/llthreadsafequeue.cpp | 6 +++--- indra/newview/llappviewer.cpp | 4 +++- indra/newview/llmainlooprepeater.cpp | 12 +++++++++--- indra/newview/llmainlooprepeater.h | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp index a7141605ef..8a73e632a9 100644 --- a/indra/llcommon/llthreadsafequeue.cpp +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -53,13 +53,13 @@ LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * po LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() { - if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); if(mQueue != 0) { if(apr_queue_size(mQueue) != 0) llwarns << - "terminating queue which still contains elements;" << - "memory will be leaked" << LL_ENDL; + "terminating queue which still contains " << apr_queue_size(mQueue) << + " elements;" << "memory will be leaked" << LL_ENDL; apr_queue_term(mQueue); } + if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c06f0c18e8..76d518b610 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -812,7 +812,7 @@ bool LLAppViewer::init() } // Initialize the repeater service. - LLMainLoopRepeater::getInstance()->start(); + LLMainLoopRepeater::instance().start(); // // Initialize the window @@ -1737,6 +1737,8 @@ bool LLAppViewer::cleanup() llinfos << "File launched." << llendflush; } + LLMainLoopRepeater::instance().stop(); + ll_close_fail_log(); llinfos << "Goodbye!" << llendflush; diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp index c2eba97641..ddc925a73b 100644 --- a/indra/newview/llmainlooprepeater.cpp +++ b/indra/newview/llmainlooprepeater.cpp @@ -36,7 +36,7 @@ LLMainLoopRepeater::LLMainLoopRepeater(void): - mQueue(gAPRPoolp, 1024) + mQueue(0) { ; // No op. } @@ -44,6 +44,9 @@ LLMainLoopRepeater::LLMainLoopRepeater(void): void LLMainLoopRepeater::start(void) { + if(mQueue != 0) return; + + mQueue = new LLThreadSafeQueue(gAPRPoolp, 1024); mMainLoopConnection = LLEventPumps::instance(). obtain("mainloop").listen("stupid name here", boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1)); mRepeaterConnection = LLEventPumps::instance(). @@ -55,13 +58,16 @@ void LLMainLoopRepeater::stop(void) { mMainLoopConnection.release(); mRepeaterConnection.release(); + + delete mQueue; + mQueue = 0; } bool LLMainLoopRepeater::onMainLoop(LLSD const &) { LLSD message; - while(mQueue.tryPopBack(message)) { + while(mQueue->tryPopBack(message)) { std::string pump = message["pump"].asString(); if(pump.length() == 0 ) continue; // No pump. LLEventPumps::instance().obtain(pump).post(message["payload"]); @@ -73,7 +79,7 @@ bool LLMainLoopRepeater::onMainLoop(LLSD const &) bool LLMainLoopRepeater::onMessage(LLSD const & event) { try { - mQueue.pushFront(event); + mQueue->pushFront(event); } catch(LLThreadSafeQueueError & e) { llwarns << "could not repeat message (" << e.what() << ")" << event.asString() << LL_ENDL; diff --git a/indra/newview/llmainlooprepeater.h b/indra/newview/llmainlooprepeater.h index 96b83b4916..f84c0ca94c 100644 --- a/indra/newview/llmainlooprepeater.h +++ b/indra/newview/llmainlooprepeater.h @@ -55,7 +55,7 @@ public: private: LLTempBoundListener mMainLoopConnection; LLTempBoundListener mRepeaterConnection; - LLThreadSafeQueue mQueue; + LLThreadSafeQueue * mQueue; bool onMainLoop(LLSD const &); bool onMessage(LLSD const & event); -- cgit v1.2.3 From 830afa5b27092668517b2f5670e892143de3cf66 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 16:45:38 -0800 Subject: hacking mac updater to install from local dmg --- indra/llcommon/llthread.cpp | 2 + indra/mac_updater/mac_updater.cpp | 48 ++++++++++++++++++++-- .../updater/scripts/darwin/update_install | 5 +-- 3 files changed, 47 insertions(+), 8 deletions(-) mode change 100644 => 100755 indra/viewer_components/updater/scripts/darwin/update_install (limited to 'indra') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 2408be74b9..148aaf8aed 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -147,6 +147,8 @@ void LLThread::shutdown() { // This thread just wouldn't stop, even though we gave it time llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl; + // Put a stake in its heart. + apr_thread_exit(mAPRThreadp, -1); return; } mAPRThreadp = NULL; diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 23980ffac2..5f6ea4d33b 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -26,6 +26,9 @@ #include "linden_common.h" +#include + +#include #include #include #include @@ -62,6 +65,7 @@ Boolean gCancelled = false; const char *gUpdateURL; const char *gProductName; const char *gBundleID; +const char *gDmgFile; void *updatethreadproc(void*); @@ -334,6 +338,10 @@ int parse_args(int argc, char **argv) { gBundleID = argv[j]; } + else if ((!strcmp(argv[j], "-dmg")) && (++j < argc)) + { + gDmgFile = argv[j]; + } } return 0; @@ -361,10 +369,11 @@ int main(int argc, char **argv) gUpdateURL = NULL; gProductName = NULL; gBundleID = NULL; + gDmgFile = NULL; parse_args(argc, argv); - if (!gUpdateURL) + if ((gUpdateURL == NULL) && (gDmgFile == NULL)) { - llinfos << "Usage: mac_updater -url [-name ] [-program ]" << llendl; + llinfos << "Usage: mac_updater -url | -dmg [-name ] [-program ]" << llendl; exit(1); } else @@ -700,10 +709,14 @@ static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) // Looks promising. Check to see if it has the right bundle identifier. if(isFSRefViewerBundle(&ref)) { + llinfos << name << " is the one" << llendl; // This is the one. Return it. *app = ref; found = true; + } else { + llinfos << name << " is not the bundle we are looking for; move along" << llendl; } + } } } @@ -921,6 +934,22 @@ void *updatethreadproc(void*) #endif // 0 *HACK for DEV-11935 + // Skip downloading the file if the dmg was passed on the command line. + std::string dmgName; + if(gDmgFile != NULL) { + dmgName = basename((char *)gDmgFile); + char * dmgDir = dirname((char *)gDmgFile); + strncpy(tempDir, dmgDir, sizeof(tempDir)); + err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); + if(err != noErr) throw 0; + chdir(tempDir); + goto begin_install; + } else { + // Continue on to download file. + dmgName = "SecondLife.dmg"; + } + + strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); if(mkdtemp(temp) == NULL) { @@ -979,14 +1008,17 @@ void *updatethreadproc(void*) fclose(downloadFile); downloadFile = NULL; } - + + begin_install: sendProgress(0, 0, CFSTR("Mounting image...")); LLFile::mkdir("mnt", 0700); // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, // but if our cleanup fails, this makes it much harder for the user to unmount the image. std::string mountOutput; - FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */ + boost::format cmdFormat("hdiutil attach %s -mountpoint mnt"); + cmdFormat % dmgName; + FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */ if(mounter == NULL) { @@ -1077,7 +1109,11 @@ void *updatethreadproc(void*) // Move aside old version (into work directory) err = FSMoveObject(&targetRef, &tempDirRef, &asideRef); if(err != noErr) + { + llwarns << "failed to move aside old version (error code " << + err << ")" << llendl; throw 0; + } // Grab the path for later use. err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside)); @@ -1175,6 +1211,10 @@ void *updatethreadproc(void*) llinfos << "Moving work directory to the trash." << llendl; err = FSMoveObject(&tempDirRef, &trashFolderRef, NULL); + if(err != noErr) { + llwarns << "failed to move files to trash, (error code " << + err << ")" << llendl; + } // snprintf(temp, sizeof(temp), "rm -rf '%s'", tempDir); // printf("%s\n", temp); diff --git a/indra/viewer_components/updater/scripts/darwin/update_install b/indra/viewer_components/updater/scripts/darwin/update_install old mode 100644 new mode 100755 index 24d344ca52..c061d2818f --- a/indra/viewer_components/updater/scripts/darwin/update_install +++ b/indra/viewer_components/updater/scripts/darwin/update_install @@ -1,6 +1,3 @@ #! /bin/bash -hdiutil attach -nobrowse $1 -cp -R /Volumes/Second\ Life\ Installer/Second\ Life\ Viewer\ 2.app /Applications -hdiutil detach /Volumes/Second\ Life\ Installer -open /Applications/Second\ Life\ Viewer\ 2.app \ No newline at end of file +open ../Resources/mac-updater.app --args -dmg "$1" -name "Second Life Viewer 2" -- cgit v1.2.3 From bfa393f933ccf11105daf5258f373efc764b736f Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Thu, 11 Nov 2010 19:05:05 -0800 Subject: CHOP-178 Add a non-interactive moe to the windows installer. Rev by Brad --- .../installers/windows/installer_template.nsi | 55 +++++++++++++++------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index d5712f80cf..4e8ed807ee 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -85,6 +85,8 @@ AutoCloseWindow true ; after all files install, close window InstallDir "$PROGRAMFILES\${INSTNAME}" InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "" DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup) +Page directory dirPre +Page instfiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Variables @@ -95,6 +97,8 @@ Var INSTFLAGS Var INSTSHORTCUT Var COMMANDLINE ; command line passed to this installer, set in .onInit Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer +Var SKIP_DIALOGS ; set from command line in .onInit. autoinstall + ; GUI and the defaults. ;;; Function definitions should go before file includes, because calls to ;;; DLLs like LangDLL trigger an implicit file include, so if that call is at @@ -110,6 +114,9 @@ Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function .onInstSuccess Push $R0 # Option value, unused + + StrCmp $SKIP_DIALOGS "true" label_launch + ${GetOptions} $COMMANDLINE "/AUTOSTART" $R0 # If parameter was there (no error) just launch # Otherwise ask @@ -128,6 +135,13 @@ label_no_launch: Pop $R0 FunctionEnd +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Pre-directory page callback +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function dirPre + StrCmp $SKIP_DIALOGS "true" 0 +2 + Abort +FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Make sure we're not on Windows 98 / ME @@ -145,7 +159,8 @@ Function CheckWindowsVersion StrCmp $R0 "NT" win_ver_bad Return win_ver_bad: - MessageBox MB_YESNO $(CheckWindowsVersionMB) IDNO win_ver_abort + StrCmp $SKIP_DIALOGS "true" +2 ; If skip_dialogs is set just install + MessageBox MB_YESNO $(CheckWindowsVersionMB) IDNO win_ver_abort Return win_ver_abort: Quit @@ -184,13 +199,13 @@ FunctionEnd ; If it has, allow user to bail out of install process. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function CheckIfAlreadyCurrent - Push $0 - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version" - StrCmp $0 ${VERSION_LONG} 0 DONE - MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK DONE + Push $0 + ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version" + StrCmp $0 ${VERSION_LONG} 0 continue_install + StrCmp $SKIP_DIALOGS "true" continue_install + MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK continue_install Quit - - DONE: +continue_install: Pop $0 Return FunctionEnd @@ -203,7 +218,9 @@ Function CloseSecondLife Push $0 FindWindow $0 "Second Life" "" IntCmp $0 0 DONE - MessageBox MB_OKCANCEL $(CloseSecondLifeInstMB) IDOK CLOSE IDCANCEL CANCEL_INSTALL + + StrCmp $SKIP_DIALOGS "true" CLOSE + MessageBox MB_OKCANCEL $(CloseSecondLifeInstMB) IDOK CLOSE IDCANCEL CANCEL_INSTALL CANCEL_INSTALL: Quit @@ -659,23 +676,29 @@ FunctionEnd Function .onInit Push $0 ${GetParameters} $COMMANDLINE ; get our command line + + ${GetOptions} $COMMANDLINE "/SKIP_DIALOGS" $0 + IfErrors +2 0 ; If error jump past setting SKIP_DIALOGS + StrCpy $SKIP_DIALOGS "true" + ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English ; If no language (error), then proceed - IfErrors lbl_check_silent + IfErrors lbl_configure_default_lang ; No error means we got a language, so use it StrCpy $LANGUAGE $0 Goto lbl_return -lbl_check_silent: - ; For silent installs, no language prompt, use default - IfSilent lbl_return - - ; If we currently have a version of SL installed, default to the language of that install +lbl_configure_default_lang: + ; If we currently have a version of SL installed, default to the language of that install ; Otherwise don't change $LANGUAGE and it will default to the OS UI language. - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" - IfErrors lbl_build_menu + ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" + IfErrors +2 0 ; If error skip the copy instruction StrCpy $LANGUAGE $0 + ; For silent installs, no language prompt, use default + IfSilent lbl_return + StrCmp $SKIP_DIALOGS "true" lbl_return + lbl_build_menu: Push "" # Use separate file so labels can be UTF-16 but we can still merge changes -- cgit v1.2.3 From 1368a94f014884588b343802eef5fd2c7888390a Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 12 Nov 2010 12:23:30 -0800 Subject: do not resume or install if current viewer version doesn't match the recorded version which started the process. --- .../updater/llupdatedownloader.cpp | 2 + .../viewer_components/updater/llupdaterservice.cpp | 71 +++++++++++++++++++--- indra/viewer_components/updater/llupdaterservice.h | 3 + 3 files changed, 67 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 21555dc3ff..ab441aa747 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -35,6 +35,7 @@ #include "llsdserialize.h" #include "llthread.h" #include "llupdatedownloader.h" +#include "llupdaterservice.h" class LLUpdateDownloader::Implementation: @@ -360,6 +361,7 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std { mDownloadData["url"] = uri.asString(); mDownloadData["hash"] = hash; + mDownloadData["current_version"] = ll_get_version(); LLSD path = uri.pathArray(); if(path.size() == 0) throw DownloadError("no file path"); std::string fileName = path[path.size() - 1].asString(); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 43551d6cea..6cc872f2ca 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -31,6 +31,7 @@ #include "llupdaterservice.h" #include "llupdatechecker.h" #include "llupdateinstaller.h" +#include "llversionviewer.h" #include #include @@ -237,7 +238,23 @@ bool LLUpdaterServiceImpl::checkForInstall() // Get the path to the installer file. LLSD path = update_info.get("path"); - if(path.isDefined() && !path.asString().empty()) + if(update_info["current_version"].asString() != ll_get_version()) + { + // This viewer is not the same version as the one that downloaded + // the update. Do not install this update. + if(!path.asString().empty()) + { + llinfos << "ignoring update dowloaded by different client version" << llendl; + LLFile::remove(path.asString()); + } + else + { + ; // Nothing to clean up. + } + + result = false; + } + else if(path.isDefined() && !path.asString().empty()) { int result = ll_install_update(install_script_path(), update_info["path"].asString(), @@ -251,9 +268,9 @@ bool LLUpdaterServiceImpl::checkForInstall() } else { ; // No op. } + + result = true; } - - result = true; } return result; } @@ -261,14 +278,33 @@ bool LLUpdaterServiceImpl::checkForInstall() bool LLUpdaterServiceImpl::checkForResume() { bool result = false; - llstat stat_info; - if(0 == LLFile::stat(mUpdateDownloader.downloadMarkerPath(), &stat_info)) + std::string download_marker_path = mUpdateDownloader.downloadMarkerPath(); + if(LLFile::isfile(download_marker_path)) { - mIsDownloading = true; - mUpdateDownloader.resume(); - result = true; + llifstream download_marker_stream(download_marker_path, + std::ios::in | std::ios::binary); + if(download_marker_stream.is_open()) + { + LLSD download_info; + LLSDSerialize::fromXMLDocument(download_info, download_marker_stream); + download_marker_stream.close(); + if(download_info["current_version"].asString() == ll_get_version()) + { + mIsDownloading = true; + mUpdateDownloader.resume(); + result = true; + } + else + { + // The viewer that started this download is not the same as this viewer; ignore. + llinfos << "ignoring partial download from different viewer version" << llendl; + std::string path = download_info["path"].asString(); + if(!path.empty()) LLFile::remove(path); + LLFile::remove(download_marker_path); + } + } } - return false; + return result; } void LLUpdaterServiceImpl::error(std::string const & message) @@ -406,3 +442,20 @@ void LLUpdaterService::setImplAppExitCallback(LLUpdaterService::app_exit_callbac { return mImpl->setAppExitCallback(aecb); } + + +std::string const & ll_get_version(void) { + static std::string version(""); + + if (version.empty()) { + std::ostringstream stream; + stream << LL_VERSION_MAJOR << "." + << LL_VERSION_MINOR << "." + << LL_VERSION_PATCH << "." + << LL_VERSION_BUILD; + version = stream.str(); + } + + return version; +} + diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 42ec3a2cab..ec20dc6e05 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -68,4 +68,7 @@ private: void setImplAppExitCallback(app_exit_callback_t aecb); }; +// Returns the full version as a string. +std::string const & ll_get_version(void); + #endif // LL_UPDATERSERVICE_H -- cgit v1.2.3 From ec7d36f6cfbed53a30d918415dfa3e429a645ce1 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 15 Nov 2010 09:38:20 -0800 Subject: added mechanism for install scripts to indicate a failed install and for update service to note the failure; modified mac installer to write marker on error. --- indra/mac_updater/mac_updater.cpp | 35 ++++++++++++++++++---- .../updater/llupdateinstaller.cpp | 11 +++++++ .../viewer_components/updater/llupdateinstaller.h | 7 +++++ .../viewer_components/updater/llupdaterservice.cpp | 14 ++++++++- .../updater/scripts/darwin/update_install | 8 ++++- .../updater/tests/llupdaterservice_test.cpp | 6 ++++ 6 files changed, 74 insertions(+), 7 deletions(-) mode change 100644 => 100755 indra/viewer_components/updater/scripts/darwin/update_install (limited to 'indra') diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 5f6ea4d33b..5d19e8a889 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -66,6 +66,7 @@ const char *gUpdateURL; const char *gProductName; const char *gBundleID; const char *gDmgFile; +const char *gMarkerPath; void *updatethreadproc(void*); @@ -342,6 +343,10 @@ int parse_args(int argc, char **argv) { gDmgFile = argv[j]; } + else if ((!strcmp(argv[j], "-marker")) && (++j < argc)) + { + gMarkerPath = argv[j];; + } } return 0; @@ -370,6 +375,7 @@ int main(int argc, char **argv) gProductName = NULL; gBundleID = NULL; gDmgFile = NULL; + gMarkerPath = NULL; parse_args(argc, argv); if ((gUpdateURL == NULL) && (gDmgFile == NULL)) { @@ -497,11 +503,18 @@ int main(int argc, char **argv) NULL, &retval_mac); } - + + if(gMarkerPath != 0) + { + // Create a install fail marker that can be used by the viewer to + // detect install problems. + std::ofstream stream(gMarkerPath); + if(stream) stream << -1; + } + exit(-1); + } else { + exit(0); } - - // Don't dispose of things, just exit. This keeps the update thread from potentially getting hosed. - exit(0); if(gWindow != NULL) { @@ -713,6 +726,7 @@ static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) // This is the one. Return it. *app = ref; found = true; + break; } else { llinfos << name << " is not the bundle we are looking for; move along" << llendl; } @@ -721,9 +735,13 @@ static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) } } } - while(!err && !found); + while(!err); + + llinfos << "closing the iterator" << llendl; FSCloseIterator(iterator); + + llinfos << "closed" << llendl; } if(!err && !found) @@ -1084,12 +1102,19 @@ void *updatethreadproc(void*) throw 0; } + sendProgress(0, 0, CFSTR("Searching for the app bundle...")); err = findAppBundleOnDiskImage(&mountRef, &sourceRef); if(err != noErr) { llinfos << "Couldn't find application bundle on mounted disk image." << llendl; throw 0; } + else + { + llinfos << "found the bundle." << llendl; + } + + sendProgress(0, 0, CFSTR("Preparing to copy files...")); FSRef asideRef; char aside[MAX_PATH]; /* Flawfinder: ignore */ diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 10d5edc6a0..6e69bcf28b 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -72,8 +72,19 @@ int ll_install_update(std::string const & script, std::string const & updatePath LLProcessLauncher launcher; launcher.setExecutable(actualScriptPath); launcher.addArgument(updatePath); + launcher.addArgument(ll_install_failed_marker_path().c_str()); int result = launcher.launch(); launcher.orphan(); return result; } + + +std::string const & ll_install_failed_marker_path(void) +{ + static std::string path; + if(path.empty()) { + path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLifeInstallFailed.marker"); + } + return path; +} diff --git a/indra/viewer_components/updater/llupdateinstaller.h b/indra/viewer_components/updater/llupdateinstaller.h index 310bfe4348..6ce08ce6fa 100644 --- a/indra/viewer_components/updater/llupdateinstaller.h +++ b/indra/viewer_components/updater/llupdateinstaller.h @@ -47,4 +47,11 @@ int ll_install_update( LLInstallScriptMode mode=LL_COPY_INSTALL_SCRIPT_TO_TEMP); // Run in place or copy to temp? +// +// Returns the path which points to the failed install marker file, should it +// exist. +// +std::string const & ll_install_failed_marker_path(void); + + #endif diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 6cc872f2ca..a1ad3e3381 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -378,7 +378,19 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) { mTimer.stop(); LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); - mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); + + // Check for failed install. + if(LLFile::isfile(ll_install_failed_marker_path())) + { + // TODO: notify the user. + llinfos << "found marker " << ll_install_failed_marker_path() << llendl; + llinfos << "last install attempt failed" << llendl; + LLFile::remove(ll_install_failed_marker_path()); + } + else + { + mUpdateChecker.check(mProtocolVersion, mUrl, mPath, mChannel, mVersion); + } } else { diff --git a/indra/viewer_components/updater/scripts/darwin/update_install b/indra/viewer_components/updater/scripts/darwin/update_install old mode 100644 new mode 100755 index c061d2818f..b174b3570a --- a/indra/viewer_components/updater/scripts/darwin/update_install +++ b/indra/viewer_components/updater/scripts/darwin/update_install @@ -1,3 +1,9 @@ #! /bin/bash -open ../Resources/mac-updater.app --args -dmg "$1" -name "Second Life Viewer 2" +# +# The first argument contains the path to the installer app. The second a path +# to a marker file which should be created if the installer fails.q +# + +open ../Resources/mac-updater.app --args -dmg "$1" -name "Second Life Viewer 2" -marker "$2" +exit 0 diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 9b56a04ff6..25fd1b034d 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -106,6 +106,12 @@ int ll_install_update(std::string const &, std::string const &, LLInstallScriptM return 0; } +std::string const & ll_install_failed_marker_path() +{ + static std::string wubba; + return wubba; +} + /* #pragma warning(disable: 4273) llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename, -- cgit v1.2.3 From a89024fb372bb293d24d860fb70156b5cf48d6f3 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 15 Nov 2010 09:57:00 -0800 Subject: write marker on windows installer fail. --- indra/viewer_components/updater/scripts/windows/update_install.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/scripts/windows/update_install.bat b/indra/viewer_components/updater/scripts/windows/update_install.bat index def33c1346..9cdc51847a 100644 --- a/indra/viewer_components/updater/scripts/windows/update_install.bat +++ b/indra/viewer_components/updater/scripts/windows/update_install.bat @@ -1 +1,2 @@ -start /WAIT %1 \ No newline at end of file +start /WAIT %1 +IF ERRORLEVEL 1 ECHO ERRORLEVEL > %2 -- cgit v1.2.3 From e8e1d7e629b9a4a65cde766ed81334140a749428 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 15 Nov 2010 21:38:12 +0200 Subject: STORM-318 FIXED The Advanced menu shortcut was broken under Linux. Reason: The old shortcut (Ctrl+Alt+D) was eaten by some window managers. Changes: - Changed the shortcut to Ctrl+Alt+Shift+D. - Moved the appropriate menu item from "Advanced > Shortcuts" to "World > Show" (so that it's not in the menu it triggers) and made it visible. The old shortcut is still available but marked as legacy. Submitting on behalf of Boroondas Gupte. --- indra/newview/skins/default/xui/en/menu_viewer.xml | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b36cf13f1b..796b15551a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -359,6 +359,18 @@ + + + + + @@ -1526,6 +1538,18 @@ + + + + + @@ -1693,23 +1717,6 @@ - - - - - - @@ -1732,7 +1739,6 @@ function="ToggleControl" parameter="QAMode" /> - Date: Mon, 15 Nov 2010 23:01:17 +0200 Subject: STORM-580 FIXED Removed "IM" font color setting as unused. --- indra/newview/llimfloater.cpp | 2 -- indra/newview/skins/default/colors.xml | 3 -- .../default/xui/en/panel_preferences_colors.xml | 41 +++------------------- 3 files changed, 5 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index e000abda2a..bdc0dfa7e2 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -680,8 +680,6 @@ void LLIMFloater::updateMessages() if (messages.size()) { -// LLUIColor chat_color = LLUIColorTable::instance().getColor("IMChatColor"); - LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index f8660419b4..aeea2306f7 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -399,9 +399,6 @@ - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 036730a646..c867afe778 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -113,22 +113,22 @@ + parameter="ObjectChatColor" /> + parameter="ObjectChatColor" /> - IM + Objects Errors - - - - - - Objects - Date: Mon, 15 Nov 2010 14:26:45 -0800 Subject: create marker on error; use /SKIP_DIALOGS option in installer to run without user input. --- indra/viewer_components/updater/scripts/windows/update_install.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/scripts/windows/update_install.bat b/indra/viewer_components/updater/scripts/windows/update_install.bat index 9cdc51847a..44ccef010b 100644 --- a/indra/viewer_components/updater/scripts/windows/update_install.bat +++ b/indra/viewer_components/updater/scripts/windows/update_install.bat @@ -1,2 +1,2 @@ -start /WAIT %1 +start /WAIT %1 /SKIP_DIALOGS IF ERRORLEVEL 1 ECHO ERRORLEVEL > %2 -- cgit v1.2.3 From 35fc90e8aaebc10a5a01c58247c29c8103220578 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Mon, 15 Nov 2010 14:37:32 -0800 Subject: CHOP-179 Added --file option to linux-updater for local install --- indra/linux_updater/linux_updater.cpp | 149 +++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 67 deletions(-) (limited to 'indra') diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp index be4d810860..16660de6bb 100644 --- a/indra/linux_updater/linux_updater.cpp +++ b/indra/linux_updater/linux_updater.cpp @@ -49,6 +49,7 @@ const guint ROTATE_IMAGE_TIMEOUT = 8000; typedef struct _updater_app_state { std::string app_name; std::string url; + std::string file; std::string image_dir; std::string dest_dir; std::string strings_dirs; @@ -266,85 +267,95 @@ gpointer worker_thread_cb(gpointer data) CURLcode result; FILE *package_file; GError *error = NULL; - char *tmp_filename = NULL; int fd; //g_return_val_if_fail (data != NULL, NULL); app_state = (UpdaterAppState *) data; try { - // create temporary file to store the package. - fd = g_file_open_tmp - ("secondlife-update-XXXXXX", &tmp_filename, &error); - if (error != NULL) - { - llerrs << "Unable to create temporary file: " - << error->message - << llendl; - g_error_free(error); - throw 0; - } - - package_file = fdopen(fd, "wb"); - if (package_file == NULL) + if(!app_state->url.empty()) { - llerrs << "Failed to create temporary file: " - << tmp_filename - << llendl; + char* tmp_local_filename = NULL; + // create temporary file to store the package. + fd = g_file_open_tmp + ("secondlife-update-XXXXXX", &tmp_local_filename, &error); + if (error != NULL) + { + llerrs << "Unable to create temporary file: " + << error->message + << llendl; - gdk_threads_enter(); - display_error(app_state->window, - LLTrans::getString("UpdaterFailDownloadTitle"), - LLTrans::getString("UpdaterFailUpdateDescriptive")); - gdk_threads_leave(); - throw 0; - } + g_error_free(error); + throw 0; + } + + if(tmp_local_filename != NULL) + { + app_state->file = tmp_local_filename; + g_free(tmp_local_filename); + } - // initialize curl and start downloading the package - llinfos << "Downloading package: " << app_state->url << llendl; + package_file = fdopen(fd, "wb"); + if (package_file == NULL) + { + llerrs << "Failed to create temporary file: " + << app_state->file.c_str() + << llendl; + + gdk_threads_enter(); + display_error(app_state->window, + LLTrans::getString("UpdaterFailDownloadTitle"), + LLTrans::getString("UpdaterFailUpdateDescriptive")); + gdk_threads_leave(); + throw 0; + } - curl = curl_easy_init(); - if (curl == NULL) - { - llerrs << "Failed to initialize libcurl" << llendl; + // initialize curl and start downloading the package + llinfos << "Downloading package: " << app_state->url << llendl; - gdk_threads_enter(); - display_error(app_state->window, - LLTrans::getString("UpdaterFailDownloadTitle"), - LLTrans::getString("UpdaterFailUpdateDescriptive")); - gdk_threads_leave(); - throw 0; - } + curl = curl_easy_init(); + if (curl == NULL) + { + llerrs << "Failed to initialize libcurl" << llendl; + + gdk_threads_enter(); + display_error(app_state->window, + LLTrans::getString("UpdaterFailDownloadTitle"), + LLTrans::getString("UpdaterFailUpdateDescriptive")); + gdk_threads_leave(); + throw 0; + } - curl_easy_setopt(curl, CURLOPT_URL, app_state->url.c_str()); - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, package_file); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, - &download_progress_cb); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, app_state); + curl_easy_setopt(curl, CURLOPT_URL, app_state->url.c_str()); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, package_file); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, + &download_progress_cb); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, app_state); - result = curl_easy_perform(curl); - fclose(package_file); - curl_easy_cleanup(curl); + result = curl_easy_perform(curl); + fclose(package_file); + curl_easy_cleanup(curl); - if (result) - { - llerrs << "Failed to download update: " - << app_state->url - << llendl; + if (result) + { + llerrs << "Failed to download update: " + << app_state->url + << llendl; - gdk_threads_enter(); - display_error(app_state->window, - LLTrans::getString("UpdaterFailDownloadTitle"), - LLTrans::getString("UpdaterFailUpdateDescriptive")); - gdk_threads_leave(); + gdk_threads_enter(); + display_error(app_state->window, + LLTrans::getString("UpdaterFailDownloadTitle"), + LLTrans::getString("UpdaterFailUpdateDescriptive")); + gdk_threads_leave(); - throw 0; + throw 0; + } } - + // now pulse the progres bar back and forth while the package is // being unpacked gdk_threads_enter(); @@ -357,7 +368,7 @@ gpointer worker_thread_cb(gpointer data) // *TODO: if the destination is not writable, terminate this // thread and show file chooser? - if (!install_package(tmp_filename, app_state->dest_dir)) + if (!install_package(app_state->file.c_str(), app_state->dest_dir)) { llwarns << "Failed to install package to destination: " << app_state->dest_dir @@ -393,11 +404,11 @@ gpointer worker_thread_cb(gpointer data) } // FIXME: delete package file also if delete-event is raised on window - if (tmp_filename != NULL) + if(!app_state->url.empty() && !app_state->file.empty()) { - if (gDirUtilp->fileExists(tmp_filename)) + if (gDirUtilp->fileExists(app_state->file)) { - LLFile::remove(tmp_filename); + LLFile::remove(app_state->file); } } @@ -712,7 +723,7 @@ BOOL spawn_viewer(UpdaterAppState *app_state) void show_usage_and_exit() { - std::cout << "Usage: linux-updater --url URL --name NAME --dest PATH --stringsdir PATH1,PATH2 --stringsfile FILE" + std::cout << "Usage: linux-updater <--url URL | --file FILE> --name NAME --dest PATH --stringsdir PATH1,PATH2 --stringsfile FILE" << "[--image-dir PATH]" << std::endl; exit(1); @@ -728,6 +739,10 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state) { app_state->url = argv[i]; } + else if ((!strcmp(argv[i], "--file")) && (++i < argc)) + { + app_state->file = argv[i]; + } else if ((!strcmp(argv[i], "--name")) && (++i < argc)) { app_state->app_name = argv[i]; @@ -756,7 +771,7 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state) } if (app_state->app_name.empty() - || app_state->url.empty() + || (app_state->url.empty() && app_state->file.empty()) || app_state->dest_dir.empty()) { show_usage_and_exit(); -- cgit v1.2.3 From 64876ea9459ed0e0f1673c5ec9ae67abea2280e2 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 16 Nov 2010 09:43:23 -0800 Subject: better error checking when writing downloaded file. --- indra/viewer_components/updater/llupdatedownloader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index ab441aa747..eccc25aeee 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -275,9 +275,14 @@ size_t LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size) size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size) { if(mCancelled) return 0; // Forces a write error which will halt curl thread. + if((size == 0) || (buffer == 0)) return 0; mDownloadStream.write(reinterpret_cast(buffer), size); - return size; + if(mDownloadStream.bad()) { + return 0; + } else { + return size; + } } -- cgit v1.2.3 From 10998b137ea919e6da05abcc7ad7ea528ad267af Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Tue, 16 Nov 2010 13:33:56 -0500 Subject: STORM-535 : STORM-544 : Addition of Floater Opacity controls to pannel_prefferences_color.xml after loss during cleanup of preferences. --- .../default/xui/en/panel_preferences_colors.xml | 57 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 036730a646..f3a5409e41 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -305,7 +305,7 @@ left="30" height="12" name="bubble_chat" - top_pad="28" + top_pad="20" width="120" > Bubble chat: @@ -336,11 +336,58 @@ height="16" increment="0.05" initial_value="1" - label="Opacity" + label="Opacity:" layout="topleft" - left_pad="15" - label_width="56" + left_pad="10" + label_width="70" name="bubble_chat_opacity" top_delta = "6" - width="347" /> + width="378" /> + + Floater Opacity: + + + -- cgit v1.2.3 From 0670e889f93ffaee1ea103fcd4a54d1217b67bfd Mon Sep 17 00:00:00 2001 From: "Christian Goetze (CG)" Date: Tue, 16 Nov 2010 12:15:00 -0800 Subject: Replace template verification code with an md5sum check. --- indra/cmake/TemplateCheck.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake index fa4e387dd5..90d58d93ad 100644 --- a/indra/cmake/TemplateCheck.cmake +++ b/indra/cmake/TemplateCheck.cmake @@ -7,8 +7,9 @@ macro (check_message_template _target) TARGET ${_target} POST_BUILD COMMAND ${PYTHON_EXECUTABLE} - ARGS ${SCRIPTS_DIR}/template_verifier.py - --mode=development --cache_master - COMMENT "Verifying message template" + ARGS ${SCRIPTS_DIR}/md5check.py + 3f19d130400c547de36278a6b6f9b028 + ${SCRIPTS_DIR}/messages/message_template.msg + COMMENT "Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py" ) endmacro (check_message_template) -- cgit v1.2.3 From d0de833d947b219eabae01abbb5750ad05e5e305 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 16 Nov 2010 23:26:08 +0200 Subject: STORM-563 FIXED Updated all localized XUI strings and notifications templates to use display names. Previously name substitutions were broken, so "[FIRST] [LAST]" was displayed instead of avatar name. Some of the affected notifications: * avatar went online/offline notification * object return notification * calling card offer * script dialog * auto-unmute notification. See the diff for more details. The fixes apply to all locales but English (which is already correct). Besides, I fixed calling card offer notification to display avatar name correctly. It was broken even in English. --- indra/newview/llviewermessage.cpp | 1 + .../newview/skins/default/xui/da/floater_bumps.xml | 10 ++--- indra/newview/skins/default/xui/da/floater_pay.xml | 2 +- .../skins/default/xui/da/floater_pay_object.xml | 2 +- .../newview/skins/default/xui/da/notifications.xml | 19 ++++----- indra/newview/skins/default/xui/da/strings.xml | 2 +- .../newview/skins/default/xui/de/notifications.xml | 2 +- .../skins/default/xui/de/panel_edit_profile.xml | 2 +- .../newview/skins/default/xui/en/notifications.xml | 2 +- indra/newview/skins/default/xui/es/floater_im.xml | 45 ---------------------- .../newview/skins/default/xui/es/notifications.xml | 2 +- .../newview/skins/default/xui/fr/notifications.xml | 2 +- .../skins/default/xui/fr/panel_edit_profile.xml | 2 +- .../newview/skins/default/xui/it/floater_bumps.xml | 10 ++--- indra/newview/skins/default/xui/it/floater_pay.xml | 2 +- .../skins/default/xui/it/floater_pay_object.xml | 2 +- .../newview/skins/default/xui/it/notifications.xml | 19 ++++----- indra/newview/skins/default/xui/it/strings.xml | 2 +- .../newview/skins/default/xui/ja/floater_bumps.xml | 10 ++--- indra/newview/skins/default/xui/ja/floater_pay.xml | 2 +- .../skins/default/xui/ja/floater_pay_object.xml | 2 +- .../newview/skins/default/xui/ja/notifications.xml | 19 ++++----- .../skins/default/xui/ja/panel_edit_profile.xml | 2 +- indra/newview/skins/default/xui/ja/strings.xml | 2 +- .../newview/skins/default/xui/nl/floater_bumps.xml | 10 ++--- indra/newview/skins/default/xui/nl/floater_pay.xml | 2 +- .../skins/default/xui/nl/floater_pay_object.xml | 2 +- .../newview/skins/default/xui/nl/notifications.xml | 5 +-- .../skins/default/xui/nl/panel_edit_profile.xml | 2 +- indra/newview/skins/default/xui/nl/strings.xml | 2 +- .../newview/skins/default/xui/pl/notifications.xml | 2 +- .../skins/default/xui/pl/panel_edit_profile.xml | 2 +- indra/newview/skins/default/xui/pt/floater_im.xml | 45 ---------------------- .../newview/skins/default/xui/pt/notifications.xml | 8 ++-- 34 files changed, 72 insertions(+), 173 deletions(-) delete mode 100644 indra/newview/skins/default/xui/es/floater_im.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_im.xml (limited to 'indra') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7c0fc681a4..1f54940b25 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3031,6 +3031,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) } else { + args["NAME"] = source_name; LLNotificationsUtil::add("OfferCallingCard", args, payload); } } diff --git a/indra/newview/skins/default/xui/da/floater_bumps.xml b/indra/newview/skins/default/xui/da/floater_bumps.xml index d22de6e7f1..1db2e93fd2 100644 --- a/indra/newview/skins/default/xui/da/floater_bumps.xml +++ b/indra/newview/skins/default/xui/da/floater_bumps.xml @@ -4,19 +4,19 @@ Ingen registreret - [TIME] [FIRST] [LAST] ramte dig + [TIME] [NAME] ramte dig - [TIME] [FIRST] [LAST] skubbede dig med et script + [TIME] [NAME] skubbede dig med et script - [TIME] [FIRST] [LAST] ramte dig med et objekt + [TIME] [NAME] ramte dig med et objekt - [TIME] [FIRST] [LAST] ramte dig med et scriptet objekt + [TIME] [NAME] ramte dig med et scriptet objekt - [TIME] [FIRST] [LAST] ramte dig med et fysisk objekt + [TIME] [NAME] ramte dig med et fysisk objekt [[hour,datetime,slt]:[min,datetime,slt]] diff --git a/indra/newview/skins/default/xui/da/floater_pay.xml b/indra/newview/skins/default/xui/da/floater_pay.xml index b2cdc0bfe7..5ebdd3f084 100644 --- a/indra/newview/skins/default/xui/da/floater_pay.xml +++ b/indra/newview/skins/default/xui/da/floater_pay.xml @@ -11,7 +11,7 @@ - [FIRST] [LAST] + Test Name That Is Extremely Long To Check Clipping + \ No newline at end of file -- cgit v1.2.3 From f99ccb12dfc850222f7ec280488c5258ff80c91e Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 17 Nov 2010 12:19:00 -0800 Subject: Update slvoice dependency for Windows --- indra/cmake/ViewerMiscLibs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index 32c4bc81df..df013b1665 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -3,7 +3,7 @@ include(Prebuilt) if (NOT STANDALONE) use_prebuilt_binary(libuuid) - use_prebuilt_binary(vivox) + use_prebuilt_binary(slvoice) use_prebuilt_binary(fontconfig) endif(NOT STANDALONE) -- cgit v1.2.3 From c61d89f61d0b696e6e73105ed7be7580bf1b3437 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 17 Nov 2010 12:24:37 -0800 Subject: CHOP-203 Fixed linux release bug - exclude update_install from symbol strippage --- indra/newview/viewer_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 5d35778e3e..4e5d6271df 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -882,7 +882,7 @@ class LinuxManifest(ViewerManifest): if self.args['buildtype'].lower() == 'release' and self.is_packaging_viewer(): print "* Going strip-crazy on the packaged binaries, since this is a RELEASE build" - self.run_command("find %(d)r/bin %(d)r/lib -type f | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure + self.run_command("find %(d)r/bin %(d)r/lib -type f \\! -name update_install | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure # Fix access permissions self.run_command(""" -- cgit v1.2.3 From 2756030ae3f00a19c03cda929afd9b888080072a Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 17 Nov 2010 12:58:05 -0800 Subject: It is safe to use Python 2.7 on Windows, if present --- indra/cmake/Python.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake index 0901c1b7a2..748c8c2bec 100644 --- a/indra/cmake/Python.cmake +++ b/indra/cmake/Python.cmake @@ -9,10 +9,12 @@ if (WINDOWS) NAMES python25.exe python23.exe python.exe NO_DEFAULT_PATH # added so that cmake does not find cygwin python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] -- cgit v1.2.3 From 8e0e5e0bd9fd3e699a36b6babfacab3c0f61935b Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 17 Nov 2010 15:20:53 -0800 Subject: CHOP-203 Deleting the update file after installer run. --- indra/linux_updater/linux_updater.cpp | 18 +++++++++--------- .../updater/scripts/linux/update_install | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp index a7f886b389..cbdb3ddfe0 100644 --- a/indra/linux_updater/linux_updater.cpp +++ b/indra/linux_updater/linux_updater.cpp @@ -403,15 +403,6 @@ gpointer worker_thread_cb(gpointer data) app_state->failure = TRUE; } - // FIXME: delete package file also if delete-event is raised on window - if(!app_state->url.empty() && !app_state->file.empty()) - { - if (gDirUtilp->fileExists(app_state->file)) - { - LLFile::remove(app_state->file); - } - } - gdk_threads_enter(); updater_app_quit(app_state); gdk_threads_leave(); @@ -824,6 +815,15 @@ int main(int argc, char **argv) gtk_main(); gdk_threads_leave(); + // Delete the file only if created from url download. + if(!app_state->url.empty() && !app_state->file.empty()) + { + if (gDirUtilp->fileExists(app_state->file)) + { + LLFile::remove(app_state->file); + } + } + bool success = app_state->failure != FALSE; delete app_state; return success ? 0 : 1; diff --git a/indra/viewer_components/updater/scripts/linux/update_install b/indra/viewer_components/updater/scripts/linux/update_install index 7d8a27607c..fef5ef7d09 100755 --- a/indra/viewer_components/updater/scripts/linux/update_install +++ b/indra/viewer_components/updater/scripts/linux/update_install @@ -5,4 +5,6 @@ bin/linux-updater.bin --file "$1" --dest "$INSTALL_DIR" --name "Second Life View if [ $? -ne 0 ] then touch $2 -fi \ No newline at end of file +fi + +rm -f $1 -- cgit v1.2.3 From c212695cd96f94248b0da2085aeb23c54a5ca76b Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 17 Nov 2010 16:27:50 -0800 Subject: post events for dowload success and error. --- .../viewer_components/updater/llupdaterservice.cpp | 24 +++++++++++++++++++++- indra/viewer_components/updater/llupdaterservice.h | 10 +++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 976e639098..6a40246497 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -135,7 +135,7 @@ public: void downloadComplete(LLSD const & data); void downloadError(std::string const & message); - bool onMainLoop(LLSD const & event); + bool onMainLoop(LLSD const & event); private: void restartTimer(unsigned int seconds); @@ -349,6 +349,13 @@ void LLUpdaterServiceImpl::downloadComplete(LLSD const & data) // marker file. llofstream update_marker(update_marker_path()); LLSDSerialize::toPrettyXML(data, update_marker); + + LLSD event; + event["pump"] = LLUpdaterService::pumpName(); + LLSD payload; + payload["type"] = LLSD(LLUpdaterService::DOWNLOAD_COMPLETE); + event["payload"] = payload; + LLEventPumps::instance().obtain("mainlooprepeater").post(event); } void LLUpdaterServiceImpl::downloadError(std::string const & message) @@ -362,6 +369,14 @@ void LLUpdaterServiceImpl::downloadError(std::string const & message) { restartTimer(mCheckPeriod); } + + LLSD event; + event["pump"] = LLUpdaterService::pumpName(); + LLSD payload; + payload["type"] = LLSD(LLUpdaterService::DOWNLOAD_ERROR); + payload["message"] = message; + event["payload"] = payload; + LLEventPumps::instance().obtain("mainlooprepeater").post(event); } void LLUpdaterServiceImpl::restartTimer(unsigned int seconds) @@ -405,6 +420,13 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) //----------------------------------------------------------------------- // Facade interface + +std::string const & LLUpdaterService::pumpName(void) +{ + static std::string name("updater_service"); + return name; +} + LLUpdaterService::LLUpdaterService() { if(gUpdater.expired()) diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index ec20dc6e05..8d0b95be86 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -39,6 +39,16 @@ public: public: UsageError(const std::string& msg) : std::runtime_error(msg) {} }; + + // Name of the event pump through which update events will be delivered. + static std::string const & pumpName(void); + + // Type codes for events posted by this service. Stored the event's 'type' element. + enum UpdateEvent { + INVALID, + DOWNLOAD_COMPLETE, + DOWNLOAD_ERROR + }; LLUpdaterService(); ~LLUpdaterService(); -- cgit v1.2.3 From 5c35547ade48123cb571714de42ffe42b232480d Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 17 Nov 2010 16:50:38 -0800 Subject: CHOP-135 Added Pref UI to Setup panel. Rev. by Brad --- .../default/xui/en/panel_preferences_setup.xml | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 140d16e37f..79013e7e27 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -29,7 +29,7 @@ layout="topleft" left_delta="50" name=" Mouse Sensitivity" - top_pad="10" + top_pad="5" width="150"> Mouse sensitivity @@ -76,7 +76,7 @@ left_delta="50" name="Maximum bandwidth" mouse_opaque="false" - top_pad="10" + top_pad="5" width="200"> Maximum bandwidth @@ -115,7 +115,7 @@ layout="topleft" left="77" name="connection_port_enabled" - top_pad="20" + top_pad="10" width="256"> Cache size @@ -239,7 +239,7 @@ layout="topleft" left="30" name="Web:" - top_pad="5" + top_pad="10" width="300"> Web: @@ -386,4 +386,20 @@ name="web_proxy_port" top_delta="0" width="145" /> + + + -- cgit v1.2.3 From 098fa21c4f812b94348c0631c29babff68968d3d Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Wed, 17 Nov 2010 17:06:21 -0800 Subject: Work on CHOP-135: Hooking up setting UpdaterServiceActive to functionality. Paired with Mani. Toggling the setting now calls LLUpdaterService::startChecking() and LLUpdaterService::stopChecking(), which enable and disable the service. --- indra/newview/llviewercontrol.cpp | 14 ++++++++++++++ indra/viewer_components/updater/llupdaterservice.cpp | 17 +++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index f579c433e1..f65811598f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -70,6 +70,7 @@ #include "llpaneloutfitsinventory.h" #include "llpanellogin.h" #include "llpaneltopinfobar.h" +#include "llupdaterservice.h" #ifdef TOGGLE_HACKED_GODLIKE_VIEWER BOOL gHackGodmode = FALSE; @@ -488,6 +489,18 @@ bool toggle_show_object_render_cost(const LLSD& newvalue) return true; } +void toggle_updater_service_active(LLControlVariable* control, const LLSD& new_value) +{ + if(new_value.asBoolean()) + { + LLUpdaterService().startChecking(); + } + else + { + LLUpdaterService().stopChecking(); + } +} + //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() @@ -635,6 +648,7 @@ void settings_setup_listeners() gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); + gSavedSettings.getControl("UpdaterServiceActive")->getSignal()->connect(&toggle_updater_service_active); gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2)); } diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 6a40246497..58f2c7da76 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -175,12 +175,6 @@ void LLUpdaterServiceImpl::initialize(const std::string& protocol_version, mPath = path; mChannel = channel; mVersion = version; - - // Check to see if an install is ready. - if(!checkForInstall()) - { - checkForResume(); - } } void LLUpdaterServiceImpl::setCheckPeriod(unsigned int seconds) @@ -198,6 +192,12 @@ void LLUpdaterServiceImpl::startChecking() mIsChecking = true; + // Check to see if an install is ready. + if(!checkForInstall()) + { + checkForResume(); + } + if(!mIsDownloading) { // Checking can only occur during the mainloop. @@ -214,6 +214,11 @@ void LLUpdaterServiceImpl::stopChecking() mIsChecking = false; mTimer.stop(); } + + if(mIsDownloading) + { + this->mUpdateDownloader.cancel(); + } } bool LLUpdaterServiceImpl::isChecking() -- cgit v1.2.3 From 86260988e332c2ff750f680ada13560c2c97fa5d Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 18 Nov 2010 13:14:06 +0200 Subject: STORM-576 FIXED Hooked up code to preference that allows users to enable double-click to teleport or use auto-pilot. - Added dirty flag that is set true when user changes checkbox or chooses one of radiobuttons connected to double-click action. No change of user settings happens on this commit, because user may press cancel or close floater. If user presses OK, and flag is true, user changes are applied to settings. If user clicks cancel or closes floater, controls are reverted to the state they were before changes, using settings to determine it. - Removed double-click action menu items and code that handled them to avoid functionality duplication and synchronization problems. --- indra/newview/llfloaterpreference.cpp | 81 +++++++++++++++++++++- indra/newview/llfloaterpreference.h | 11 +++ indra/newview/llviewermenu.cpp | 10 --- indra/newview/skins/default/xui/en/menu_viewer.xml | 20 ------ .../default/xui/en/panel_preferences_move.xml | 9 ++- 5 files changed, 97 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c105f023c7..ac940f4f77 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -282,7 +282,8 @@ std::string LLFloaterPreference::sSkin = ""; LLFloaterPreference::LLFloaterPreference(const LLSD& key) : LLFloater(key), mGotPersonalInfo(false), - mOriginalIMViaEmail(false) + mOriginalIMViaEmail(false), + mDoubleClickActionDirty(false) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -320,6 +321,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); + mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox", boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1)); + mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick", boost::bind(&LLFloaterPreference::onDoubleClickRadio, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -342,6 +345,8 @@ BOOL LLFloaterPreference::postBuild() if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); + updateDoubleClickControls(); + getChild("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); setCacheLocation(cache_location); @@ -475,6 +480,12 @@ void LLFloaterPreference::apply() gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); } } + + if (mDoubleClickActionDirty) + { + updateDoubleClickSettings(); + mDoubleClickActionDirty = false; + } } void LLFloaterPreference::cancel() @@ -501,6 +512,12 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); + + if (mDoubleClickActionDirty) + { + updateDoubleClickControls(); + mDoubleClickActionDirty = false; + } } void LLFloaterPreference::onOpen(const LLSD& key) @@ -1318,6 +1335,68 @@ void LLFloaterPreference::onClickBlockList() } } +void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl) +{ + if (!ctrl) return; + mDoubleClickActionDirty = true; + LLRadioGroup* radio_double_click_action = getChild("double_click_action"); + if (!radio_double_click_action) return; + // select default value("teleport") in radio-group. + radio_double_click_action->setSelectedIndex(0); + // set radio-group enabled depending on state of checkbox + radio_double_click_action->setEnabled(ctrl->getValue()); +} + +void LLFloaterPreference::onDoubleClickRadio() +{ + mDoubleClickActionDirty = true; +} + +void LLFloaterPreference::updateDoubleClickSettings() +{ + LLCheckBoxCtrl* double_click_action_cb = getChild("double_click_chkbox"); + if (!double_click_action_cb) return; + bool enable = double_click_action_cb->getValue().asBoolean(); + + LLRadioGroup* radio_double_click_action = getChild("double_click_action"); + if (!radio_double_click_action) return; + + // enable double click radio-group depending on state of checkbox + radio_double_click_action->setEnabled(enable); + + if (!enable) + { + // set double click action settings values to false if checkbox was unchecked + gSavedSettings.setBOOL("DoubleClickAutoPilot", false); + gSavedSettings.setBOOL("DoubleClickTeleport", false); + } + else + { + std::string selected = radio_double_click_action->getValue().asString(); + bool teleport_selected = selected == "radio_teleport"; + // set double click action settings values depending on chosen radio-button + gSavedSettings.setBOOL( "DoubleClickTeleport", teleport_selected ); + gSavedSettings.setBOOL( "DoubleClickAutoPilot", !teleport_selected ); + } +} + +void LLFloaterPreference::updateDoubleClickControls() +{ + // check is one of double-click actions settings enabled + bool double_click_action_enabled = gSavedSettings.getBOOL("DoubleClickAutoPilot") || gSavedSettings.getBOOL("DoubleClickTeleport"); + LLCheckBoxCtrl* double_click_action_cb = getChild("double_click_chkbox"); + if (double_click_action_cb) + { + // check checkbox if one of double-click actions settings enabled, uncheck otherwise + double_click_action_cb->setValue(double_click_action_enabled); + } + LLRadioGroup* double_click_action_radio = getChild("double_click_action"); + if (!double_click_action_radio) return; + // set radio-group enabled if one of double-click actions settings enabled + double_click_action_radio->setEnabled(double_click_action_enabled); + // select button in radio-group depending on setting + double_click_action_radio->setSelectedIndex(gSavedSettings.getBOOL("DoubleClickAutoPilot")); +} void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index e99731b92e..46f50d9a4d 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -95,6 +95,14 @@ protected: void setHardwareDefaults(); // callback for when client turns on shaders void onVertexShaderEnable(); + // callback for changing double click action checkbox + void onDoubleClickCheckBox(LLUICtrl* ctrl); + // callback for selecting double click action radio-button + void onDoubleClickRadio(); + // updates double-click action settings depending on controls from preferences + void updateDoubleClickSettings(); + // updates double-click action controls depending on values from settings.xml + void updateDoubleClickControls(); // This function squirrels away the current values of the controls so that // cancel() can restore them. @@ -145,6 +153,9 @@ public: static void refreshSkin(void* data); private: static std::string sSkin; + // set true if state of double-click action checkbox or radio-group was changed by user + // (reset back to false on apply or cancel) + bool mDoubleClickActionDirty; bool mGotPersonalInfo; bool mOriginalIMViaEmail; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2874a6ec79..54fe34e738 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6500,16 +6500,6 @@ class LLToggleControl : public view_listener_t std::string control_name = userdata.asString(); BOOL checked = gSavedSettings.getBOOL( control_name ); gSavedSettings.setBOOL( control_name, !checked ); - - // Doubleclick actions - there can be only one - if ((control_name == "DoubleClickAutoPilot") && !checked) - { - gSavedSettings.setBOOL( "DoubleClickTeleport", FALSE ); - } - else if ((control_name == "DoubleClickTeleport") && !checked) - { - gSavedSettings.setBOOL( "DoubleClickAutoPilot", FALSE ); - } return true; } }; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 9fcf952bf0..f74b6ba7b5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2660,26 +2660,6 @@ - - - - - - - - + top_pad="0"> + + + -- cgit v1.2.3 From c68d6c794c8f6654ad83bf56977886c8d30c599f Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 19 Nov 2010 16:50:10 +0200 Subject: STORM-584 FIXED color setting to apply to bubble chat text. --- indra/newview/llhudnametag.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index fc758569e4..c099a3964b 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -87,7 +87,6 @@ LLHUDNameTag::LLHUDNameTag(const U8 type) mZCompare(TRUE), mVisibleOffScreen(FALSE), mOffscreen(FALSE), - mColor(1.f, 1.f, 1.f, 1.f), // mScale(), mWidth(0.f), mHeight(0.f), @@ -109,6 +108,8 @@ LLHUDNameTag::LLHUDNameTag(const U8 type) { LLPointer ptr(this); sTextObjects.insert(ptr); + + mColor = LLUIColorTable::instance().getColor("BackgroundChatColor"); } LLHUDNameTag::~LLHUDNameTag() @@ -256,6 +257,7 @@ void LLHUDNameTag::renderText(BOOL for_select) LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; + mColor = LLUIColorTable::instance().getColor("BackgroundChatColor"); LLColor4 text_color = mColor; if (mDoFade) { @@ -521,7 +523,6 @@ void LLHUDNameTag::renderText(BOOL for_select) x_offset += 1; } - text_color = segment_iter->mColor; text_color.mV[VALPHA] *= alpha_factor; hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, FALSE); -- cgit v1.2.3 From dba05505ee0d5ad23cd7b2fab44271b3487b2712 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 22 Nov 2010 17:18:59 +0200 Subject: STORM-517 FIXED Warn user that language change will only take effect after restarting viewer. The warning is shown only once (until the preferences floater is reopened). --- indra/newview/llfloaterpreference.cpp | 18 ++++++++++++++++++ indra/newview/llfloaterpreference.h | 2 ++ indra/newview/skins/default/xui/en/notifications.xml | 7 +++++++ 3 files changed, 27 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ac940f4f77..6a7b5171b5 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -283,6 +283,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) : LLFloater(key), mGotPersonalInfo(false), mOriginalIMViaEmail(false), + mLanguageChanged(false), mDoubleClickActionDirty(false) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -351,6 +352,8 @@ BOOL LLFloaterPreference::postBuild() std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); setCacheLocation(cache_location); + getChild("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); + // if floater is opened before login set default localized busy message if (LLStartUp::getStartupState() < STATE_STARTED) { @@ -570,6 +573,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) getChildView("maturity_desired_combobox")->setVisible( false); } + // Forget previous language changes. + mLanguageChanged = false; + // Display selected maturity icons. onChangeMaturity(); @@ -727,6 +733,18 @@ void LLFloaterPreference::onClickBrowserClearCache() LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); } +// Called when user changes language via the combobox. +void LLFloaterPreference::onLanguageChange() +{ + // Let the user know that the change will only take effect after restart. + // Do it only once so that we're not too irritating. + if (!mLanguageChanged) + { + LLNotificationsUtil::add("ChangeLanguage"); + mLanguageChanged = true; + } +} + void LLFloaterPreference::onClickSetCache() { std::string cur_name(gSavedSettings.getString("CacheLocation")); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 46f50d9a4d..bb871e7e25 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -83,6 +83,7 @@ protected: void onBtnApply(); void onClickBrowserClearCache(); + void onLanguageChange(); // set value of "BusyResponseChanged" in account settings depending on whether busy response // string differs from default after user changes. @@ -158,6 +159,7 @@ private: bool mDoubleClickActionDirty; bool mGotPersonalInfo; bool mOriginalIMViaEmail; + bool mLanguageChanged; bool mOriginalHideOnlineStatus; std::string mDirectoryVisibility; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 9536bf2cf7..60b876d163 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -907,6 +907,13 @@ Port settings take effect after you restart [APP_NAME]. The new skin will appear after you restart [APP_NAME]. + +Changing language will take effect after you restart [APP_NAME]. + + Date: Fri, 19 Nov 2010 23:20:40 +0200 Subject: STORM-456 FIXED Removed an extra space from a Polish string. --- indra/newview/skins/default/xui/pl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml index 59daa26bf0..ea8bdd75b9 100644 --- a/indra/newview/skins/default/xui/pl/strings.xml +++ b/indra/newview/skins/default/xui/pl/strings.xml @@ -3469,7 +3469,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE]. Rozmowa głosowa zakończona - Konferencja z [AGENT_NAME] + Konferencja z [AGENT_NAME] (Sesja IM wygasła) -- cgit v1.2.3 From e7e974d6c9e8b548fe2542f767c99dc27bc7cf8f Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 23 Nov 2010 20:08:50 +0200 Subject: STORM-378 FIXED Added playing snapshot animation and sound when snapshot floater is open or refreshed and a snapshot is actually taken. Removed animation upon saving and sending a snapshot. --- indra/newview/llfloaterpostcard.cpp | 4 +--- indra/newview/llfloatersnapshot.cpp | 11 ++++------- indra/newview/llviewermenufile.cpp | 2 -- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index e8e9f76912..220d33016a 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -361,9 +361,7 @@ void LLFloaterPostcard::sendPostcard() { gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE); } - - // give user feedback of the event - gViewerWindow->playSnapshotAnimAndSound(); + LLUploadDialog::modalUploadDialog(getString("upload_message")); // don't destroy the window until the upload is done diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 51ee38bd65..d55272c558 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1004,7 +1004,6 @@ void LLSnapshotLivePreview::saveTexture() LLFloaterPerms::getEveryonePerms(), "Snapshot : " + pos_string, callback, expected_upload_cost, userdata); - gViewerWindow->playSnapshotAnimAndSound(); } else { @@ -1026,10 +1025,6 @@ BOOL LLSnapshotLivePreview::saveLocal() mDataSize = 0; updateSnapshot(FALSE, FALSE); - if(success) - { - gViewerWindow->playSnapshotAnimAndSound(); - } return success; } @@ -1049,8 +1044,6 @@ void LLSnapshotLivePreview::saveWeb() LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(gAgentCamera.getCameraPositionGlobal(), boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, jpg, metadata, _1, _2, _3, _4)); - - gViewerWindow->playSnapshotAnimAndSound(); } void LLSnapshotLivePreview::regionNameCallback(LLImageJPEG* snapshot, LLSD& metadata, const std::string& name, S32 x, S32 y, S32 z) @@ -1540,6 +1533,8 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) if (previewp && view) { previewp->updateSnapshot(TRUE); + + gViewerWindow->playSnapshotAnimAndSound(); } } @@ -2209,6 +2204,8 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setVisible(TRUE); gSnapshotFloaterView->adjustToFitScreen(this, FALSE); + + gViewerWindow->playSnapshotAnimAndSound(); } void LLFloaterSnapshot::onClose(bool app_quitting) diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 237aa39e6e..048691696b 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -404,8 +404,6 @@ class LLFileTakeSnapshotToDisk : public view_listener_t gSavedSettings.getBOOL("RenderUIInSnapshot"), FALSE)) { - gViewerWindow->playSnapshotAnimAndSound(); - LLPointer formatted; switch(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))) { -- cgit v1.2.3 From b12a2d2fd9fc4aaaf45ef893c86fd1d5f6d37372 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 19 Nov 2010 21:16:01 +0200 Subject: STORM-432 FIXED Disabled manual resizing of the bottom panel in the People/Friends tab. --- indra/newview/skins/default/xui/en/panel_people.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 68c423d7dd..6a8bf87bc5 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -241,6 +241,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M height="25" layout="topleft" name="options_gear_btn_panel" + user_resize="false" width="32"> @@ -96,6 +97,7 @@ + @@ -116,6 +118,7 @@ + @@ -262,7 +265,7 @@ - + @@ -274,6 +277,7 @@ + diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml index a8849861cf..1ad0d06ca1 100644 --- a/indra/newview/skins/default/xui/da/notifications.xml +++ b/indra/newview/skins/default/xui/da/notifications.xml @@ -110,8 +110,8 @@ Vælg kun en genstand, og prøv igen. - At give redigerings rettigheder til en anden beboer, giver dem mulighed for at ændre, slette eller tage ALLE genstande, du måtte have i verden. Vær MEGET forsigtig når uddeler denne tilladelse. -Ønsker du at ændre rettigheder for [FIRST_NAME] [LAST_NAME]? + Tildeling af ændre-rettigheder til andre beboere, tillader dem at ændre, slette eller tage ETHVERT objekt du måtte have. Vær MEGET forsigtig ved tildeling af denne rettighed. +Ønsker du at give ændre-rettgheder til [NAME]? @@ -120,7 +120,7 @@ Vælg kun en genstand, og prøv igen. - Vil du tilbagekalde rettighederne for [FIRST_NAME] [LAST_NAME]? + Ønsker du at tilbagekalder ændre-rettigheder for [NAME]? @@ -202,14 +202,14 @@ Hvis media kun skal vises på en overflade, vælg 'Vælg overflade' og Overskrider vedhæftnings begrænsning på [MAX_ATTACHMENTS] objekter. Tag venligst en anden vedhæftning af først. - Ups! Noget var tomt. -Du skal skrive både fornavn og efternavn på din figur. + Ups. Noget mangler at blive udfyldt. +Du skal indtaste brugernavnet for din avatar. -Du har brug for en konto for at logge ind i [SECOND_LIFE]. Vil du oprette en nu? +Du skal bruge en konto for at benytte [SECOND_LIFE]. Ønsker du at oprette en konto nu? - Du skal indtaste både fornavn og efternavn i din avatars brugernavn felt og derefter logge på igen. + Du skal indtaste enten dit brugernavn eller både dit fornavn og efternavn for din avatar i brugernavn feltet, derefter log på igen. Annoncer vil vises i 'Annoncer' sektionen i søge biblioteket og på [http://secondlife.com/community/classifieds secondlife.com] i en uge. @@ -390,13 +390,6 @@ Dette er typisk en midlertidig fejl. Venligst rediger og gem igen om et par minu [MESSAGE] - - Venner kan give tilladelse til at følge hinanden -på Verdenskortet eller modtage status opdateringer. - -Tilbyd venskab til [NAME]? - - Venner kan give tilladelse til at følge hinanden på Verdenskortet eller modtage status opdateringer. @@ -440,12 +433,22 @@ Tilbyd venskab til [NAME]?