https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1807dbfd6da9b6c3fa5c6…
commit 1807dbfd6da9b6c3fa5c6a6e2006be7543734b1e
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sun Apr 28 06:19:43 2019 +0300
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Tue Aug 20 00:43:46 2019 +0200
[RAPPS] Don't use CDownloadManager outside loaddlg.cpp
---
base/applications/rapps/available.cpp | 2 +-
base/applications/rapps/gui.cpp | 4 +-
base/applications/rapps/include/dialogs.h | 34 +++---------
base/applications/rapps/loaddlg.cpp | 87 ++++++++++++++++++++++---------
base/applications/rapps/unattended.cpp | 2 +-
5 files changed, 71 insertions(+), 58 deletions(-)
diff --git a/base/applications/rapps/available.cpp
b/base/applications/rapps/available.cpp
index c6ee68f7f27..9a67aba42c0 100644
--- a/base/applications/rapps/available.cpp
+++ b/base/applications/rapps/available.cpp
@@ -300,7 +300,7 @@ BOOL CAvailableApps::UpdateAppsDB()
return TRUE;
}
- CDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL);
+ DownloadApplicationsDB(APPLICATION_DATABASE_URL);
if (!ExtractFilesFromCab(m_Strings.szCabName,
m_Strings.szCabDir,
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index f5151433bf2..3695ca73a54 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -1470,11 +1470,11 @@ private:
{
if (nSelectedApps > 0)
{
-
CDownloadManager::DownloadListOfApplications(m_AvailableApps.GetSelected());
+ DownloadListOfApplications(m_AvailableApps.GetSelected(), FALSE);
UpdateApplicationsList(-1);
m_ListView->SetSelected(-1, FALSE);
}
- else if
(CDownloadManager::DownloadApplication(m_ListView->GetSelectedData()))
+ else if (DownloadApplication(m_ListView->GetSelectedData(), FALSE))
{
UpdateApplicationsList(-1);
}
diff --git a/base/applications/rapps/include/dialogs.h
b/base/applications/rapps/include/dialogs.h
index f05b223f535..5247462d59f 100644
--- a/base/applications/rapps/include/dialogs.h
+++ b/base/applications/rapps/include/dialogs.h
@@ -5,38 +5,16 @@
#include <windef.h>
#include <atlsimpcoll.h>
-// Download dialog (loaddlg.cpp)
-class CDowloadingAppsListView;
-struct DownloadInfo;
-
-class CDownloadManager
-{
- static ATL::CSimpleArray<DownloadInfo> AppsToInstallList;
- static CDowloadingAppsListView DownloadsListView;
-
- static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE);
- static VOID SetProgressMarquee(HWND Item, BOOL Enable);
-
-public:
- static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM
lParam);
- static LRESULT CALLBACK DownloadProgressProc(HWND hWnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam,
- UINT_PTR uIdSubclass,
- DWORD_PTR dwRefData);
-
- static DWORD WINAPI ThreadFunc(LPVOID Context);
- static BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE);
- static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal =
FALSE);
- static VOID DownloadApplicationsDB(LPCWSTR lpUrl);
- static VOID LaunchDownloadDialog(BOOL);
-};
-
// Settings dialog (settingsdlg.cpp)
VOID CreateSettingsDlg(HWND hwnd);
// About dialog (aboutdlg.cpp)
VOID ShowAboutDialog();
+//Main window
VOID ShowMainWindow(INT nShowCmd);
+
+// Download dialogs
+VOID DownloadApplicationsDB(LPCWSTR lpUrl);
+BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal);
+BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal);
diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp
index 4016aa550cd..c4de1e29eec 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -384,10 +384,43 @@ inline VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
}
}
+
+// Download dialog (loaddlg.cpp)
+class CDownloadManager
+{
+ static ATL::CSimpleArray<DownloadInfo> AppsToInstallList;
+ static CDowloadingAppsListView DownloadsListView;
+
+ static VOID SetProgressMarquee(HWND Item, BOOL Enable);
+
+public:
+ static VOID Add(DownloadInfo info);
+ static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE);
+ static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM
lParam);
+ static LRESULT CALLBACK DownloadProgressProc(HWND hWnd,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam,
+ UINT_PTR uIdSubclass,
+ DWORD_PTR dwRefData);
+
+ static DWORD WINAPI ThreadFunc(LPVOID Context);
+ static BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE);
+ static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal =
FALSE);
+ static VOID DownloadApplicationsDB(LPCWSTR lpUrl);
+ static VOID LaunchDownloadDialog(BOOL);
+};
+
+
// CDownloadManager
ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList;
CDowloadingAppsListView CDownloadManager::DownloadsListView;
+VOID CDownloadManager::Add(DownloadInfo info)
+{
+ AppsToInstallList.Add(info);
+}
+
VOID CDownloadManager::Download(const DownloadInfo &DLInfo, BOOL bIsModal)
{
AppsToInstallList.RemoveAll();
@@ -927,7 +960,28 @@ end:
return 0;
}
-BOOL CDownloadManager::DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal)
+//TODO: Reuse the dialog
+VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal)
+{
+ if (bIsModal)
+ {
+ DialogBoxW(hInst,
+ MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
+ hMainWnd,
+ DownloadDlgProc);
+ }
+ else
+ {
+ CreateDialogW(hInst,
+ MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
+ hMainWnd,
+ DownloadDlgProc);
+ }
+}
+// CDownloadManager
+
+
+BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal)
{
if (AppsList.GetSize() == 0)
return FALSE;
@@ -935,48 +989,29 @@ BOOL CDownloadManager::DownloadListOfApplications(const
ATL::CSimpleArray<CAvail
// Initialize shared variables
for (INT i = 0; i < AppsList.GetSize(); ++i)
{
- AppsToInstallList.Add(AppsList[i]); // implicit conversion to DownloadInfo
+ CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo
}
// Create a dialog and issue a download process
- LaunchDownloadDialog(bIsModal);
+ CDownloadManager::LaunchDownloadDialog(bIsModal);
return TRUE;
}
-BOOL CDownloadManager::DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL
bIsModal)
+BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal)
{
if (!pAppInfo)
return FALSE;
- Download(*pAppInfo, bIsModal);
+ CDownloadManager::Download(*pAppInfo, bIsModal);
return TRUE;
}
-VOID CDownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl)
+VOID DownloadApplicationsDB(LPCWSTR lpUrl)
{
static DownloadInfo DatabaseDLInfo;
DatabaseDLInfo.szUrl = lpUrl;
DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
- Download(DatabaseDLInfo, TRUE);
+ CDownloadManager::Download(DatabaseDLInfo, TRUE);
}
-//TODO: Reuse the dialog
-VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal)
-{
- if (bIsModal)
- {
- DialogBoxW(hInst,
- MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
- hMainWnd,
- DownloadDlgProc);
- }
- else
- {
- CreateDialogW(hInst,
- MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
- hMainWnd,
- DownloadDlgProc);
- }
-}
-// CDownloadManager
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 7f7f3510f67..2988ff68c44 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -67,7 +67,7 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine)
ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo =
apps.FindInfoList(arrNames);
if (arrAppInfo.GetSize() > 0)
{
- CDownloadManager::DownloadListOfApplications(arrAppInfo, TRUE);
+ DownloadListOfApplications(arrAppInfo, TRUE);
return TRUE;
}