diff options
Diffstat (limited to 'indra/newview/llfloaterbump.cpp')
| -rw-r--r-- | indra/newview/llfloaterbump.cpp | 111 |
1 files changed, 39 insertions, 72 deletions
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 2cf1f555ea..61cf4dad93 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -3,88 +3,67 @@ * @brief Floater showing recent bumps, hits with objects, pushes, etc. * @author Cory Ondrejka, James Cook * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" -#include "llfloaterbump.h" +#include "llsd.h" +#include "mean_collision_data.h" +#include "llfloaterbump.h" #include "llscrolllistctrl.h" - -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewermessage.h" -#include "llappviewer.h" // gPacificDaylightTime - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- -LLFloaterBump* LLFloaterBump::sInstance = NULL; ///---------------------------------------------------------------------------- /// Class LLFloaterBump ///---------------------------------------------------------------------------- +extern BOOL gNoRender; // Default constructor -LLFloaterBump::LLFloaterBump() -: LLFloater() +LLFloaterBump::LLFloaterBump(const LLSD& key) +: LLFloater(key) { - sInstance = this; - - gUICtrlFactory->buildFloater(this, "floater_bumps.xml"); + if(gNoRender) return; } // Destroys the object LLFloaterBump::~LLFloaterBump() { - sInstance = NULL; } -// static -void LLFloaterBump::show(void *contents) +// virtual +void LLFloaterBump::onOpen(const LLSD& key) { - if (gNoRender) - { + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("bump_list"); + if (!list) return; - } - - if (!sInstance) - { - sInstance = new LLFloaterBump(); - } - - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "bump_list"); - if (!list) return; list->deleteAllItems(); if (gMeanCollisionList.empty()) { - LLString none_detected = sInstance->getString("none_detected"); + std::string none_detected = getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; @@ -96,36 +75,25 @@ void LLFloaterBump::show(void *contents) iter != gMeanCollisionList.end(); ++iter) { LLMeanCollisionData *mcd = *iter; - LLFloaterBump::add(list, mcd); + add(list, mcd); } } - - sInstance->open(); /*Flawfinder: ignore*/ } void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { - if (!sInstance) - { - new LLFloaterBump(); - } - - if (!mcd->mFirstName[0] - || list->getItemCount() >= 20) + if (mcd->mFullName.empty() || list->getItemCount() >= 20) { return; } - // There's only one internal tm buffer. - struct tm* timep; - - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); - - LLString time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); + std::string timeStr = getString ("timeStr"); + LLSD substitution; + + substitution["datetime"] = (S32) mcd->mTime; + LLStringUtil::format (timeStr, substitution); - LLString action; + std::string action; switch(mcd->mType) { case MEAN_BUMP: @@ -150,10 +118,9 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) } // All above action strings are in XML file - LLUIString text = sInstance->getUIString(action); - text.setArg("[TIME]", time); - text.setArg("[FIRST]", mcd->mFirstName); - text.setArg("[LAST]", mcd->mLastName); + LLUIString text = getString(action); + text.setArg("[TIME]", timeStr); + text.setArg("[NAME]", mcd->mFullName); LLSD row; row["id"] = mcd->mPerp; |
