loaddlg.cpp (6f130666) | loaddlg.cpp (1807dbfd) |
---|---|
1/* 2 * PROJECT: ReactOS Applications Manager 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * FILE: base/applications/rapps/loaddlg.cpp 5 * PURPOSE: Displaying a download dialog 6 * COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers) 7 * Copyright 2004 Mike McCormack (for CodeWeavers) 8 * Copyright 2005 Ge van Geldorp (gvg@reactos.org) --- 370 unchanged lines hidden (view full) --- 379{ 380 ATL::CStringW szMsgText; 381 if (szMsgText.LoadStringW(StringID)) 382 { 383 MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); 384 } 385} 386 | 1/* 2 * PROJECT: ReactOS Applications Manager 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * FILE: base/applications/rapps/loaddlg.cpp 5 * PURPOSE: Displaying a download dialog 6 * COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers) 7 * Copyright 2004 Mike McCormack (for CodeWeavers) 8 * Copyright 2005 Ge van Geldorp (gvg@reactos.org) --- 370 unchanged lines hidden (view full) --- 379{ 380 ATL::CStringW szMsgText; 381 if (szMsgText.LoadStringW(StringID)) 382 { 383 MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); 384 } 385} 386 |
387 388// Download dialog (loaddlg.cpp) 389class CDownloadManager 390{ 391 static ATL::CSimpleArray<DownloadInfo> AppsToInstallList; 392 static CDowloadingAppsListView DownloadsListView; 393 394 static VOID SetProgressMarquee(HWND Item, BOOL Enable); 395 396public: 397 static VOID Add(DownloadInfo info); 398 static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); 399 static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 400 static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, 401 UINT uMsg, 402 WPARAM wParam, 403 LPARAM lParam, 404 UINT_PTR uIdSubclass, 405 DWORD_PTR dwRefData); 406 407 static DWORD WINAPI ThreadFunc(LPVOID Context); 408 static BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE); 409 static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal = FALSE); 410 static VOID DownloadApplicationsDB(LPCWSTR lpUrl); 411 static VOID LaunchDownloadDialog(BOOL); 412}; 413 414 |
|
387// CDownloadManager 388ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList; 389CDowloadingAppsListView CDownloadManager::DownloadsListView; 390 | 415// CDownloadManager 416ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList; 417CDowloadingAppsListView CDownloadManager::DownloadsListView; 418 |
419VOID CDownloadManager::Add(DownloadInfo info) 420{ 421 AppsToInstallList.Add(info); 422} 423 |
|
391VOID CDownloadManager::Download(const DownloadInfo &DLInfo, BOOL bIsModal) 392{ 393 AppsToInstallList.RemoveAll(); 394 AppsToInstallList.Add(DLInfo); 395 LaunchDownloadDialog(bIsModal); 396} 397 398INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) --- 523 unchanged lines hidden (view full) --- 922 DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_FINISHED); 923 } 924 925 delete static_cast<DownloadParam*>(param); 926 SendMessageW(hDlg, WM_CLOSE, 0, 0); 927 return 0; 928} 929 | 424VOID CDownloadManager::Download(const DownloadInfo &DLInfo, BOOL bIsModal) 425{ 426 AppsToInstallList.RemoveAll(); 427 AppsToInstallList.Add(DLInfo); 428 LaunchDownloadDialog(bIsModal); 429} 430 431INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) --- 523 unchanged lines hidden (view full) --- 955 DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_FINISHED); 956 } 957 958 delete static_cast<DownloadParam*>(param); 959 SendMessageW(hDlg, WM_CLOSE, 0, 0); 960 return 0; 961} 962 |
930BOOL CDownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal) | 963//TODO: Reuse the dialog 964VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal) |
931{ | 965{ |
966 if (bIsModal) 967 { 968 DialogBoxW(hInst, 969 MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), 970 hMainWnd, 971 DownloadDlgProc); 972 } 973 else 974 { 975 CreateDialogW(hInst, 976 MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), 977 hMainWnd, 978 DownloadDlgProc); 979 } 980} 981// CDownloadManager 982 983 984BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal) 985{ |
|
932 if (AppsList.GetSize() == 0) 933 return FALSE; 934 935 // Initialize shared variables 936 for (INT i = 0; i < AppsList.GetSize(); ++i) 937 { | 986 if (AppsList.GetSize() == 0) 987 return FALSE; 988 989 // Initialize shared variables 990 for (INT i = 0; i < AppsList.GetSize(); ++i) 991 { |
938 AppsToInstallList.Add(AppsList[i]); // implicit conversion to DownloadInfo | 992 CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo |
939 } 940 941 // Create a dialog and issue a download process | 993 } 994 995 // Create a dialog and issue a download process |
942 LaunchDownloadDialog(bIsModal); | 996 CDownloadManager::LaunchDownloadDialog(bIsModal); |
943 944 return TRUE; 945} 946 | 997 998 return TRUE; 999} 1000 |
947BOOL CDownloadManager::DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal) | 1001BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal) |
948{ 949 if (!pAppInfo) 950 return FALSE; 951 | 1002{ 1003 if (!pAppInfo) 1004 return FALSE; 1005 |
952 Download(*pAppInfo, bIsModal); | 1006 CDownloadManager::Download(*pAppInfo, bIsModal); |
953 return TRUE; 954} 955 | 1007 return TRUE; 1008} 1009 |
956VOID CDownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) | 1010VOID DownloadApplicationsDB(LPCWSTR lpUrl) |
957{ 958 static DownloadInfo DatabaseDLInfo; 959 DatabaseDLInfo.szUrl = lpUrl; 960 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP); | 1011{ 1012 static DownloadInfo DatabaseDLInfo; 1013 DatabaseDLInfo.szUrl = lpUrl; 1014 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP); |
961 Download(DatabaseDLInfo, TRUE); | 1015 CDownloadManager::Download(DatabaseDLInfo, TRUE); |
962} 963 | 1016} 1017 |
964//TODO: Reuse the dialog 965VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal) 966{ 967 if (bIsModal) 968 { 969 DialogBoxW(hInst, 970 MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), 971 hMainWnd, 972 DownloadDlgProc); 973 } 974 else 975 { 976 CreateDialogW(hInst, 977 MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), 978 hMainWnd, 979 DownloadDlgProc); 980 } 981} 982// CDownloadManager | |