diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llpanelmsgs.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelmsgs.cpp')
-rw-r--r-- | linden/indra/newview/llpanelmsgs.cpp | 132 |
1 files changed, 69 insertions, 63 deletions
diff --git a/linden/indra/newview/llpanelmsgs.cpp b/linden/indra/newview/llpanelmsgs.cpp index 065bbdd..e0b1052 100644 --- a/linden/indra/newview/llpanelmsgs.cpp +++ b/linden/indra/newview/llpanelmsgs.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -41,9 +42,7 @@ | |||
41 | 42 | ||
42 | //----------------------------------------------------------------------------- | 43 | //----------------------------------------------------------------------------- |
43 | LLPanelMsgs::LLPanelMsgs() : | 44 | LLPanelMsgs::LLPanelMsgs() : |
44 | LLPanel(std::string("Messages Panel")), | 45 | LLPanel("Messages Panel") |
45 | mDisabledPopups( NULL ), | ||
46 | mEnabledPopups( NULL ) | ||
47 | { | 46 | { |
48 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml"); | 47 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml"); |
49 | } | 48 | } |
@@ -57,8 +56,6 @@ LLPanelMsgs::~LLPanelMsgs() | |||
57 | //----------------------------------------------------------------------------- | 56 | //----------------------------------------------------------------------------- |
58 | BOOL LLPanelMsgs::postBuild() | 57 | BOOL LLPanelMsgs::postBuild() |
59 | { | 58 | { |
60 | mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups"); | ||
61 | mEnabledPopups = getChild<LLScrollListCtrl>("enabled_popups"); | ||
62 | childSetAction("enable_popup", onClickEnablePopup, this); | 59 | childSetAction("enable_popup", onClickEnablePopup, this); |
63 | childSetAction("reset_dialogs_btn", onClickResetDialogs, this); | 60 | childSetAction("reset_dialogs_btn", onClickResetDialogs, this); |
64 | childSetAction("skip_dialogs_btn", onClickSkipDialogs, this); | 61 | childSetAction("skip_dialogs_btn", onClickSkipDialogs, this); |
@@ -73,68 +70,73 @@ BOOL LLPanelMsgs::postBuild() | |||
73 | 70 | ||
74 | void LLPanelMsgs::buildLists() | 71 | void LLPanelMsgs::buildLists() |
75 | { | 72 | { |
76 | if ( mDisabledPopups ) | 73 | LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups"); |
77 | mDisabledPopups->deleteAllItems(); | 74 | LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups"); |
78 | 75 | ||
79 | if ( mEnabledPopups ) | 76 | disabled_popups.deleteAllItems(); |
80 | mEnabledPopups->deleteAllItems(); | 77 | enabled_popups.deleteAllItems(); |
81 | 78 | ||
82 | for (LLAlertDialog::template_map_t::iterator iter = LLAlertDialog::sIgnorableTemplates.begin(); | 79 | for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); |
83 | iter != LLAlertDialog::sIgnorableTemplates.end(); ++iter) | 80 | iter != LLNotifications::instance().templatesEnd(); |
81 | ++iter) | ||
84 | { | 82 | { |
85 | LLAlertDialogTemplate* alert_temp = iter->second; | 83 | LLNotificationTemplatePtr templatep = iter->second; |
86 | S32 ignore = alert_temp->getIgnore(); | 84 | LLNotificationFormPtr formp = templatep->mForm; |
85 | |||
86 | LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); | ||
87 | if (ignore == LLNotificationForm::IGNORE_NO) | ||
88 | continue; | ||
87 | 89 | ||
88 | LLSD row; | 90 | LLSD row; |
89 | row["columns"][0]["value"] = alert_temp->mIgnoreListText; | 91 | row["columns"][0]["value"] = formp->getIgnoreMessage(); |
90 | row["columns"][0]["font"] = "SANSSERIF_SMALL"; | 92 | row["columns"][0]["font"] = "SANSSERIF_SMALL"; |
91 | row["columns"][0]["width"] = 300; | 93 | row["columns"][0]["width"] = 300; |
92 | 94 | ||
93 | LLScrollListItem* item = NULL; | 95 | LLScrollListItem* item = NULL; |
94 | 96 | ||
95 | 97 | bool show_popup = gSavedSettings.getWarning(templatep->mName); | |
96 | if (ignore) | 98 | if (!show_popup) |
97 | { | 99 | { |
98 | if (ignore == LLAlertDialog::IGNORE_USE_SAVED) | 100 | if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) |
99 | { | 101 | { |
100 | S32 arg = LLUI::sConfigGroup->getS32("Default" + alert_temp->mIgnoreLabel); | 102 | LLSD last_response = LLUI::sConfigGroup->getLLSD("Default" + templatep->mName); |
101 | row["columns"][1]["value"] = alert_temp->mOptionDefaultText[arg]; | 103 | if (!last_response.isUndefined()) |
104 | { | ||
105 | for (LLSD::map_const_iterator it = last_response.beginMap(); | ||
106 | it != last_response.endMap(); | ||
107 | ++it) | ||
108 | { | ||
109 | if (it->second.asBoolean()) | ||
110 | { | ||
111 | row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); | ||
112 | break; | ||
113 | } | ||
114 | } | ||
115 | } | ||
102 | row["columns"][1]["font"] = "SANSSERIF_SMALL"; | 116 | row["columns"][1]["font"] = "SANSSERIF_SMALL"; |
103 | row["columns"][1]["width"] = 160; | 117 | row["columns"][1]["width"] = 160; |
104 | } | 118 | } |
105 | if (mDisabledPopups) | 119 | item = disabled_popups.addElement(row, |
106 | { | 120 | ADD_SORTED); |
107 | item = mDisabledPopups->addElement(row, | ||
108 | ADD_SORTED); | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | llwarns << "(ignore) but also (!mDisabledPopups)" << llendl; | ||
113 | } | ||
114 | } | 121 | } |
115 | else | 122 | else |
116 | { | 123 | { |
117 | if (mEnabledPopups) | 124 | item = enabled_popups.addElement(row, |
118 | { | 125 | ADD_SORTED); |
119 | item = mEnabledPopups->addElement(row, | ||
120 | ADD_SORTED); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | llwarns << "(!ignore) but also (!mEnabledPopups)" << llendl; | ||
125 | } | ||
126 | } | 126 | } |
127 | 127 | ||
128 | if (item) | 128 | if (item) |
129 | { | 129 | { |
130 | item->setUserdata((void*)&iter->first); | 130 | item->setUserdata((void*)&iter->first); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | void LLPanelMsgs::draw() | 135 | void LLPanelMsgs::draw() |
136 | { | 136 | { |
137 | if (mDisabledPopups->getFirstSelected()) | 137 | LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups"); |
138 | |||
139 | if (disabled_popups.getFirstSelected()) | ||
138 | { | 140 | { |
139 | childEnable("enable_popup"); | 141 | childEnable("enable_popup"); |
140 | } | 142 | } |
@@ -160,23 +162,27 @@ void LLPanelMsgs::cancel() | |||
160 | 162 | ||
161 | void LLPanelMsgs::resetAllIgnored() | 163 | void LLPanelMsgs::resetAllIgnored() |
162 | { | 164 | { |
163 | for(LLAlertDialog::template_map_t::iterator iter = LLAlertDialog::sIgnorableTemplates.begin(); | 165 | for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); |
164 | iter != LLAlertDialog::sIgnorableTemplates.end(); ++iter) | 166 | iter != LLNotifications::instance().templatesEnd(); |
167 | ++iter) | ||
165 | { | 168 | { |
166 | LLAlertDialogTemplate* alert_temp = iter->second; | 169 | if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) |
167 | S32 ignore = alert_temp->getIgnore(); | 170 | { |
168 | if(ignore) | 171 | gSavedSettings.setWarning(iter->first, TRUE); |
169 | alert_temp->setIgnore(false); | 172 | } |
170 | } | 173 | } |
171 | } | 174 | } |
172 | 175 | ||
173 | void LLPanelMsgs::setAllIgnored() | 176 | void LLPanelMsgs::setAllIgnored() |
174 | { | 177 | { |
175 | for(LLAlertDialog::template_map_t::iterator iter = LLAlertDialog::sIgnorableTemplates.begin(); | 178 | for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); |
176 | iter != LLAlertDialog::sIgnorableTemplates.end(); ++iter) | 179 | iter != LLNotifications::instance().templatesEnd(); |
180 | ++iter) | ||
177 | { | 181 | { |
178 | LLAlertDialogTemplate* alert_temp = iter->second; | 182 | if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) |
179 | alert_temp->setIgnore(true); | 183 | { |
184 | gSavedSettings.setWarning(iter->first, FALSE); | ||
185 | } | ||
180 | } | 186 | } |
181 | } | 187 | } |
182 | 188 | ||
@@ -185,26 +191,24 @@ void LLPanelMsgs::onClickEnablePopup(void* user_data) | |||
185 | { | 191 | { |
186 | LLPanelMsgs* panelp = (LLPanelMsgs*)user_data; | 192 | LLPanelMsgs* panelp = (LLPanelMsgs*)user_data; |
187 | 193 | ||
188 | std::vector<LLScrollListItem*> items = panelp->mDisabledPopups->getAllSelected(); | 194 | LLScrollListCtrl& disabled_popups = panelp->getChildRef<LLScrollListCtrl>("disabled_popups"); |
195 | |||
196 | std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected(); | ||
189 | std::vector<LLScrollListItem*>::iterator itor; | 197 | std::vector<LLScrollListItem*>::iterator itor; |
190 | for (itor = items.begin(); itor != items.end(); ++itor) | 198 | for (itor = items.begin(); itor != items.end(); ++itor) |
191 | { | 199 | { |
192 | LLAlertDialog::template_map_t::iterator found_alert = LLAlertDialog::sAlertTemplates.find(*(std::string*)((*itor)->getUserdata())); | 200 | LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); |
193 | if (found_alert != LLAlertDialog::sAlertTemplates.end()) | 201 | gSavedSettings.setWarning(templatep->mName, TRUE); |
194 | { | ||
195 | LLAlertDialogTemplate* alert_temp = LLAlertDialog::sAlertTemplates[*(std::string*)((*itor)->getUserdata())]; | ||
196 | gSavedSettings.setWarning(alert_temp->mIgnoreLabel, TRUE); | ||
197 | } | ||
198 | } | 202 | } |
199 | 203 | ||
200 | panelp->buildLists(); | 204 | panelp->buildLists(); |
201 | } | 205 | } |
202 | 206 | ||
203 | void callback_reset_dialogs(S32 option, void* data) | 207 | bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp) |
204 | { | 208 | { |
209 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
205 | if (0 == option) | 210 | if (0 == option) |
206 | { | 211 | { |
207 | LLPanelMsgs* panelp = (LLPanelMsgs*)data; | ||
208 | if ( panelp ) | 212 | if ( panelp ) |
209 | { | 213 | { |
210 | panelp->resetAllIgnored(); | 214 | panelp->resetAllIgnored(); |
@@ -212,19 +216,20 @@ void callback_reset_dialogs(S32 option, void* data) | |||
212 | panelp->buildLists(); | 216 | panelp->buildLists(); |
213 | } | 217 | } |
214 | } | 218 | } |
219 | return false; | ||
215 | } | 220 | } |
216 | 221 | ||
217 | // static | 222 | // static |
218 | void LLPanelMsgs::onClickResetDialogs(void* user_data) | 223 | void LLPanelMsgs::onClickResetDialogs(void* user_data) |
219 | { | 224 | { |
220 | gViewerWindow->alertXml("ResetShowNextTimeDialogs",callback_reset_dialogs,user_data); | 225 | LLNotifications::instance().add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, (LLPanelMsgs*)user_data)); |
221 | } | 226 | } |
222 | 227 | ||
223 | void callback_skip_dialogs(S32 option, void* data) | 228 | bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp) |
224 | { | 229 | { |
230 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
225 | if (0 == option) | 231 | if (0 == option) |
226 | { | 232 | { |
227 | LLPanelMsgs* panelp = (LLPanelMsgs*)data; | ||
228 | if ( panelp ) | 233 | if ( panelp ) |
229 | { | 234 | { |
230 | panelp->setAllIgnored(); | 235 | panelp->setAllIgnored(); |
@@ -232,10 +237,11 @@ void callback_skip_dialogs(S32 option, void* data) | |||
232 | panelp->buildLists(); | 237 | panelp->buildLists(); |
233 | } | 238 | } |
234 | } | 239 | } |
240 | return false; | ||
235 | } | 241 | } |
236 | 242 | ||
237 | // static | 243 | // static |
238 | void LLPanelMsgs::onClickSkipDialogs(void* user_data) | 244 | void LLPanelMsgs::onClickSkipDialogs(void* user_data) |
239 | { | 245 | { |
240 | gViewerWindow->alertXml("SkipShowNextTimeDialogs", callback_skip_dialogs, user_data); | 246 | LLNotifications::instance().add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, (LLPanelMsgs*)user_data)); |
241 | } | 247 | } |