summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_options.h
blob: 5a85edea61e18e9bd4d9b5d4d5dc3b976b3c2e7e (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef _TOX_OPTIONS_H_
#define _TOX_OPTIONS_H_

class CToxOptionsMain : public CToxDlgBase
{
private:
	typedef CToxDlgBase CSuper;

	CCtrlEdit m_toxAddress;
	CCtrlButton m_toxAddressCopy;
	CCtrlButton m_profileCreate;
	CCtrlButton m_profileImport;
	CCtrlButton m_profileExport;

	CCtrlEdit m_nickname;
	CCtrlEdit m_group;

	CCtrlButton m_passwordCreate;
	CCtrlButton m_passwordChange;
	CCtrlButton m_passwordRemove;

	CCtrlCheck m_enableUdp;
	CCtrlCheck m_enableUdpHolePunching;
	CCtrlCheck m_enableIPv6;
	CCtrlCheck m_enableLocalDiscovery;

	CCtrlEdit m_maxConnectRetries;
	CCtrlSpin m_maxConnectRetriesSpin;
	CCtrlEdit m_maxReconnectRetries;
	CCtrlSpin m_maxReconnectRetriesSpin;

protected:
	void OnInitDialog();

	void PasswordCreate_OnClick(CCtrlButton*);
	void PasswordChange_OnClick(CCtrlButton*);
	void PasswordRemove_OnClick(CCtrlButton*);

	void EnableUdp_OnClick(CCtrlBase*);

	void ToxAddressCopy_OnClick(CCtrlButton*);
	void ProfileCreate_OnClick(CCtrlButton*);
	void ProfileImport_OnClick(CCtrlButton*);
	void ProfileExport_OnClick(CCtrlButton*);

	void OnApply();

public:
	CToxOptionsMain(CToxProto *proto, int idDialog);

	static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
	{
		CToxOptionsMain *page = new CToxOptionsMain((CToxProto*)param, IDD_ACCOUNT_MANAGER);
		page->SetParent(owner);
		page->Show();
		return page;
	}

	static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsMain((CToxProto*)param, IDD_OPTIONS_MAIN); }
};

/////////////////////////////////////////////////////////////////////////////////

class CToxNodeEditor : public CDlgBase
{
private:
	typedef CDlgBase CSuper;

	int m_iItem;
	CCtrlListView *m_list;

	CCtrlEdit m_ipv4;
	CCtrlEdit m_ipv6;
	CCtrlEdit m_port;
	CCtrlEdit m_pkey;

	CCtrlButton m_ok;

protected:
	void OnInitDialog();
	void OnOk(CCtrlBase*);
	void OnClose();

public:
	CToxNodeEditor(int iItem, CCtrlListView *m_list);
};

/****************************************/

class CCtrlNodeList : public CCtrlListView
{
private:
	typedef CCtrlListView CSuper;

protected:
	BOOL OnNotify(int idCtrl, NMHDR *pnmh);

public:
	CCtrlNodeList(CDlgBase* dlg, int ctrlId);

	CCallback<TEventInfo> OnClick;
};

/****************************************/

class CToxOptionsNodeList : public CToxDlgBase
{
private:
	typedef CToxDlgBase CSuper;

	CCtrlNodeList m_nodes;
	CCtrlButton m_addNode;
	CCtrlButton m_updateNodes;

protected:
	void OnInitDialog();
	void OnApply();

	void ReloadNodeList();

	void OnAddNode(CCtrlBase*);
	void OnUpdateNodes(CCtrlBase*);
	void OnNodeListDoubleClick(CCtrlBase*);
	void OnNodeListClick(CCtrlListView::TEventInfo *evt);
	void OnNodeListKeyDown(CCtrlListView::TEventInfo *evt);

public:
	CToxOptionsNodeList(CToxProto *proto);

	static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsNodeList((CToxProto*)param); }
};

#endif //_TOX_OPTIONS_H_