00001
00002
00003
00004
00005
00006 #if !defined(AFX_DOWNLOADSWND_H__9DDD9136_96AD_4BBB_A7DE_852EED3847E3__INCLUDED_)
00007 #define AFX_DOWNLOADSWND_H__9DDD9136_96AD_4BBB_A7DE_852EED3847E3__INCLUDED_
00008
00009 #include "fsClipboardCatchMgr.h"
00010 #include "Downloads_Groups.h"
00011 #include "WndSplitter.h"
00012 #include "Downloads_Downloads.h"
00013 #if _MSC_VER > 1000
00014 #pragma once
00015 #endif
00016
00017 #include "list.h"
00018 #include "fsDownloadRegSaver.h"
00019 #include "fsDownloadsMgr.h"
00020 #include "fsIECatchMgr.h"
00021 #include "plugins.h"
00022 #include "fsMutex.h"
00023 #include "Downloads_History.h"
00024 #include "Downloads_Deleted.h"
00025 #include "fsFindDownloadMgr.h"
00026
00027 enum fsDLsWndWhatIsNow
00028 {
00029 DWWN_LISTOFDOWNLOADS,
00030 DWWN_HISTORY,
00031 DWWN_DELETED,
00032 };
00033
00034 #define DWCDAP_GROUP 1
00035 #define DWCDAP_FLAGS 2
00036 #define DWCDAP_COOKIES 4
00037 #define DWCDAP_POSTDATA 8
00038 #define DWCDAP_FILENAME 16
00039 #define DWCDAP_MEDIA_CONVERT_SETTINGS 32
00040 struct vmsDWCD_AdditionalParameters
00041 {
00042 DWORD dwMask;
00043 vmsDownloadsGroupSmartPtr pGroup;
00044 CString strCookies;
00045 CString strPostData;
00046 CString strFileName;
00047 vmsMediaFileConvertSettings stgsMediaConvert;
00048 DWORD dwFlags;
00049 #define DWDCDAP_F_SAVETODESKTOP (1 << 0)
00050
00051 #define DWDCDAP_F_SAVETOTEMPFLDR (1 << 1)
00052
00053 #define DWDCDAP_F_DELWHENDONE (1 << 2)
00054
00055 #define DWDCDAP_F_IGNOREALLRESTRICTS (1 << 3)
00056
00057 #define DWDCDAP_F_PLACETOTOP (1 << 4)
00058
00059 #define DWDCDAP_F_NOGRPAUTOCHANGE (1 << 5)
00060
00061 #define DWDCDAP_F_SETFOCUSTOOKBTN (1 << 6)
00062
00063 #define DWDCDAP_F_NO_UI (1 << 7)
00064
00065 #define DWDCDAP_F_FORCEAUTOSTART (1 << 8)
00066
00067 #define DWDCDAP_F_DISABLEMALICIOUSCHECK (1 << 9)
00068
00069 #define DWDCDAP_F_DONTCHECKURLALREADYEXISTS (1 << 10)
00070
00071 #define DWDCDAP_F_FLASHVIDEODOWNLOAD (1 << 11)
00072 };
00073
00074 #define DWCD_NOFORCEAUTOLAUNCH ((DWORD) -1)
00075
00076 #define DWCD_FORCEAUTOLAUNCH_NOCONF ((DWORD)0)
00077
00078 #define DWCD_FORCEAUTOLAUNCH ((DWORD)1)
00079
00080 #define WM_DW_CREATEDLDDIALOG (WM_APP+1000)
00081 #define WM_DW_CLOSEDLDDIALOG (WM_APP+1001)
00082 #define WM_DW_UPDATEDLDDIALOG (WM_APP+1002)
00083
00084 #define WM_DLD_SHOWOPINIONS (WM_APP+1003)
00085 #define WM_DLD_CONVERT_MEDIA (WM_APP+1004)
00086
00087 extern CDownloadsWnd* _pwndDownloads;
00088
00089 class CDownloadsWnd : public CWnd
00090 {
00091 friend class CDownloads_Groups;
00092 friend class CDownloads_Tasks;
00093 friend class CDownloaderProperties_MonitorPage;
00094 friend class CDownloaderProperties_ListPage;
00095 friend class CDlgExportDownloads;
00096 friend class CMainFrame;
00097
00098 public:
00099 CDownloadsWnd();
00100
00101 public:
00102
00103 public:
00104
00105
00106
00107
00108 public:
00109 static HMENU Plugin_GetViewMenu();
00110 static HMENU Plugin_GetMainMenu();
00111 BOOL IsMediaDownload (vmsDownloadSmartPtr dld);
00112 int DeleteDownloads(DLDS_LIST_REF v, BOOL bByUser, BOOL bDontConfirmFileDeleting);
00113 void ShowDownloads (DLDS_LIST_REF v);
00114
00115 BOOL CreateBtDownloadFromFile (LPCSTR pszFile, LPCSTR pszTorrentUrl, BOOL bSilent = FALSE);
00116
00117 void OnBtDownloadProperties(DLDS_LIST &vDlds, CWnd* pwndParent = NULL);
00118
00119 void UpdateNumbersOfDownloadsInGroups();
00120
00121 void DeleteDeadDownloadsInList();
00122
00123 void OnGroupNameChanged (vmsDownloadsGroupSmartPtr pGroup);
00124
00125 void CheckDldHasOpinions (vmsDownloadSmartPtr dld);
00126
00127 UINT get_TotalSpeed();
00128
00129 void set_DontUpdateTIPO (BOOL b);
00130
00131 void RestartDownload (vmsDownloadSmartPtr dld, BOOL bSelThisDld);
00132
00133 CDownloads_Downloads m_wndDownloads;
00134
00135 BOOL IsFindNextAvail();
00136
00137 void SelectDeletedDownload (vmsDownloadSmartPtr dld);
00138
00139 void ShowDeletedDownloads();
00140
00141 void SelectHistRecord (fsDLHistoryRecord* rec);
00142
00143 void ShowAllHistory();
00144
00145 void FindDownloads_FindNext();
00146
00147 void FindDownloads_Start();
00148
00149 void SelectDownload (vmsDownloadSmartPtr dld);
00150
00151 void ShowAllDownloads();
00152
00153 void ApplyHistoryCurrentFilter();
00154
00155 void Set_DWWN (fsDLsWndWhatIsNow en);
00156 CDownloads_Deleted m_wndDeleted;
00157
00158 void ApplyDWWN(BOOL bRecalcSize = FALSE);
00159
00160 fsDLsWndWhatIsNow Get_DWWN();
00161 CDownloads_History m_wndHistory;
00162
00163 BOOL CreateDownloadWithDefSettings (vmsDownloadSmartPtr dld, LPCSTR pszUrl);
00164
00165 BOOL IsSizesInBytes();
00166
00167 fsDldFilter* GetCurrentFilter();
00168
00169 void ApplyCurrentFilter();
00170
00171 void FilterDownloads (fsDldFilter* filter);
00172
00173 static void Plugin_SetLanguage (wgLanguage, HMENU hMenuMain, HMENU);
00174 static void Plugin_GetPluginNames (LPCSTR* ppszLong, LPCSTR* ppszShort);
00175 static void Plugin_GetMenuViewItems (wgMenuViewItem** ppItems, int* cItems);
00176 static void Plugin_GetMenuImages (fsSetImage** ppImages, int* pcImages);
00177 static void Plugin_GetToolBarInfo (wgTButtonInfo** ppButtons, int* pcButtons);
00178 static HWND Plugin_CreateMainWindow (HWND hParent);
00179
00180 void DeleteDownload (vmsDownloadSmartPtr dld, BOOL bByUser);
00181
00182 void OnDownloadsGroupChanged ();
00183
00184 void UpdateDownload (vmsDownloadSmartPtr dld, BOOL bWithFile = FALSE);
00185
00186 void OnNewGroupCreated (vmsDownloadsGroupSmartPtr pGroup);
00187
00188 void CreateDownload (vmsDownloadSmartPtr dld, struct fsSchedule *task = NULL, BOOL bDontUseSounds = FALSE, bool bPlaceToTop = false);
00189
00190 void ShowAllGroups (BOOL bShow);
00191
00192 void SaveAll(BOOL bWarnIfErr = FALSE);
00193
00194 void CreateDownloads(DLDS_LIST &vDlds, struct fsSchedule *task, BOOL bDontUseSounds = FALSE, bool bPlaceToTop = false);
00195
00196 void UpdateAllDownloads();
00197
00198 void DeleteCompletedDownloadsInList();
00199
00200 void DeleteDownloadsInList();
00201
00202 void StopDownloadsInList();
00203
00204 void StartDownloadsInList();
00205
00206 void UpdateTrayIconPlusOthers();
00207
00208 BOOL CreateDownload (LPCSTR pszStartUrl, BOOL bReqTopMostDialog = FALSE, LPCSTR pszComment = NULL, LPCSTR pszReferer = NULL, BOOL bSilent = FALSE, DWORD dwForceAutoLaunch = DWCD_NOFORCEAUTOLAUNCH, BOOL* pbAutoStart = NULL, vmsDWCD_AdditionalParameters* pParams = NULL, UINT* pRes = NULL);
00209
00210 afx_msg void OnDownloadCreate();
00211
00212 void OnOptimizationWizard();
00213
00214 fsTUM GetTUM();
00215 void SetTUM (fsTUM tum);
00216
00217 void OnDownloaderProperties();
00218
00219 void OnDownloadDefProperties();
00220
00221 BOOL DeleteGroup (vmsDownloadsGroupSmartPtr pGroup);
00222
00223 void OnDownloadProperties (DLDS_LIST &vDlds, CWnd* pwndParent = NULL);
00224
00225 void SetActiveDownload (vmsDownloadSmartPtr dld);
00226
00227 BOOL Create (CWnd *pParent);
00228 CDownloads_Groups m_wndGroups;
00229
00230 virtual ~CDownloadsWnd();
00231
00232 fsClipboardCatchMgr m_ClpbrdCatch;
00233
00234 protected:
00235 DLDS_LIST m_vUploadDownloads;
00236 afx_msg LRESULT OnDldConvertMedia (WPARAM, LPARAM lp);
00237
00238 bool m_bDeletingManyDownloads;
00239
00240 void OnDldHasOpinions (vmsDownloadSmartPtr dld);
00241
00242 static DWORD WINAPI _threadCheckDldHasOpinions (LPVOID lp);
00243
00244 afx_msg LRESULT OnDldShowOpinions (WPARAM, LPARAM lp);
00245
00246 UINT m_uTotalSpeed;
00247
00248 LRESULT afx_msg OnDWUpdateDldDialog(WPARAM, LPARAM lp);
00249 afx_msg LRESULT OnDWCloseDldDialog (WPARAM, LPARAM lp);
00250 afx_msg LRESULT OnDWCreateDldDialog (WPARAM, LPARAM lp);
00251
00252 BOOL m_bDontUpdateTIPO;
00253
00254 fsFindDownloadMgr m_finder;
00255
00256 fsDLsWndWhatIsNow m_enDWWN;
00257
00258 afx_msg LRESULT OnInsert (WPARAM, LPARAM);
00259
00260 static DWORD WINAPI _threadFilterDownloads (LPVOID lp);
00261
00262 void FilterDownloads2 (fsDldFilter *filter, int* pProgress = NULL);
00263
00264 afx_msg void OnDLListShowCol (UINT uCmd);
00265
00266 afx_msg void OnDLLogShowCol (UINT nCmd);
00267
00268 void UpdateDLLogColMenu (CMenu* menu);
00269 void UpdateDLListColMenu (CMenu* menu);
00270
00271 afx_msg LRESULT OnUpdateMenuView (WPARAM, LPARAM lp);
00272
00273 void ApplyLanguageToMenuView (CMenu* menu);
00274
00275 afx_msg void OnShowDownloadingInfo ();
00276
00277 afx_msg void OnShowAllGroups ();
00278 BOOL m_bShowGroups;
00279
00280 afx_msg LRESULT OnUpdateToolBar (WPARAM wp, LPARAM);
00281
00282 afx_msg LRESULT OnUpdateMenu (WPARAM, LPARAM lp);
00283 BOOL m_bExiting;
00284
00285 afx_msg LRESULT OnAppQueryExit (WPARAM, LPARAM);
00286
00287 void ApplyConnectionType (enum fsConnectionType enCT);
00288
00289 static DWORD _Events (fsDownload* dld, fsDownloadsMgrEvent ev, LPVOID lp);
00290
00291 afx_msg LRESULT OnAppExit (WPARAM, LPARAM);
00292
00293 BOOL LoadDownloads();
00294 CWndSplitter m_splitter;
00295 long m_cCheckDldHasOpinionsThreads;
00296
00297
00298 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00299 afx_msg void OnSize(UINT nType, int cx, int cy);
00300 afx_msg void OnTimer(UINT nIDEvent);
00301 afx_msg void OnDestroy();
00302 afx_msg void OnDlddelete();
00303 afx_msg void OnDldlaunch();
00304 afx_msg void OnDldopenfolder();
00305 afx_msg void OnDldproperties();
00306 afx_msg void OnDldstart();
00307 afx_msg void OnDldstop();
00308 afx_msg void OnDldschedule();
00309 afx_msg void OnDldautostart();
00310 afx_msg void OnSetFocus(CWnd* pOldWnd);
00311 afx_msg void OnDldaddsection();
00312 afx_msg void OnDlddelsection();
00313 afx_msg void OnDldrestart();
00314 afx_msg void OnDldqsize();
00315 afx_msg void OnDldcreatebatch();
00316 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00317 afx_msg void OnDldcheckvir();
00318 afx_msg void OnDldfind();
00319 afx_msg void OnDldfindnext();
00320 afx_msg void OnDldunpack();
00321 afx_msg void OnDldmovedown();
00322 afx_msg void OnDldmoveup();
00323 afx_msg void OnDldcheckintegrity();
00324 afx_msg void OnDldmovetofolder();
00325 afx_msg void OnDldmovebottom();
00326 afx_msg void OnDldmovetop();
00327 afx_msg void OnDldschedulestop();
00328 afx_msg void OnDldgrantbandwidthfordld();
00329 afx_msg void OnDldshowprogressdlg();
00330 afx_msg void OnDldconvert();
00331 afx_msg void OnDldenableseeding();
00332
00333 DECLARE_MESSAGE_MAP()
00334 };
00335
00336
00337
00338 #endif