aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/floaterotr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/floaterotr.cpp')
-rw-r--r--linden/indra/newview/floaterotr.cpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/linden/indra/newview/floaterotr.cpp b/linden/indra/newview/floaterotr.cpp
new file mode 100644
index 0000000..a655fd7
--- /dev/null
+++ b/linden/indra/newview/floaterotr.cpp
@@ -0,0 +1,102 @@
1/**
2* @file floaterotr.cpp
3* @brief Custom OTR settings for meta-impy
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2011, David Seikel
8*
9* meta-impy Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*
30* Copied from floaterbusy.cpp, originally by McCabe Maxsted from Imprudence.
31*/
32
33#include "llviewerprecompiledheaders.h"
34
35#include "floaterotr.h"
36
37#include "llinventorymodel.h"
38#include "llstartup.h"
39#include "lltexteditor.h"
40#include "lluictrlfactory.h"
41#include "llviewercontrol.h"
42#include "llviewerinventory.h"
43#include "llweb.h"
44#include "otr_wrapper.h"
45
46FloaterOTR::FloaterOTR(const LLSD& seed) : LLFloater("floater_busy")
47{
48 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_otr_options.xml");
49}
50
51BOOL FloaterOTR::postBuild()
52{
53 childSetAction("btn_ok", onClickOK, this);
54 childSetAction("btn_cancel", onClickCancel, this);
55
56 childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR")));
57 childSetValue("EmeraldUseOTRInTypingStop", gSavedSettings.getBOOL("EmeraldUseOTRInTypingStop"));
58 getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this);
59
60 return TRUE;
61}
62
63FloaterOTR::~FloaterOTR()
64{
65}
66
67// static
68void FloaterOTR::onClickOK(void* userdata)
69{
70 FloaterOTR* self = (FloaterOTR*)userdata;
71 self->apply();
72 self->close();
73}
74
75// static
76void FloaterOTR::onClickCancel(void* userdata)
77{
78 FloaterOTR* self = (FloaterOTR*)userdata;
79 self->cancel();
80}
81
82void FloaterOTR::cancel()
83{
84 close();
85}
86
87void FloaterOTR::apply()
88{
89 U32 otrpref = childGetValue("EmeraldUseOTR").asReal();
90
91 gSavedSettings.setU32("EmeraldUseOTR", otrpref);
92 gSavedSettings.setBOOL("EmeraldUseOTRInTypingStop", childGetValue("EmeraldUseOTRInTypingStop").asBoolean());
93 // otrpref: 0 == Require OTR, 1 == Request OTR, 2 == Accept OTR, 3 == Decline OTR
94 if (3 == otrpref)
95 OTR_Wrapper::stopAll();
96}
97
98void FloaterOTR::onClickOtrHelp(void* userdata)
99{
100 LLWeb::loadURL("http://www.cypherpunks.ca/otr/");
101}
102