00001 // 00002 // DlgFilePreview.h 00003 // 00004 // Copyright (c) Shareaza Development Team, 2002-2005. 00005 // This file is part of SHAREAZA (www.shareaza.com) 00006 // 00007 // Shareaza is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // Shareaza is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Shareaza; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 00022 #if !defined(AFX_DLGFILEPREVIEW_H__E2307205_BEF2_4A77_A7FA_BC92F46BCBF6__INCLUDED_) 00023 #define AFX_DLGFILEPREVIEW_H__E2307205_BEF2_4A77_A7FA_BC92F46BCBF6__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "DlgSkinDialog.h" 00028 00029 class CDownload; 00030 00031 00032 class CFilePreviewDlg : public CSkinDialog 00033 { 00034 // Construction 00035 public: 00036 CFilePreviewDlg(CDownload* pDownload, CWnd* pParent = NULL); 00037 virtual ~CFilePreviewDlg(); 00038 DECLARE_DYNAMIC(CFilePreviewDlg) 00039 00040 // Attributes 00041 public: 00042 CCriticalSection m_pSection; 00043 CDownload* m_pDownload; 00044 CString m_sRemoteName; 00045 CString m_sSourceName; 00046 CString m_sTargetName; 00047 QWORD m_nRange; 00048 QWORD m_nPosition; 00049 DWORD m_nScaled; 00050 DWORD m_nOldScaled; 00051 CString m_sStatus; 00052 CString m_sOldStatus; 00053 CDWordArray m_pRanges; 00054 protected: 00055 BOOL m_bThread; 00056 HANDLE m_hThread; 00057 BOOL m_bCancel; 00058 CString m_sExecute; 00059 protected: 00060 IDownloadPreviewPlugin* m_pPlugin; 00061 static CPtrList m_pWindows; 00062 00063 // Operations 00064 public: 00065 BOOL Create(); 00066 static void OnSkinChange(BOOL bSet); 00067 static void CloseAll(); 00068 protected: 00069 void SetDownload(CDownload* pDownload); 00070 void OnRun(); 00071 BOOL RunPlugin(HANDLE hFile); 00072 BOOL LoadPlugin(LPCTSTR pszType); 00073 BOOL RunManual(HANDLE hFile); 00074 BOOL QueueDeleteFile(LPCTSTR pszFile); 00075 BOOL ExecuteFile(LPCTSTR pszFile); 00076 void UpdateProgress(BOOL bRange, QWORD nRange, BOOL bPosition, QWORD nPosition); 00077 protected: 00078 static UINT ThreadStart(LPVOID pParam); 00079 00080 // Dialog Data 00081 public: 00082 //{{AFX_DATA(CFilePreviewDlg) 00083 enum { IDD = IDD_FILE_PREVIEW }; 00084 CButton m_wndCancel; 00085 CProgressCtrl m_wndProgress; 00086 CStatic m_wndStatus; 00087 CStatic m_wndName; 00088 //}}AFX_DATA 00089 00090 // Overrides 00091 public: 00092 //{{AFX_VIRTUAL(CFilePreviewDlg) 00093 protected: 00094 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 00095 virtual void PostNcDestroy(); 00096 //}}AFX_VIRTUAL 00097 00098 // Implementation 00099 protected: 00100 //{{AFX_MSG(CFilePreviewDlg) 00101 virtual BOOL OnInitDialog(); 00102 virtual void OnCancel(); 00103 afx_msg void OnTimer(UINT nIDEvent); 00104 afx_msg void OnDestroy(); 00105 //}}AFX_MSG 00106 00107 DECLARE_MESSAGE_MAP() 00108 00109 // IDownloadPreviewSite 00110 protected: 00111 BEGIN_INTERFACE_PART(DownloadPreviewSite, IDownloadPreviewSite) 00112 STDMETHOD(GetSuggestedFilename)(BSTR FAR* psFile); 00113 STDMETHOD(GetAvailableRanges)(SAFEARRAY FAR* FAR* ppArray); 00114 STDMETHOD(SetProgressRange)(DWORD nRange); 00115 STDMETHOD(SetProgressPosition)(DWORD nPosition); 00116 STDMETHOD(SetProgressMessage)(BSTR sMessage); 00117 STDMETHOD(QueueDeleteFile)(BSTR sTempFile); 00118 STDMETHOD(ExecuteFile)(BSTR sFile); 00119 END_INTERFACE_PART(DownloadPreviewSite) 00120 00121 DECLARE_INTERFACE_MAP() 00122 00123 public: 00124 afx_msg void OnClose(); 00125 }; 00126 00127 //{{AFX_INSERT_LOCATION}} 00128 00129 #endif // !defined(AFX_DLGFILEPREVIEW_H__E2307205_BEF2_4A77_A7FA_BC92F46BCBF6__INCLUDED_)