1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012 - 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 "HyperLink.h"
25 #include "MenuButton.h"
29 * \ingroup TortoiseProc
30 * Helper dialog class, which checks if there are updated version of TortoiseSVN
33 class CCheckForUpdatesDlg
: public CStandAloneDialog
35 DECLARE_DYNAMIC(CCheckForUpdatesDlg
)
38 CCheckForUpdatesDlg(CWnd
* pParent
= NULL
); // standard constructor
39 virtual ~CCheckForUpdatesDlg();
41 enum { IDD
= IDD_CHECKFORUPDATES
};
50 afx_msg
void OnStnClickedCheckresult();
51 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
52 afx_msg
void OnWindowPosChanging(WINDOWPOS
* lpwndpos
);
53 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
54 afx_msg
void OnBnClickedButtonUpdate();
55 afx_msg LRESULT
OnDisplayStatus(WPARAM
, LPARAM lParam
);
56 afx_msg LRESULT
OnEndDownload(WPARAM
, LPARAM lParam
);
57 afx_msg LRESULT
OnFillChangelog(WPARAM
, LPARAM lParam
);
58 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
59 virtual BOOL
OnInitDialog();
61 virtual void OnCancel();
66 static UINT
CheckThreadEntry(LPVOID pVoid
);
69 BOOL m_bThreadRunning
;
77 CProgressCtrl m_progress
;
79 CWinThread
*m_pDownloadThread
;
82 static UINT
DownloadThreadEntry(LPVOID pParam
);
83 UINT
DownloadThread();
84 bool Download(CString filename
);
86 CUpdateListCtrl m_ctrlFiles
;
88 CString m_sUpdateDownloadLink
; ///< Where to send a user looking to download a update
89 CString m_sUpdateChangeLogLink
; ///< Where to send a user looking to change log
91 CString
GetDownloadsDirectory();
92 CMenuButton m_ctrlUpdate
;
93 BOOL
VerifySignature(CString fileName
);
94 void FillDownloads(CStdioFile
&file
, CString version
);
95 CSciEdit m_cLogMessage
;
96 void FillChangelog(CStdioFile
&file
);
99 class CBSCallbackImpl
: public IBindStatusCallback
102 CBSCallbackImpl(HWND hWnd
, HANDLE hEventStop
);
105 STDMETHOD(QueryInterface
)(REFIID riid
, void **ppvObject
);
106 STDMETHOD_(ULONG
, AddRef
)();
107 STDMETHOD_(ULONG
, Release
)();
109 // IBindStatusCallback methods
110 STDMETHOD(OnStartBinding
)(DWORD
, IBinding
*);
111 STDMETHOD(GetPriority
)(LONG
*);
112 STDMETHOD(OnLowResource
)(DWORD
);
113 STDMETHOD(OnProgress
)(ULONG ulProgress
, ULONG ulProgressMax
, ULONG ulStatusCode
, LPCWSTR szStatusText
);
114 STDMETHOD(OnStopBinding
)(HRESULT
, LPCWSTR
);
115 STDMETHOD(GetBindInfo
)(DWORD
*, BINDINFO
*);
116 STDMETHOD(OnDataAvailable
)(DWORD
, DWORD
, FORMATETC
*, STGMEDIUM
*);
117 STDMETHOD(OnObjectAvailable
)(REFIID
, IUnknown
*);
120 ULONG m_ulObjRefCount
;