Move prune (all remotes) setting to git config page
[TortoiseGit.git] / src / TortoiseProc / AboutDlg.cpp
blobf3064ac6052aaa085174461cda55675e8f70d5cd
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2009-2020 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "stdafx.h"
22 #include "TortoiseProc.h"
23 #include "AboutDlg.h"
24 #include "PathUtils.h"
25 #define NEED_SIGNING_KEY
26 #include "../version.h"
27 #include "VersioncheckParser.h"
28 #include "AppUtils.h"
29 #include "Git.h"
30 #include "DPIAware.h"
32 //IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)
33 CAboutDlg::CAboutDlg(CWnd* pParent /*=nullptr*/)
34 : CStandAloneDialog(CAboutDlg::IDD, pParent)
38 CAboutDlg::~CAboutDlg()
42 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
44 CStandAloneDialog::DoDataExchange(pDX);
45 DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);
46 DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);
49 BEGIN_MESSAGE_MAP(CAboutDlg, CStandAloneDialog)
50 ON_WM_TIMER()
51 ON_WM_MOUSEMOVE()
52 ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate)
53 ON_WM_CLOSE()
54 END_MESSAGE_MAP()
56 static CString Lf2Crlf(const CString& text)
58 CString s;
59 if (text.IsEmpty())
60 return s;
62 TCHAR c = L'\0';
63 for (int i = 0; i < text.GetLength(); i++)
65 if (text[i] == L'\n' && c != L'\r')
66 s += "\r\n";
67 else
68 s += text[i];
69 c = text[i];
71 return s;
74 BOOL CAboutDlg::OnInitDialog()
76 CStandAloneDialog::OnInitDialog();
77 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
79 // set the version string
80 CString temp;
82 CString out, err;
83 if (g_Git.Run(L"git.exe --version", &out, &err, CP_UTF8))
84 out = L"git not found (" + err + L')';
85 out.Trim();
87 if (!CGit::ms_LastMsysGitDir.IsEmpty())
89 out += L" (" + CGit::ms_LastMsysGitDir;
90 out += L"; " + CGit::ms_MsysGitRootDir;
91 out += L"; " + g_Git.GetGitSystemConfig();
92 if (CGit::ms_bMsys2Git)
93 out += L"; with msys2 hack";
94 else if (CGit::ms_bCygwinGit)
95 out += L"; with cygwin hack";
96 else if (!g_Git.GetGitProgramDataConfig().IsEmpty())
97 out += L"; " + g_Git.GetGitProgramDataConfig();
98 out += L')';
101 CString tortoisegitprocpath;
102 CString additionalVersionInformation;
103 #if PREVIEW
104 additionalVersionInformation = _T(PREVIEW_INFO);
105 #else
106 if (CString hotfix = CPathUtils::GetAppDirectory() + L"hotfix.ini"; PathFileExists(hotfix))
108 CVersioncheckParser parser;
109 if (parser.Load(hotfix, err))
111 auto version = parser.GetTortoiseGitVersion();
112 if (version.major == TGIT_VERMAJOR && version.minor == TGIT_VERMINOR && version.micro == TGIT_VERMICRO && version.build > TGIT_VERBUILD)
113 additionalVersionInformation = L"Hotfix " + parser.GetTortoiseGitVersion().version;
116 #endif
117 if (!additionalVersionInformation.IsEmpty())
118 tortoisegitprocpath.Format(L"(%s; %s)", static_cast<LPCTSTR>(additionalVersionInformation), static_cast<LPCTSTR>(CPathUtils::GetAppDirectory().TrimRight(L'\\')));
119 else
120 tortoisegitprocpath.Format(L"(%s)", static_cast<LPCTSTR>(CPathUtils::GetAppDirectory().TrimRight(L'\\')));
121 temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, static_cast<LPCTSTR>(tortoisegitprocpath), static_cast<LPCTSTR>(out));
122 SetDlgItemText(IDC_VERSIONABOUT, Lf2Crlf(temp));
124 this->SetWindowText(L"TortoiseGit");
126 // we can only put up to 256 chars into the resource file, so fill it here with the full list
127 SetDlgItemText(IDC_STATIC_AUTHORS, L"Sven Strickroth <email@cs-ware.de> (Current Maintainer), Sup Yut Sum <ch3cooli@gmail.com>, Frank Li <lznuaa@gmail.com> (Founder), Yue Lin Ho <b8732003@student.nsysu.edu.tw>, Colin Law <clanlaw@googlemail.com>, Myagi <snowcoder@gmail.com>, Johan 't Hart <johanthart@gmail.com>, Laszlo Papp <djszapi@archlinux.us>");
129 CPictureHolder tmpPic;
130 tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
131 m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
132 m_renderDest.Create32BitFromPicture(&tmpPic,468,64);
134 m_waterEffect.Create(468,64);
135 SetTimer(ID_EFFECTTIMER, 40, nullptr);
136 SetTimer(ID_DROPTIMER, 1500, nullptr);
138 m_cWebLink.SetURL(L"https://tortoisegit.org/");
139 m_cSupportLink.SetURL(L"https://tortoisegit.org/donate");
141 CenterWindow(CWnd::FromHandle(GetExplorerHWND()));
142 GetDlgItem(IDOK)->SetFocus();
143 return FALSE;
146 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)
148 if (nIDEvent == ID_EFFECTTIMER)
150 m_waterEffect.Render(static_cast<DWORD*>(m_renderSrc.GetDIBits()), static_cast<DWORD*>(m_renderDest.GetDIBits()));
151 CClientDC dc(this);
152 CPoint ptOrigin(CDPIAware::Instance().ScaleX(15), CDPIAware::Instance().ScaleY(20));
153 m_renderDest.Draw(&dc,ptOrigin);
155 if (nIDEvent == ID_DROPTIMER)
157 CRect r;
158 r.left = CDPIAware::Instance().ScaleX(15);
159 r.top = CDPIAware::Instance().ScaleY(20);
160 r.right = r.left + m_renderSrc.GetWidth();
161 r.bottom = r.top + m_renderSrc.GetHeight();
162 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);
164 CStandAloneDialog::OnTimer(nIDEvent);
167 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
169 CRect r;
170 r.left = CDPIAware::Instance().ScaleX(15);
171 r.top = CDPIAware::Instance().ScaleY(20);
172 r.right = r.left + m_renderSrc.GetWidth();
173 r.bottom = r.top + m_renderSrc.GetHeight();
175 if(r.PtInRect(point) == TRUE)
177 // dibs are drawn upside down...
178 point.y -= CDPIAware::Instance().ScaleY(20);
179 point.y = 64-point.y;
181 if (nFlags & MK_LBUTTON)
182 m_waterEffect.Blob(point.x - CDPIAware::Instance().ScaleX(15), point.y, 10, 1600, m_waterEffect.m_iHpage);
183 else
184 m_waterEffect.Blob(point.x - CDPIAware::Instance().ScaleX(15), point.y, 5, 50, m_waterEffect.m_iHpage);
187 CStandAloneDialog::OnMouseMove(nFlags, point);
190 void CAboutDlg::OnBnClickedUpdate()
192 CAppUtils::RunTortoiseGitProc(L"/command:updatecheck /visible", false, false);
195 void CAboutDlg::OnClose()
197 KillTimer(ID_EFFECTTIMER);
198 KillTimer(ID_DROPTIMER);
200 __super::OnClose();