diff options
author | George Hazan <george.hazan@gmail.com> | 2024-10-01 14:21:24 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-10-01 14:21:24 +0300 |
commit | db2c4624aa67bc73729e6f26a13ececf111f0d9e (patch) | |
tree | 1bec7cc26c67213c7557234729e41d861e5adba7 /src/mir_app | |
parent | b40531c0c2dd4b430ecb336f1093ff30fdccfca0 (diff) |
fixes #4711 (Сделать хэш коммита в диалоге "О программе" кликабельным)
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/help.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
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 >"));
|