diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/lldelayedgestureerror.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/lldelayedgestureerror.cpp')
-rw-r--r-- | linden/indra/newview/lldelayedgestureerror.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/linden/indra/newview/lldelayedgestureerror.cpp b/linden/indra/newview/lldelayedgestureerror.cpp new file mode 100644 index 0000000..0a1c9df --- /dev/null +++ b/linden/indra/newview/lldelayedgestureerror.cpp | |||
@@ -0,0 +1,125 @@ | |||
1 | /** | ||
2 | * @file lldelayedgestureerror.cpp | ||
3 | * @brief Delayed gesture error message -- try to wait until name has been retrieved | ||
4 | * @author Dale Glass | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2004&license=viewergpl$ | ||
7 | * | ||
8 | * Copyright (c) 2004-2008, Linden Research, Inc. | ||
9 | * | ||
10 | * Second Life Viewer Source Code | ||
11 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
12 | * to you under the terms of the GNU General Public License, version 2.0 | ||
13 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
17 | * | ||
18 | * There are special exceptions to the terms and conditions of the GPL as | ||
19 | * it is applied to this Source Code. View the full text of the exception | ||
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
21 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
22 | * | ||
23 | * By copying, modifying or distributing this software, you acknowledge | ||
24 | * that you have read and understood your obligations described above, | ||
25 | * and agree to abide by those obligations. | ||
26 | * | ||
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
29 | * COMPLETENESS OR PERFORMANCE. | ||
30 | * $/LicenseInfo$ | ||
31 | */ | ||
32 | |||
33 | #include "llviewerprecompiledheaders.h" | ||
34 | #include "lldelayedgestureerror.h" | ||
35 | #include <list> | ||
36 | #include "llnotify.h" | ||
37 | #include "llcallbacklist.h" | ||
38 | #include "llinventory.h" | ||
39 | #include "llviewerinventory.h" | ||
40 | #include "llinventorymodel.h" | ||
41 | |||
42 | const F32 MAX_NAME_WAIT_TIME = 5.0f; | ||
43 | |||
44 | LLDelayedGestureError::ErrorQueue LLDelayedGestureError::sQueue; | ||
45 | |||
46 | //static | ||
47 | void LLDelayedGestureError::gestureMissing(const LLUUID &id) | ||
48 | { | ||
49 | LLErrorEntry ent("GestureMissing", id); | ||
50 | if ( ! doDialog(ent) ) | ||
51 | { | ||
52 | enqueue(ent); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | //static | ||
57 | void LLDelayedGestureError::gestureFailedToLoad(const LLUUID &id) | ||
58 | { | ||
59 | LLErrorEntry ent("UnableToLoadGesture", id); | ||
60 | |||
61 | if ( ! doDialog(ent) ) | ||
62 | { | ||
63 | enqueue(ent); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | //static | ||
68 | void LLDelayedGestureError::enqueue(const LLErrorEntry &ent) | ||
69 | { | ||
70 | if ( sQueue.empty() ) | ||
71 | { | ||
72 | gIdleCallbacks.addFunction(onIdle, NULL); | ||
73 | } | ||
74 | |||
75 | sQueue.push_back(ent); | ||
76 | } | ||
77 | |||
78 | //static | ||
79 | void LLDelayedGestureError::onIdle(void *userdata) | ||
80 | { | ||
81 | if ( ! sQueue.empty() ) | ||
82 | { | ||
83 | LLErrorEntry ent = sQueue.front(); | ||
84 | sQueue.pop_front(); | ||
85 | |||
86 | if ( ! doDialog(ent, false ) ) | ||
87 | { | ||
88 | enqueue(ent); | ||
89 | } | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | // Nothing to do anymore | ||
94 | gIdleCallbacks.deleteFunction(onIdle, NULL); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | //static | ||
99 | bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) | ||
100 | { | ||
101 | LLStringBase<char>::format_map_t args; | ||
102 | LLInventoryItem *item = gInventory.getItem( ent.mItemID ); | ||
103 | |||
104 | if ( item ) | ||
105 | { | ||
106 | args["[NAME]"] = item->getName(); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME ) | ||
111 | { | ||
112 | args["[NAME]"] = LLString( ent.mItemID.asString() ); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | return false; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | |||
121 | LLNotifyBox::showXml(ent.mNotifyName, args); | ||
122 | |||
123 | return true; | ||
124 | } | ||
125 | |||