From db2c4624aa67bc73729e6f26a13ececf111f0d9e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Oct 2024 14:21:24 +0300 Subject: =?UTF-8?q?fixes=20#4711=20(=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D1=85=D1=8D=D1=88=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=20=D0=B2=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B5=20"=D0=9E=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=BC=D0=B5"=20=D0=BA=D0=BB=D0=B8=D0=BA=D0=B0=D0=B1=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir_app/src/help.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/help.cpp b/src/mir_app/src/help.cpp index 02f2e03ffa..02e85523a3 100644 --- a/src/mir_app/src/help.cpp +++ b/src/mir_app/src/help.cpp @@ -27,6 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static class CAboutDlg *pAboutDialog; +static CMStringA szCommitHash; + +static LRESULT HeaderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == WM_LBUTTONDOWN && !szCommitHash.IsEmpty()) + Utils_OpenUrl("https://github.com/miranda-ng/miranda-ng/commit/" + szCommitHash); + + return mir_callNextSubclass(hwnd, HeaderWndProc, msg, wParam, lParam); +} + class CAboutDlg : public CDlgBase { int m_iState = 0; @@ -43,7 +53,7 @@ public: ctrlWhiteRect(this, IDC_WHITERECT), ctrlDevelopers(this, IDC_DEVS) { - btnLink.OnClick = Callback(this, &CAboutDlg::onClick); + btnLink.OnClick = Callback(this, &CAboutDlg::onClick_Link); ctrlCredits.UseSystemColors(); ctrlWhiteRect.UseSystemColors(); @@ -61,6 +71,13 @@ public: Miranda_GetVersionText(productVersion, _countof(productVersion)); ctrlHeaderBar.SetText(CMStringW(FORMAT, L"Miranda NG\nv%S", productVersion)); + szCommitHash.Empty(); + if (auto *p1 = strchr(productVersion, '(')) + if (auto *p2 = strchr(++p1, ')')) { + szCommitHash.Append(p1, p2 - p1); + mir_subclassWindow(ctrlHeaderBar.GetHwnd(), HeaderWndProc); + } + HRSRC hResInfo = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CREDITS), L"TEXT"); uint32_t ResSize = SizeofResource(g_plugin.getInst(), hResInfo); HGLOBAL hRes = LoadResource(g_plugin.getInst(), hResInfo); @@ -91,7 +108,7 @@ public: Window_FreeIcon_IcoLib(m_hwnd); } - void onClick(CCtrlButton*) + void onClick_Link(CCtrlButton*) { if (m_iState) { btnLink.SetText(TranslateT("Credits >")); -- cgit v1.2.3