summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-30 13:57:53 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-30 13:57:53 +0000
commitf65741787bee7c5d143d733efb32b7ec3452edc6 (patch)
treeabde66c5c4b96e96dbcc9c0b66906d0ba989e2d4
parent98ef126036ee5fdef2155dc15e4e08a7f7eaf534 (diff)
Steam: fixed options
git-svn-id: http://svn.miranda-ng.org/main/trunk@14457 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/src/stdafx.h1
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp84
-rw-r--r--protocols/Steam/src/steam_dialogs.h53
-rw-r--r--protocols/Steam/src/steam_events.cpp4
-rw-r--r--protocols/Steam/src/steam_options.cpp69
-rw-r--r--protocols/Steam/src/steam_options.h32
-rw-r--r--protocols/Steam/src/steam_proto.h1
7 files changed, 107 insertions, 137 deletions
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index e0a3b694a6..71db9d6561 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -54,6 +54,7 @@ extern HANDLE hExtraXStatus;
#define STEAM_WEB_URL "https://steamcommunity.com"
#include "steam_dialogs.h"
+#include "steam_options.h"
#include "http_request.h"
#include "request_queue.h"
#include "api\authorization.h"
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp
index 3e768f982d..be88b7c86e 100644
--- a/protocols/Steam/src/steam_dialogs.cpp
+++ b/protocols/Steam/src/steam_dialogs.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
-CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto) :
- CSuper(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
+CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto)
+ : CSteamDlgBase(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
{
m_ok.OnClick = Callback(this, &CSteamPasswordEditor::OnOk);
@@ -37,8 +37,8 @@ void CSteamPasswordEditor::OnClose()
/////////////////////////////////////////////////////////////////////////////////
-CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) :
- CSuper(proto, IDD_GUARD, false), m_ok(this, IDOK),
+CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain)
+ : CSteamDlgBase(proto, IDD_GUARD, false), m_ok(this, IDOK),
m_text(this, IDC_TEXT), m_link(this, IDC_GETDOMAIN, domain)
{
mir_strcpy(m_domain, domain);
@@ -75,8 +75,8 @@ const char* CSteamGuardDialog::GetGuardCode()
/////////////////////////////////////////////////////////////////////////////////
-CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize) :
- CSuper(proto, IDD_CAPTCHA, false),
+CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize)
+ : CSteamDlgBase(proto, IDD_CAPTCHA, false),
m_ok(this, IDOK), m_text(this, IDC_TEXT),
m_captchaImage(NULL)
{
@@ -158,81 +158,11 @@ INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
- CSuper::DlgProc(msg, wParam, lParam);
+ CSteamDlgBase::DlgProc(msg, wParam, lParam);
return FALSE;
}
const char* CSteamCaptchaDialog::GetCaptchaText()
{
return m_captchaText;
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-
-CSteamOptionsMain::CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent)
- : CSuper(proto, idDialog, false),
- m_username(this, IDC_USERNAME), m_password(this, IDC_PASSWORD),
- m_group(this, IDC_GROUP), m_biggerAvatars(this, IDC_BIGGER_AVATARS)
-{
- SetParent(hwndParent);
-
- CreateLink(m_username, "Username", _T(""));
- CreateLink(m_password, "Password", _T(""));
- CreateLink(m_group, "DefaultGroup", _T("Steam"));
- CreateLink(m_biggerAvatars, "UseBigAvatars", FALSE);
-}
-
-void CSteamOptionsMain::OnInitDialog()
-{
- CSuper::OnInitDialog();
-
- SendMessage(m_username.GetHwnd(), EM_LIMITTEXT, 64, 0);
- SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 64, 0);
- SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
-}
-
-void CSteamOptionsMain::OnApply()
-{
- TCHAR *group = m_group.GetText();
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
- Clist_CreateGroup(0, group);
-
- if (m_proto->IsOnline())
- {
- // may be we should show message box with warning?
- m_proto->SetStatus(ID_STATUS_OFFLINE);
- }
- if (m_username.IsChanged())
- {
- m_proto->delSetting("SteamID");
- m_proto->delSetting("TokenSecret");
- }
- if (m_password.IsChanged())
- {
- m_proto->delSetting("TokenSecret");
- }
- mir_free(group);
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-
-CSteamOptionsBlockList::CSteamOptionsBlockList(CSteamProto *proto)
- : CSuper(proto, IDD_OPT_BLOCK_LIST, false),
- m_list(this, IDC_LIST),
- m_contacts(this, IDC_CONTACTS),
- m_add(this, IDC_BLOCK)
-{
- m_add.OnClick = Callback(this, &CSteamOptionsBlockList::OnBlock);
-}
-
-void CSteamOptionsBlockList::OnInitDialog()
-{
- m_list.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
-
- m_list.AddColumn(0, TranslateT("Name"), 220);
- m_list.AddColumn(1, _T(""), 32 - GetSystemMetrics(SM_CXVSCROLL));
-}
-
-void CSteamOptionsBlockList::OnBlock(CCtrlButton*)
-{
} \ No newline at end of file
diff --git a/protocols/Steam/src/steam_dialogs.h b/protocols/Steam/src/steam_dialogs.h
index 233887d0fc..21cc2e2033 100644
--- a/protocols/Steam/src/steam_dialogs.h
+++ b/protocols/Steam/src/steam_dialogs.h
@@ -8,8 +8,6 @@ typedef CProtoDlgBase<CSteamProto> CSteamDlgBase;
class CSteamPasswordEditor : public CSteamDlgBase
{
private:
- typedef CSteamDlgBase CSuper;
-
CCtrlEdit m_password;
CCtrlCheck m_savePermanently;
@@ -29,8 +27,6 @@ public:
class CSteamGuardDialog : public CSteamDlgBase
{
private:
- typedef CSteamDlgBase CSuper;
-
char m_domain[32];
char m_guardCode[5];
@@ -54,8 +50,6 @@ public:
class CSteamCaptchaDialog : public CSteamDlgBase
{
private:
- typedef CSteamDlgBase CSuper;
-
char m_captchaText[6];
BYTE *m_captchaImage;
@@ -78,51 +72,4 @@ public:
const char *GetCaptchaText();
};
-/////////////////////////////////////////////////////////////////////////////////
-
-class CSteamOptionsMain : public CSteamDlgBase
-{
-private:
- typedef CSteamDlgBase CSuper;
-
- CCtrlEdit m_username;
- CCtrlEdit m_password;
- CCtrlEdit m_group;
-
- CCtrlCheck m_biggerAvatars;
-
-protected:
- void OnInitDialog();
- void OnApply();
-
-public:
- CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent = NULL);
-
- static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
- {
- CSteamOptionsMain *page = new CSteamOptionsMain((CSteamProto*)param, IDD_ACCMGR, owner);
- page->Show();
- return page;
- }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-class CSteamOptionsBlockList : public CSteamDlgBase
-{
-private:
- typedef CSteamDlgBase CSuper;
-
- CCtrlListView m_list;
- CCtrlCombo m_contacts;
- CCtrlButton m_add;
-
-public:
- CSteamOptionsBlockList(CSteamProto *proto);
-
-protected:
- void OnInitDialog();
- void OnBlock(CCtrlButton*);
-};
-
#endif //_STEAM_DIALOGS_H_ \ No newline at end of file
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp
index 2e91508915..69dc630b86 100644
--- a/protocols/Steam/src/steam_events.cpp
+++ b/protocols/Steam/src/steam_events.cpp
@@ -30,11 +30,11 @@ int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM)
odp.ptszGroup = LPGENT("Network");
odp.ptszTab = LPGENT("Account");
- odp.pDialog = new CSteamOptionsMain(this, IDD_OPT_MAIN);
+ odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Blocked contacts");
- odp.pDialog = new CSteamOptionsBlockList(this);
+ odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp
new file mode 100644
index 0000000000..4f5a2a8dcd
--- /dev/null
+++ b/protocols/Steam/src/steam_options.cpp
@@ -0,0 +1,69 @@
+#include "stdafx.h"
+
+CSteamOptionsMain::CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent)
+ : CSteamDlgBase(proto, idDialog, false),
+ m_username(this, IDC_USERNAME), m_password(this, IDC_PASSWORD),
+ m_group(this, IDC_GROUP), m_biggerAvatars(this, IDC_BIGGER_AVATARS)
+{
+ SetParent(hwndParent);
+
+ CreateLink(m_username, "Username", _T(""));
+ CreateLink(m_password, "Password", _T(""));
+ CreateLink(m_group, "DefaultGroup", _T("Steam"));
+ CreateLink(m_biggerAvatars, "UseBigAvatars", DBVT_BYTE, FALSE);
+}
+
+void CSteamOptionsMain::OnInitDialog()
+{
+ CSteamDlgBase::OnInitDialog();
+
+ SendMessage(m_username.GetHwnd(), EM_LIMITTEXT, 64, 0);
+ SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 64, 0);
+ SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
+}
+
+void CSteamOptionsMain::OnApply()
+{
+ TCHAR *group = m_group.GetText();
+ if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ Clist_CreateGroup(0, group);
+
+ if (m_proto->IsOnline())
+ {
+ // may be we should show message box with warning?
+ m_proto->SetStatus(ID_STATUS_OFFLINE);
+ }
+ if (m_username.IsChanged())
+ {
+ m_proto->delSetting("SteamID");
+ m_proto->delSetting("TokenSecret");
+ }
+ if (m_password.IsChanged())
+ {
+ m_proto->delSetting("TokenSecret");
+ }
+ mir_free(group);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+CSteamOptionsBlockList::CSteamOptionsBlockList(CSteamProto *proto)
+ : CSuper(proto, IDD_OPT_BLOCK_LIST, false),
+ m_list(this, IDC_LIST),
+ m_contacts(this, IDC_CONTACTS),
+ m_add(this, IDC_BLOCK)
+{
+ m_add.OnClick = Callback(this, &CSteamOptionsBlockList::OnBlock);
+}
+
+void CSteamOptionsBlockList::OnInitDialog()
+{
+ m_list.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
+
+ m_list.AddColumn(0, TranslateT("Name"), 220);
+ m_list.AddColumn(1, _T(""), 32 - GetSystemMetrics(SM_CXVSCROLL));
+}
+
+void CSteamOptionsBlockList::OnBlock(CCtrlButton*)
+{
+} \ No newline at end of file
diff --git a/protocols/Steam/src/steam_options.h b/protocols/Steam/src/steam_options.h
index a998cf0e6b..e06a0070ad 100644
--- a/protocols/Steam/src/steam_options.h
+++ b/protocols/Steam/src/steam_options.h
@@ -4,12 +4,12 @@
class CSteamOptionsMain : public CSteamDlgBase
{
private:
- typedef CSteamDlgBase CSuper;
-
- CCtrlEdit m_steamname;
+ CCtrlEdit m_username;
CCtrlEdit m_password;
CCtrlEdit m_group;
+ CCtrlCheck m_biggerAvatars;
+
protected:
CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent = NULL);
@@ -19,11 +19,33 @@ protected:
public:
static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
{
- CSteamOptionsMain *page = new CSteamOptionsMain((CSteamProto*)param, IDD_ACCOUNT_MANAGER, owner);
+ CSteamOptionsMain *page = new CSteamOptionsMain((CSteamProto*)param, IDD_ACCMGR, owner);
page->Show();
+ return page;
}
- static CDlgBase *CreateMainOptionsPage(void *param) { return new CSteamOptionsMain((CSteamProto*)param, IDD_OPTIONS_MAIN); }
+ static CDlgBase *CreateOptionsPage(void *param) { return new CSteamOptionsMain((CSteamProto*)param, IDD_OPT_MAIN); }
+};
+
+/////////////////////////////////////////////////////////////////////////////////
+
+class CSteamOptionsBlockList : public CSteamDlgBase
+{
+private:
+ typedef CSteamDlgBase CSuper;
+
+ CCtrlListView m_list;
+ CCtrlCombo m_contacts;
+ CCtrlButton m_add;
+
+protected:
+ void OnInitDialog();
+ void OnBlock(CCtrlButton*);
+
+public:
+ CSteamOptionsBlockList(CSteamProto *proto);
+
+ static CDlgBase *CreateOptionsPage(void *param) { return new CSteamOptionsBlockList((CSteamProto*)param); }
};
#endif //_STEAM_OPTIONS_H_ \ No newline at end of file
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index ef83b7dc14..c254d43865 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -35,6 +35,7 @@ class CSteamProto : public PROTO<CSteamProto>
{
friend CSteamPasswordEditor;
friend CSteamOptionsMain;
+ friend CSteamOptionsBlockList;
public:
// PROTO_INTERFACE