Don't delete files which contain of one line without a line ending
[TortoiseGit.git] / src / TortoiseProc / CheckForUpdatesDlg.h
blob7180402b9ba8be55569e561513186a52918a6b42
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.
20 #pragma once
22 #include "StandAloneDlg.h"
23 #include "UpdateListCtrl.h"
24 #include "HyperLink.h"
25 #include "MenuButton.h"
26 #include "SciEdit.h"
28 /**
29 * \ingroup TortoiseProc
30 * Helper dialog class, which checks if there are updated version of TortoiseSVN
31 * available.
33 class CCheckForUpdatesDlg : public CStandAloneDialog
35 DECLARE_DYNAMIC(CCheckForUpdatesDlg)
37 public:
38 CCheckForUpdatesDlg(CWnd* pParent = NULL); // standard constructor
39 virtual ~CCheckForUpdatesDlg();
41 enum { IDD = IDD_CHECKFORUPDATES };
43 struct DOWNLOADSTATUS
45 ULONG ulProgress;
46 ULONG ulProgressMax;
49 protected:
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();
60 virtual void OnOK();
61 virtual void OnCancel();
63 DECLARE_MESSAGE_MAP()
65 private:
66 static UINT CheckThreadEntry(LPVOID pVoid);
67 UINT CheckThread();
69 BOOL m_bThreadRunning;
71 public:
72 BOOL m_bShowInfo;
73 BOOL m_bForce;
75 private:
76 BOOL m_bVisible;
77 CProgressCtrl m_progress;
78 CEvent m_eventStop;
79 CWinThread *m_pDownloadThread;
80 CString m_sFilesURL;
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
90 CHyperLink m_link;
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
101 public:
102 CBSCallbackImpl(HWND hWnd, HANDLE hEventStop);
104 // IUnknown methods
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 *);
119 protected:
120 ULONG m_ulObjRefCount;
122 private:
123 HWND m_hWnd;
124 HANDLE m_hEventStop;