aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelmsgs.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpanelmsgs.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llpanelmsgs.cpp')
-rw-r--r--linden/indra/newview/llpanelmsgs.cpp148
1 files changed, 148 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelmsgs.cpp b/linden/indra/newview/llpanelmsgs.cpp
new file mode 100644
index 0000000..08ba343
--- /dev/null
+++ b/linden/indra/newview/llpanelmsgs.cpp
@@ -0,0 +1,148 @@
1/**
2 * @file llpanelmsgs.cpp
3 * @brief Message popup preferences panel
4 *
5 * Copyright (c) 2003-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#include "llviewerprecompiledheaders.h"
29
30#include "llpanelmsgs.h"
31
32#include "llscrolllistctrl.h"
33#include "llviewerwindow.h"
34#include "llviewercontrol.h"
35#include "llvieweruictrlfactory.h"
36
37
38//-----------------------------------------------------------------------------
39LLPanelMsgs::LLPanelMsgs() :
40 LLPanel("Messages Panel"),
41 mDisabledPopups( 0 ),
42 mEnabledPopups( 0 )
43{
44};
45
46//-----------------------------------------------------------------------------
47// postBuild()
48//-----------------------------------------------------------------------------
49BOOL LLPanelMsgs::postBuild()
50{
51 mDisabledPopups = LLViewerUICtrlFactory::getScrollListByName(this, "disabled_popups");
52 mEnabledPopups = LLViewerUICtrlFactory::getScrollListByName(this, "enabled_popups");
53 childSetAction("enable_popup", onClickEnablePopup, this);
54 childSetAction("reset_dialogs_btn", onClickResetDialogs, this);
55 buildLists();
56 return TRUE;
57}
58
59void LLPanelMsgs::buildLists()
60{
61 if ( mDisabledPopups )
62 mDisabledPopups->deleteAllItems();
63
64 if ( mEnabledPopups )
65 mEnabledPopups->deleteAllItems();
66
67 for (LLAlertDialog::template_map_t::iterator iter = LLAlertDialog::sIgnorableTemplates.begin();
68 iter != LLAlertDialog::sIgnorableTemplates.end(); ++iter)
69 {
70 LLAlertDialogTemplate* alert_temp = iter->second;
71 S32 ignore = alert_temp->getIgnore();
72 LLScrollListItem* item = new LLScrollListItem();
73 item->setUserdata((void*)&iter->first);
74 item->addColumn(alert_temp->mIgnoreListText, LLFontGL::sSansSerifSmall, 300);
75 if (ignore)
76 {
77 if (ignore == LLAlertDialog::IGNORE_USE_SAVED)
78 {
79 S32 arg = LLUI::sConfigGroup->getS32("Default" + alert_temp->mIgnoreLabel);
80 item->addColumn(alert_temp->mOptionDefaultText[arg], LLFontGL::sSansSerifSmall, 160);
81 }
82 mDisabledPopups->addItem(item, ADD_SORTED);
83 }
84 else
85 {
86 mEnabledPopups->addItem(item, ADD_SORTED);
87 }
88 }
89}
90
91void LLPanelMsgs::draw()
92{
93 if (mDisabledPopups->getFirstSelected())
94 {
95 childEnable("enable_popup");
96 }
97 else
98 {
99 childDisable("enable_popup");
100 }
101
102 LLPanel::draw();
103}
104
105void LLPanelMsgs::apply()
106{
107}
108
109void LLPanelMsgs::cancel()
110{
111}
112
113//static
114void LLPanelMsgs::onClickEnablePopup(void* user_data)
115{
116 LLPanelMsgs* panelp = (LLPanelMsgs*)user_data;
117
118 std::vector<LLScrollListItem*> items = panelp->mDisabledPopups->getAllSelected();
119 std::vector<LLScrollListItem*>::iterator itor;
120 for (itor = items.begin(); itor != items.end(); ++itor)
121 {
122 LLAlertDialog::template_map_t::iterator found_alert = LLAlertDialog::sAlertTemplates.find(*(LLString*)((*itor)->getUserdata()));
123 if (found_alert != LLAlertDialog::sAlertTemplates.end())
124 {
125 LLAlertDialogTemplate* alert_temp = LLAlertDialog::sAlertTemplates[*(LLString*)((*itor)->getUserdata())];
126 gSavedSettings.setWarning(alert_temp->mIgnoreLabel, TRUE);
127 }
128 }
129
130 panelp->buildLists();
131}
132
133void callback_reset_dialogs(S32 option, void* data)
134{
135 if (0 == option)
136 {
137 gSavedSettings.resetWarnings(); // resets all ignorable dialogs
138 LLPanelMsgs* panelp = (LLPanelMsgs*)data;
139 if ( panelp )
140 panelp->buildLists();
141 }
142}
143
144// static
145void LLPanelMsgs::onClickResetDialogs(void* user_data)
146{
147 gViewerWindow->alertXml("ResetShowNextTimeDialogs",callback_reset_dialogs,user_data);
148}