aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelskins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanelskins.cpp')
-rw-r--r--linden/indra/newview/llpanelskins.cpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelskins.cpp b/linden/indra/newview/llpanelskins.cpp
new file mode 100644
index 0000000..56c0694
--- /dev/null
+++ b/linden/indra/newview/llpanelskins.cpp
@@ -0,0 +1,109 @@
1/**
2 * @file llpanelskins.cpp
3 * @brief General preferences panel in preferences floater
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
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
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "llviewerprecompiledheaders.h"
33
34#include "llpanelskins.h"
35
36// linden library includes
37#include "llradiogroup.h"
38#include "llbutton.h"
39#include "lluictrlfactory.h"
40
41// project includes
42#include "llviewercontrol.h"
43#include "llviewerwindow.h"
44
45LLPanelSkins::LLPanelSkins()
46{
47 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_skins.xml");
48}
49
50LLPanelSkins::~LLPanelSkins()
51{
52}
53
54BOOL LLPanelSkins::postBuild()
55{
56 LLRadioGroup* skin_select = getChild<LLRadioGroup>("skin_selection");
57 skin_select->setCommitCallback(onSelectSkin);
58 skin_select->setCallbackUserData(this);
59
60 getChild<LLButton>("classic_preview")->setClickedCallback(onClickClassic, this);
61 getChild<LLButton>("silver_preview")->setClickedCallback(onClickSilver, this);
62
63 refresh();
64 return TRUE;
65}
66
67void LLPanelSkins::refresh()
68{
69 mSkin = gSavedSettings.getString("SkinCurrent");
70 getChild<LLRadioGroup>("skin_selection")->setValue(mSkin);
71}
72
73void LLPanelSkins::apply()
74{
75 if (mSkin != gSavedSettings.getString("SkinCurrent"))
76 {
77 gViewerWindow->alertXml("ChangeSkin");
78 refresh();
79 }
80}
81
82void LLPanelSkins::cancel()
83{
84 // reverts any changes to current skin
85 gSavedSettings.setString("SkinCurrent", mSkin);
86}
87
88//static
89void LLPanelSkins::onSelectSkin(LLUICtrl* ctrl, void* data)
90{
91 std::string skin_selection = ctrl->getValue().asString();
92 gSavedSettings.setString("SkinCurrent", skin_selection);
93}
94
95//static
96void LLPanelSkins::onClickClassic(void* data)
97{
98 LLPanelSkins* self = (LLPanelSkins*)data;
99 gSavedSettings.setString("SkinCurrent", "default");
100 self->getChild<LLRadioGroup>("skin_selection")->setValue("default");
101}
102
103//static
104void LLPanelSkins::onClickSilver(void* data)
105{
106 LLPanelSkins* self = (LLPanelSkins*)data;
107 gSavedSettings.setString("SkinCurrent", "silver");
108 self->getChild<LLRadioGroup>("skin_selection")->setValue("silver");
109}