diff options
Diffstat (limited to 'linden/indra/newview/llcountdown.cpp')
-rw-r--r-- | linden/indra/newview/llcountdown.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/linden/indra/newview/llcountdown.cpp b/linden/indra/newview/llcountdown.cpp deleted file mode 100644 index 42dc440..0000000 --- a/linden/indra/newview/llcountdown.cpp +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | /** | ||
2 | * @file llcountdown.cpp | ||
3 | * @brief Implementation of the countdown box. | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #include "llviewerprecompiledheaders.h" | ||
30 | |||
31 | #include "llcountdown.h" | ||
32 | |||
33 | ///---------------------------------------------------------------------------- | ||
34 | /// Local function declarations, constants, enums, and typedefs | ||
35 | ///---------------------------------------------------------------------------- | ||
36 | |||
37 | const LLString DEFAULT_BASE_PREFIX("This dialag will close in "); | ||
38 | const LLString DEFAULT_BASE_SUFFIX(" seconds"); | ||
39 | |||
40 | ///---------------------------------------------------------------------------- | ||
41 | /// Class llcountdown | ||
42 | ///---------------------------------------------------------------------------- | ||
43 | |||
44 | // Default constructor | ||
45 | LLCountdown::LLCountdown(const std::string& name, const LLRect& rect, F32 seconds, | ||
46 | const char* base_prefix, const char* base_suffix) : | ||
47 | LLTextBox(name, rect), | ||
48 | mSeconds(seconds), | ||
49 | mHalfway(seconds/2-0.99f) | ||
50 | { | ||
51 | mExpired.reset(); | ||
52 | if(base_prefix) | ||
53 | { | ||
54 | mBasePrefix.assign(base_prefix); | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | mBasePrefix = DEFAULT_BASE_PREFIX; | ||
59 | } | ||
60 | if(base_suffix) | ||
61 | { | ||
62 | mBaseSuffix.assign(base_suffix); | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | mBaseSuffix = DEFAULT_BASE_SUFFIX; | ||
67 | } | ||
68 | S32 s = llfloor(mSeconds); | ||
69 | LLString buffer = mBasePrefix + llformat("%d",s) + mBaseSuffix; | ||
70 | setText(buffer); | ||
71 | } | ||
72 | |||
73 | // Destroys the object | ||
74 | LLCountdown::~LLCountdown() | ||
75 | { | ||
76 | } | ||
77 | |||
78 | BOOL LLCountdown::isExpired() | ||
79 | { | ||
80 | if(mExpired.getElapsedTimeF32() > mSeconds) | ||
81 | { | ||
82 | return TRUE; | ||
83 | } | ||
84 | return FALSE; | ||
85 | } | ||
86 | |||
87 | void LLCountdown::draw() | ||
88 | { | ||
89 | F32 elapsed = mExpired.getElapsedTimeF32(); | ||
90 | if(elapsed > mSeconds) | ||
91 | { | ||
92 | LLString buffer = mBasePrefix + "0" + mBaseSuffix; | ||
93 | setText(buffer); | ||
94 | } | ||
95 | else if(elapsed > mHalfway) | ||
96 | { | ||
97 | S32 seconds = llfloor(llmax((mSeconds - elapsed), 0.0f)); | ||
98 | LLString buffer = mBasePrefix + llformat("%d",seconds) + mBaseSuffix; | ||
99 | setText(buffer); | ||
100 | } | ||
101 | LLTextBox::draw(); | ||
102 | } | ||
103 | |||
104 | ///---------------------------------------------------------------------------- | ||
105 | /// Local function definitions | ||
106 | ///---------------------------------------------------------------------------- | ||