summaryrefslogtreecommitdiff
path: root/indra/newview/lluploaddialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lluploaddialog.cpp')
-rw-r--r--indra/newview/lluploaddialog.cpp77
1 files changed, 34 insertions, 43 deletions
diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp
index ac41e02744..df7c5be0d6 100644
--- a/indra/newview/lluploaddialog.cpp
+++ b/indra/newview/lluploaddialog.cpp
@@ -2,30 +2,25 @@
* @file lluploaddialog.cpp
* @brief LLUploadDialog class implementation
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&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$
*/
@@ -40,6 +35,7 @@
#include "llkeyboard.h"
#include "llfocusmgr.h"
#include "llviewercontrol.h"
+#include "llrootview.h"
// static
LLUploadDialog* LLUploadDialog::sDialog = NULL;
@@ -63,8 +59,7 @@ void LLUploadDialog::modalUploadFinished()
// Private methods
LLUploadDialog::LLUploadDialog( const std::string& msg)
- :
- LLPanel( "Uploading...", LLRect(0,100,100,0) ) // dummy rect. Will reshape below.
+ : LLPanel()
{
setBackgroundVisible( TRUE );
@@ -74,23 +69,28 @@ LLUploadDialog::LLUploadDialog( const std::string& msg)
}
LLUploadDialog::sDialog = this;
- const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
LLRect msg_rect;
for (int line_num=0; line_num<16; ++line_num)
{
- mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "Filename", font );
+ LLTextBox::Params params;
+ params.name("Filename");
+ params.rect(msg_rect);
+ params.initial_value("Filename");
+ params.font(font);
+ mLabelBox[line_num] = LLUICtrlFactory::create<LLTextBox> (params);
addChild(mLabelBox[line_num]);
}
setMessage(msg);
// The dialog view is a root view
- gViewerWindow->setTopCtrl( this );
+ gViewerWindow->addPopup(this);
}
void LLUploadDialog::setMessage( const std::string& msg)
{
- const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
const S32 VPAD = 16;
const S32 HPAD = 25;
@@ -102,27 +102,18 @@ void LLUploadDialog::setMessage( const std::string& msg)
S32 max_msg_width = 0;
std::list<std::string> msg_lines;
- S32 size = msg.size() + 1;// + strlen("Uploading...\n\n");
- char* temp_msg = new char[size];
-
- //strcpy(temp_msg,"Uploading...\n\n");
- if (temp_msg == NULL)
- {
- llerrs << "Memory Allocation Failed" << llendl;
- return;
- }
-
- strcpy( temp_msg, msg.c_str()); /* Flawfinder: ignore */
- char* token = strtok( temp_msg, "\n" );
+ S32 size = msg.size() + 1;
+ std::vector<char> temp_msg(size); // non-const copy to make strtok happy
+ strcpy( &temp_msg[0], msg.c_str());
+ char* token = strtok( &temp_msg[0], "\n" );
while( token )
{
- S32 cur_width = S32(font->getWidth(token) + 0.99f) + TEXT_PAD;
+ std::string tokstr(token);
+ S32 cur_width = S32(font->getWidth(tokstr) + 0.99f) + TEXT_PAD;
max_msg_width = llmax( max_msg_width, cur_width );
- msg_lines.push_back( std::string( token ) );
+ msg_lines.push_back( tokstr );
token = strtok( NULL, "\n" );
}
- delete[] temp_msg;
-
S32 line_height = S32( font->getLineHeight() + 0.99f );
S32 dialog_width = max_msg_width + 2 * HPAD;
@@ -147,7 +138,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height );
mLabelBox[line_num]->setRect(msg_rect);
mLabelBox[line_num]->setText(cur_line);
- mLabelBox[line_num]->setColor( gColors.getColor( "LabelTextColor" ) );
+ mLabelBox[line_num]->setColor( LLUIColorTable::instance().getColor( "LabelTextColor" ) );
mLabelBox[line_num]->setVisible(TRUE);
msg_y -= line_height;
++line_num;