From 5d3ed3f80e2bf8bcc0f9551433eae14de5afee5f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 24 Jun 2019 15:01:31 -0700 Subject: [PATCH] Update win32 launcher with working ToS link --- launchers/win32/Launcher.rc | 2 +- launchers/win32/LauncherDlg.cpp | 24 +++++++++++++++++++----- launchers/win32/LauncherDlg.h | 3 ++- launchers/win32/resource.h | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/launchers/win32/Launcher.rc b/launchers/win32/Launcher.rc index 49f3ca53c5..4d9e0ffcd6 100644 --- a/launchers/win32/Launcher.rc +++ b/launchers/win32/Launcher.rc @@ -103,7 +103,7 @@ BEGIN CTEXT "",IDC_MESSAGE2_LABEL,35,172,239,15,NOT WS_VISIBLE CTEXT "",IDC_ACTION2_LABEL,15,147,278,25,NOT WS_VISIBLE RTEXT "",IDC_TERMS,15,172,180,15,NOT WS_VISIBLE - LTEXT "",IDC_TERMS2,197,172,80,15,NOT WS_VISIBLE + CONTROL "",IDC_TERMS_LINK,"Button", BS_OWNERDRAW | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,197,172,80,15 CTEXT "",IDC_TROUBLE,65,203,174,15,NOT WS_VISIBLE CONTROL "NEXT",IDC_BUTTON_NEXT,"Button",BS_OWNERDRAW | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,107,158,94,16 CONTROL "Having Trouble?",IDC_TROUBLE_LINK,"Button",BS_OWNERDRAW | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,126,203,56,11 diff --git a/launchers/win32/LauncherDlg.cpp b/launchers/win32/LauncherDlg.cpp index 98c61794a0..bd33d96cb7 100644 --- a/launchers/win32/LauncherDlg.cpp +++ b/launchers/win32/LauncherDlg.cpp @@ -37,6 +37,7 @@ static CString GRAPHIK_REGULAR = _T("Graphik-Regular"); static CString GRAPHIK_SEMIBOLD = _T("Graphik-Semibold"); static CString TROUBLE_URL = _T("https://www.highfidelity.com/hq-support"); +static CString TERMS_URL = _T("https://www.highfidelity.com/termsofservice"); CLauncherDlg::CLauncherDlg(CWnd* pParent) @@ -54,6 +55,7 @@ void CLauncherDlg::DoDataExchange(CDataExchange* pDX) { DDX_Control(pDX, IDC_BUTTON_NEXT, m_btnNext); DDX_Control(pDX, IDC_TROUBLE_LINK, m_trouble_link); + DDX_Control(pDX, IDC_TERMS_LINK, m_terms_link); DDX_Control(pDX, IDC_ORGNAME, m_orgname); DDX_Control(pDX, IDC_USERNAME, m_username); DDX_Control(pDX, IDC_PASSWORD, m_password); @@ -69,6 +71,7 @@ BEGIN_MESSAGE_MAP(CLauncherDlg, CDialog) ON_EN_SETFOCUS(IDC_PASSWORD, &CLauncherDlg::OnPassEditChangeFocus) ON_BN_CLICKED(IDC_BUTTON_NEXT, &CLauncherDlg::OnNextClicked) ON_BN_CLICKED(IDC_TROUBLE_LINK, &CLauncherDlg::OnTroubleClicked) + ON_BN_CLICKED(IDC_TERMS_LINK, &CLauncherDlg::OnTermsClicked) ON_WM_CTLCOLOR() ON_WM_DRAWITEM() ON_WM_SETCURSOR() @@ -103,7 +106,6 @@ BOOL CLauncherDlg::OnInitDialog() { m_password_banner = (CStatic *)GetDlgItem(IDC_PASSWORD_BANNER); m_terms = (CStatic *)GetDlgItem(IDC_TERMS); - m_terms2 = (CStatic *)GetDlgItem(IDC_TERMS2); m_trouble = (CStatic *)GetDlgItem(IDC_TROUBLE); m_voxel = (CStatic *)GetDlgItem(IDC_VOXEL); @@ -223,6 +225,10 @@ afx_msg void CLauncherDlg::OnTroubleClicked() { LauncherUtils::executeOnForeground(TROUBLE_URL, _T("")); } +afx_msg void CLauncherDlg::OnTermsClicked() { + LauncherUtils::executeOnForeground(TERMS_URL, _T("")); +} + afx_msg void CLauncherDlg::OnNextClicked() { if (_drawStep != DrawStep::DrawChoose) { CString token; @@ -362,9 +368,9 @@ void CLauncherDlg::prepareChoose() { m_action_label->SetWindowTextW(_T("Choose a display name")); m_message_label->SetWindowTextW(_T("This is the name that your teammates will see.")); m_terms->ShowWindow(SW_SHOW); - m_terms2->ShowWindow(SW_SHOW); + m_terms_link.ShowWindow(SW_SHOW); m_terms->SetWindowTextW(_T("By signing in, you agree to the High Fidelity")); - m_terms2->SetWindowTextW(_T("Terms of Service")); + m_terms_link.SetWindowTextW(_T("Terms of Service")); CRect rec; m_btnNext.GetWindowRect(&rec); ScreenToClient(&rec); @@ -380,7 +386,7 @@ void CLauncherDlg::prepareProcess(DrawStep step) { m_trouble->ShowWindow(SW_HIDE); m_trouble_link.ShowWindow(SW_HIDE); m_terms->ShowWindow(SW_HIDE); - m_terms2->ShowWindow(SW_HIDE); + m_terms_link.ShowWindow(SW_HIDE); m_orgname_banner->ShowWindow(SW_HIDE); m_username_banner->ShowWindow(SW_HIDE); m_password_banner->ShowWindow(SW_HIDE); @@ -465,7 +471,7 @@ BOOL CLauncherDlg::getTextFormat(int resID, TextFormat& formatOut) { case IDC_TERMS: formatOut.size = TERMS_FONT_SIZE; break; - case IDC_TERMS2: + case IDC_TERMS_LINK: formatOut.size = TERMS_FONT_SIZE; formatOut.isBold = true; break; @@ -542,6 +548,14 @@ void CLauncherDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) dc.SelectObject(buttonFont); } dc.DrawText(_T("Having Trouble"), CRect(rect.left, rect.top, rect.right, rect.bottom), DT_CENTER | DT_VCENTER | DT_SINGLELINE); + } else if (nIDCtl == IDC_TERMS_LINK) { + dc.FillSolidRect(rect, COLOR_BLACK); + dc.SetTextColor(COLOR_LIGHT_GREY); + CFont buttonFont; + if (LauncherUtils::getFont(GRAPHIK_SEMIBOLD, TERMS_FONT_SIZE, true, buttonFont)) { + dc.SelectObject(buttonFont); + } + dc.DrawText(_T("Terms of Service"), CRect(rect.left, rect.top, rect.right, rect.bottom), DT_LEFT | DT_TOP | DT_SINGLELINE); } } diff --git a/launchers/win32/LauncherDlg.h b/launchers/win32/LauncherDlg.h index beaaedcdb6..6357c2a5b0 100644 --- a/launchers/win32/LauncherDlg.h +++ b/launchers/win32/LauncherDlg.h @@ -72,13 +72,13 @@ protected: HICON m_hIcon; CButton m_btnNext; CButton m_trouble_link; + CButton m_terms_link; CStatic* m_message_label; CStatic* m_action_label; CStatic* m_message2_label; CStatic* m_action2_label; CStatic* m_terms; - CStatic* m_terms2; CStatic* m_trouble; CStatic* m_voxel; @@ -111,6 +111,7 @@ protected: afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnNextClicked(); afx_msg void OnTroubleClicked(); + afx_msg void OnTermsClicked(); afx_msg void OnOrgEditChangeFocus(); afx_msg void OnUserEditChangeFocus(); afx_msg void OnPassEditChangeFocus(); diff --git a/launchers/win32/resource.h b/launchers/win32/resource.h index 51e6e7bd71..f5a1e3ef07 100644 --- a/launchers/win32/resource.h +++ b/launchers/win32/resource.h @@ -23,7 +23,7 @@ #define IDC_USERNAME_BANNER 1019 #define IDC_PASSWORD_BANNER 1020 #define IDC_TERMS 1021 -#define IDC_TERMS2 1022 +#define IDC_TERMS_LINK 1022 #define IDC_TROUBLE 1023 #define IDC_VOXEL 1024 #define IDC_TROUBLE_LINK 1027