1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*
* AuthenticationFloater.cpp
* Cross-grid authentication system view.
*
* Created by RMS on 7/1/08.
*
*/
#include "llviewerprecompiledheaders.h"
#include "authentication_floater.h"
#include "lluictrlfactory.h"
// Statics
AuthenticationFloater* AuthenticationFloater::sInstance = NULL;
AuthenticationController* AuthenticationFloater::sController = NULL;
AuthenticationFloater::AuthenticationFloater()
: LLFloater("floater_authentication")
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_authentication.xml");
childSetTextArg("Intro_text", "[TARGET_GRID]", sController->getTargetGrid());
childSetCommitCallback("User_edit", controller()->onCommitUser, this);
childSetCommitCallback("Password_edit", controller()->onCommitPassword, this);
childSetCommitCallback("Remember_check", controller()->onCommitRemember, this);
childSetAction("OK", controller()->onAccept, this);
childSetAction("Cancel", controller()->onCancel, this);
childSetAction("Register", controller()->onClickRegister, this);
setDefaultBtn("OK");
}
AuthenticationFloater::~AuthenticationFloater()
{
sInstance = NULL;
delete sController;
sController = NULL;
}
// static
void AuthenticationFloater::show(void* userdata)
{
std::string target_grid;
void (*cb)(void*) = NULL;
if (!userdata)
{
target_grid = "Authentication Test";
}
if (!sInstance)
sInstance = new AuthenticationFloater();
if (!sController)
sController = new AuthenticationController(target_grid, cb);
sInstance->open();
}
void AuthenticationFloater::accept()
{
llinfos << "accept" << llendl;
}
void AuthenticationFloater::cancel()
{
llinfos << "cancel" << llendl;
}
AuthenticationController* AuthenticationFloater::controller()
{
return sController;
}
|