1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012-2014, 2016-2017, 2020, 2023-2024 - TortoiseGit
4 // Copyright (C) 2003-2008 - Stefan Kueng
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.
22 #include "StandAloneDlg.h"
23 #include "UpdateListCtrl.h"
24 #include "UpdateDownloader.h"
25 #include "VersioncheckParser.h"
26 #include "HyperLink.h"
27 #include "MenuButton.h"
31 * \ingroup TortoiseProc
32 * Helper dialog class, which checks if there are updated version of TortoiseSVN
35 class CCheckForUpdatesDlg
: public CResizableStandAloneDialog
37 DECLARE_DYNAMIC(CCheckForUpdatesDlg
)
40 CCheckForUpdatesDlg(CWnd
* pParent
= nullptr); // standard constructor
41 virtual ~CCheckForUpdatesDlg();
43 enum { IDD
= IDD_CHECKFORUPDATES
};
46 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
47 afx_msg
void OnWindowPosChanging(WINDOWPOS
* lpwndpos
);
48 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
49 afx_msg
void OnBnClickedButtonUpdate();
50 afx_msg
void OnBnClickedDonotaskagain();
51 afx_msg LRESULT
OnDisplayStatus(WPARAM
, LPARAM lParam
);
52 afx_msg LRESULT
OnEndDownload(WPARAM
, LPARAM lParam
);
53 afx_msg LRESULT
OnFillChangelog(WPARAM
, LPARAM lParam
);
54 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM
, LPARAM
);
55 void DoDataExchange(CDataExchange
* pDX
) override
; // DDX/DDV support
56 BOOL
OnInitDialog() override
;
57 afx_msg
void OnDestroy();
59 void OnCancel() override
;
64 static UINT
CheckThreadEntry(LPVOID pVoid
);
67 BOOL m_bThreadRunning
= FALSE
;
70 bool m_bShowInfo
= false;
71 bool m_bForce
= false;
74 bool m_bVisible
= false;
75 CProgressCtrl m_progress
;
76 CComPtr
<ITaskbarList3
> m_pTaskbarList
;
78 CWinThread
* m_pDownloadThread
= nullptr;
81 static UINT
DownloadThreadEntry(LPVOID pParam
);
82 UINT
DownloadThread();
83 bool Download(const CString
& filename
, const CString
& versionnumber
);
84 CUpdateDownloader
* m_updateDownloader
= nullptr;
85 bool VerifyUpdateFile(const CString
& filename
, const CString
& filenameSignature
, const CString
& reportingFilename
, const CString
& versionnumber
);
87 CUpdateListCtrl m_ctrlFiles
;
89 void AdjustSize(bool changelog
, bool downloads
, bool handleAnchors
= true);
91 CVersioncheckParser::Version m_myVersion
;
92 CString m_sUpdateDownloadLink
; ///< Where to send a user looking to download a update
93 CString m_sUpdateChangeLogLink
; ///< Where to send a user looking to change log
95 CString
GetDownloadsDirectory();
96 CMenuButton m_ctrlUpdate
;
97 void FillDownloads(CVersioncheckParser
& versionfile
);
98 CSciEdit m_cLogMessage
;
99 void FillChangelog(CVersioncheckParser
& versionfile
, bool official
);
100 static CString
GetWinINetError(DWORD err
);
102 CString m_sNewVersionNumber
;
103 CString m_sNewVersionNumberLanguagepacks
;