diff options
author | Jacek Antonelli | 2008-08-15 23:45:16 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:16 -0500 |
commit | 3f27ba891ac4d032753b219b4b96d1ffbc9fb488 (patch) | |
tree | 504932ee91a0356fba7ea48798887c96867e492f /linden/indra/newview/llfloaterclassified.cpp | |
parent | Second Life viewer sources 1.18.4.3 (diff) | |
download | meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.zip meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.gz meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.bz2 meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.xz |
Second Life viewer sources 1.18.5.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterclassified.cpp | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterclassified.cpp b/linden/indra/newview/llfloaterclassified.cpp new file mode 100644 index 0000000..aa57c6f --- /dev/null +++ b/linden/indra/newview/llfloaterclassified.cpp | |||
@@ -0,0 +1,131 @@ | |||
1 | /** | ||
2 | * @file llfloaterclassified.cpp | ||
3 | * @brief LLFloaterClassifiedInfo class implementation | ||
4 | * | ||
5 | * Classified information as shown in a floating window from secondlife:// command | ||
6 | * handler. | ||
7 | * | ||
8 | * $LicenseInfo:firstyear=2002&license=internal$ | ||
9 | * | ||
10 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
11 | * | ||
12 | * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of | ||
13 | * this source code is governed by the Linden Lab Source Code Disclosure | ||
14 | * Agreement ("Agreement") previously entered between you and Linden | ||
15 | * Lab. By accessing, using, copying, modifying or distributing this | ||
16 | * software, you acknowledge that you have been informed of your | ||
17 | * obligations under the Agreement and agree to abide by those obligations. | ||
18 | * | ||
19 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
20 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
21 | * COMPLETENESS OR PERFORMANCE. | ||
22 | * $/LicenseInfo$ | ||
23 | */ | ||
24 | |||
25 | #include "llviewerprecompiledheaders.h" | ||
26 | |||
27 | #include "llfloaterclassified.h" | ||
28 | |||
29 | // viewer project includes | ||
30 | #include "llcommandhandler.h" | ||
31 | #include "llpanelclassified.h" | ||
32 | #include "llvieweruictrlfactory.h" | ||
33 | |||
34 | // linden library includes | ||
35 | #include "lluuid.h" | ||
36 | |||
37 | //----------------------------------------------------------------------------- | ||
38 | // Globals | ||
39 | //----------------------------------------------------------------------------- | ||
40 | |||
41 | LLMap< const LLUUID, LLFloaterClassifiedInfo* > gClassifiedInfoInstances; | ||
42 | //////////////////////////////////////////////////////////////////////////// | ||
43 | // LLFloaterEventDisplay | ||
44 | |||
45 | class LLClassifiedHandler : public LLCommandHandler | ||
46 | { | ||
47 | public: | ||
48 | LLClassifiedHandler() : LLCommandHandler("classified") { } | ||
49 | bool handle(const std::vector<std::string>& tokens) | ||
50 | { | ||
51 | if (tokens.size() < 2) | ||
52 | { | ||
53 | return false; | ||
54 | } | ||
55 | LLUUID classified_id; | ||
56 | if (!classified_id.set(tokens[0], FALSE)) | ||
57 | { | ||
58 | return false; | ||
59 | } | ||
60 | |||
61 | if (tokens[1] == "about") | ||
62 | { | ||
63 | LLFloaterClassifiedInfo::show(classified_id); | ||
64 | return true; | ||
65 | } | ||
66 | return false; | ||
67 | } | ||
68 | }; | ||
69 | LLClassifiedHandler gClassifiedHandler; | ||
70 | |||
71 | LLFloaterClassifiedInfo::LLFloaterClassifiedInfo(const std::string& name, const LLUUID &id) | ||
72 | : LLFloater(name), | ||
73 | mClassifiedID( id ) | ||
74 | { | ||
75 | mFactoryMap["classified_details_panel"] = LLCallbackMap(LLFloaterClassifiedInfo::createClassifiedDetail, this); | ||
76 | gUICtrlFactory->buildFloater(this, "floater_preview_classified.xml", &getFactoryMap()); | ||
77 | gClassifiedInfoInstances.addData(id, this); | ||
78 | } | ||
79 | |||
80 | LLFloaterClassifiedInfo::~LLFloaterClassifiedInfo() | ||
81 | { | ||
82 | // child views automatically deleted | ||
83 | gClassifiedInfoInstances.removeData(mClassifiedID); | ||
84 | |||
85 | } | ||
86 | |||
87 | void LLFloaterClassifiedInfo::displayClassifiedInfo(const LLUUID& classified_id) | ||
88 | { | ||
89 | mClassifiedPanel->setClassifiedID(classified_id); | ||
90 | mClassifiedPanel->sendClassifiedInfoRequest(); | ||
91 | this->setFrontmost(true); | ||
92 | } | ||
93 | |||
94 | // static | ||
95 | void* LLFloaterClassifiedInfo::createClassifiedDetail(void* userdata) | ||
96 | { | ||
97 | LLFloaterClassifiedInfo *self = (LLFloaterClassifiedInfo*)userdata; | ||
98 | self->mClassifiedPanel = new LLPanelClassified(TRUE, TRUE); | ||
99 | self->mClassifiedPanel->childSetValue("classified_url", self->mClassifiedID); | ||
100 | return self->mClassifiedPanel; | ||
101 | } | ||
102 | |||
103 | // static | ||
104 | LLFloaterClassifiedInfo* LLFloaterClassifiedInfo::show(const LLUUID &classified_id) | ||
105 | { | ||
106 | if (classified_id.isNull()) | ||
107 | { | ||
108 | return NULL; | ||
109 | } | ||
110 | |||
111 | LLFloaterClassifiedInfo *floater; | ||
112 | if (gClassifiedInfoInstances.checkData(classified_id)) | ||
113 | { | ||
114 | // ...bring that window to front | ||
115 | floater = gClassifiedInfoInstances.getData(classified_id); | ||
116 | floater->open(); /*Flawfinder: ignore*/ | ||
117 | floater->setFrontmost(true); | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | floater = new LLFloaterClassifiedInfo("calssifiedinfo", classified_id ); | ||
122 | floater->center(); | ||
123 | floater->open(); /*Flawfinder: ignore*/ | ||
124 | floater->displayClassifiedInfo(classified_id); | ||
125 | floater->setFrontmost(true); | ||
126 | } | ||
127 | |||
128 | return floater; | ||
129 | } | ||
130 | |||
131 | |||