diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-24 13:17:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-24 13:17:37 +0300 |
commit | 17a150659823dbcc7d03a026b1e36af2c17f2184 (patch) | |
tree | e6e8f5f74e61626c9d2b2adacf23cb0bed1a6860 /protocols/Steam/src | |
parent | 6461368c27087631355bd024a5a899cee6b2c623 (diff) |
Steam: UI code cleaning
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r-- | protocols/Steam/src/steam_dialogs.cpp | 50 | ||||
-rw-r--r-- | protocols/Steam/src/steam_dialogs.h | 31 |
2 files changed, 29 insertions, 52 deletions
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 68605a0eec..04be9594d7 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -1,10 +1,10 @@ #include "stdafx.h"
-CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto)
- : CSteamDlgBase(proto, IDD_PASSWORD_EDITOR), m_ok(this, IDOK),
- m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
+CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto) :
+ CSteamDlgBase(proto, IDD_PASSWORD_EDITOR),
+ m_password(this, IDC_PASSWORD),
+ m_savePermanently(this, IDC_SAVEPERMANENTLY)
{
- m_ok.OnClick = Callback(this, &CSteamPasswordEditor::OnOk);
}
bool CSteamPasswordEditor::OnInitDialog()
@@ -19,13 +19,13 @@ bool CSteamPasswordEditor::OnInitDialog() return true;
}
-void CSteamPasswordEditor::OnOk(CCtrlButton*)
+bool CSteamPasswordEditor::OnApply()
{
m_proto->m_password = m_password.GetText();
if (m_savePermanently.Enabled())
m_proto->setWString("Password", m_proto->m_password);
- EndDialog(m_hwnd, DIALOG_RESULT_OK);
+ return true;
}
bool CSteamPasswordEditor::OnClose()
@@ -36,15 +36,13 @@ bool CSteamPasswordEditor::OnClose() /////////////////////////////////////////////////////////////////////////////////
-CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain)
- : CSteamDlgBase(proto, IDD_GUARD),
- m_ok(this, IDOK),
+CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) :
+ CSteamDlgBase(proto, IDD_GUARD),
m_text(this, IDC_TEXT),
m_link(this, IDC_GETDOMAIN, domain)
{
memset(m_guardCode, 0, sizeof(m_guardCode));
mir_strcpy(m_domain, domain);
- m_ok.OnClick = Callback(this, &CSteamGuardDialog::OnOk);
}
bool CSteamGuardDialog::OnInitDialog()
@@ -59,10 +57,10 @@ bool CSteamGuardDialog::OnInitDialog() return true;
}
-void CSteamGuardDialog::OnOk(CCtrlButton*)
+bool CSteamGuardDialog::OnApply()
{
mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode));
- EndDialog(m_hwnd, DIALOG_RESULT_OK);
+ return true;
}
bool CSteamGuardDialog::OnClose()
@@ -71,20 +69,13 @@ bool CSteamGuardDialog::OnClose() return true;
}
-const char* CSteamGuardDialog::GetGuardCode()
-{
- return m_guardCode;
-}
-
/////////////////////////////////////////////////////////////////////////////////
-CSteamTwoFactorDialog::CSteamTwoFactorDialog(CSteamProto *proto)
-: CSteamDlgBase(proto, IDD_TWOFACTOR),
-m_ok(this, IDOK),
-m_text(this, IDC_TEXT)
+CSteamTwoFactorDialog::CSteamTwoFactorDialog(CSteamProto *proto) :
+ CSteamDlgBase(proto, IDD_TWOFACTOR),
+ m_text(this, IDC_TEXT)
{
memset(m_twoFactorCode, 0, sizeof(m_twoFactorCode));
- m_ok.OnClick = Callback(this, &CSteamTwoFactorDialog::OnOk);
}
bool CSteamTwoFactorDialog::OnInitDialog()
@@ -99,10 +90,11 @@ bool CSteamTwoFactorDialog::OnInitDialog() return true;
}
-void CSteamTwoFactorDialog::OnOk(CCtrlButton*)
+bool CSteamTwoFactorDialog::OnApply()
{
mir_strncpy(m_twoFactorCode, ptrA(m_text.GetTextA()), _countof(m_twoFactorCode));
- EndDialog(m_hwnd, DIALOG_RESULT_OK);
+ EndModal(DIALOG_RESULT_OK);
+ return true;
}
bool CSteamTwoFactorDialog::OnClose()
@@ -111,11 +103,6 @@ bool CSteamTwoFactorDialog::OnClose() return true;
}
-const char* CSteamTwoFactorDialog::GetTwoFactorCode()
-{
- return m_twoFactorCode;
-}
-
/////////////////////////////////////////////////////////////////////////////////
CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, const uint8_t *captchaImage, size_t captchaImageSize)
@@ -192,8 +179,3 @@ INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) CSteamDlgBase::DlgProc(msg, wParam, lParam);
return FALSE;
}
-
-const char* CSteamCaptchaDialog::GetCaptchaText()
-{
- return m_captchaText;
-}
diff --git a/protocols/Steam/src/steam_dialogs.h b/protocols/Steam/src/steam_dialogs.h index 231539229a..190c2504c5 100644 --- a/protocols/Steam/src/steam_dialogs.h +++ b/protocols/Steam/src/steam_dialogs.h @@ -9,18 +9,14 @@ typedef CProtoDlgBase<CSteamProto> CSteamDlgBase; class CSteamPasswordEditor : public CSteamDlgBase
{
-private:
CCtrlEdit m_password;
CCtrlCheck m_savePermanently;
- CCtrlButton m_ok;
-
protected:
bool OnInitDialog() override;
+ bool OnApply() override;
bool OnClose() override;
- void OnOk(CCtrlButton*);
-
public:
CSteamPasswordEditor(CSteamProto *proto);
};
@@ -29,53 +25,50 @@ public: class CSteamGuardDialog : public CSteamDlgBase
{
-private:
char m_domain[32];
char m_guardCode[6];
CCtrlEdit m_text;
- CCtrlButton m_ok;
CCtrlHyperlink m_link;
protected:
bool OnInitDialog() override;
+ bool OnApply() override;
bool OnClose() override;
- void OnOk(CCtrlButton*);
-
public:
CSteamGuardDialog(CSteamProto *proto, const char *domain);
- const char *GetGuardCode();
+ const char *GetGuardCode() {
+ return m_guardCode;
+ }
};
/////////////////////////////////////////////////////////////////////////////////
class CSteamTwoFactorDialog : public CSteamDlgBase
{
-private:
char m_twoFactorCode[6];
CCtrlEdit m_text;
- CCtrlButton m_ok;
protected:
bool OnInitDialog() override;
+ bool OnApply() override;
bool OnClose() override;
- void OnOk(CCtrlButton*);
-
public:
CSteamTwoFactorDialog(CSteamProto *proto);
- const char *GetTwoFactorCode();
+ const char *GetTwoFactorCode() {
+ return m_twoFactorCode;
+ }
};
/////////////////////////////////////////////////////////////////////////////////
class CSteamCaptchaDialog : public CSteamDlgBase
{
-private:
char m_captchaText[7];
uint8_t *m_captchaImage;
@@ -95,7 +88,9 @@ public: CSteamCaptchaDialog(CSteamProto *proto, const uint8_t *captchaImage, size_t captchaImageSize);
~CSteamCaptchaDialog();
- const char *GetCaptchaText();
+ const char* GetCaptchaText() {
+ return m_captchaText;
+ }
};
-#endif //_STEAM_DIALOGS_H_
\ No newline at end of file +#endif //_STEAM_DIALOGS_H_
|