mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:02:56 +00:00
[RAPPS] Display custom applications icons for installed applications CORE-17257 (#3144)
* [RAPPS] Display custom applications icons for installed applications - Implement `RetrieveIcon` helper function in `CInstalledApplicationInfo` class, which retrueves the current app's icon from registry, same as it done for `CAvailableApplicationInfo`. - Use it for loading the icon in `CAppsListView::AddInstalledApplication` function, via `ExtractIconW`. Load default Rapps icon only when the app has no its custom icon. - Retrieve `DisplayIcon` value from registry in `CInstalledApps::Enum` function, same as other registry values (like app name, description, etc).Store it in `szDisplayIcon` string, which is used in `CInstalledApplicationInfo::RetrieveIcon` for retrieving the data of that value. - Increase `LISTVIEW_ICON_SIZE` macro from 24 to 32, so 32x32 icon size is now used instead of 24x24. This makes displayed icons more accurate, since most of apps contain 32x32 icon, so they look a bit distorted with 24x24 size.
This commit is contained in:
parent
5730485a51
commit
7eb90143f8
4 changed files with 34 additions and 3 deletions
|
@ -1382,7 +1382,26 @@ BOOL CAppsListView::AddInstalledApplication(CInstalledApplicationInfo *InstAppIn
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON hIcon = (HICON)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
|
/* Load icon from registry */
|
||||||
|
HICON hIcon = NULL;
|
||||||
|
ATL::CStringW szIconPath;
|
||||||
|
if (InstAppInfo->RetrieveIcon(szIconPath))
|
||||||
|
{
|
||||||
|
PathParseIconLocationW((LPWSTR)szIconPath.GetString());
|
||||||
|
|
||||||
|
/* Load only the 1st icon from the application executable,
|
||||||
|
* because all apps provide the executables which have the main icon
|
||||||
|
* as 1st in the index , so we don't need other icons here */
|
||||||
|
hIcon = ExtractIconW(hInst,
|
||||||
|
szIconPath.GetString(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hIcon)
|
||||||
|
{
|
||||||
|
/* Load default icon */
|
||||||
|
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
|
||||||
|
}
|
||||||
|
|
||||||
int IconIndex = ImageList_AddIcon(m_hImageListView, hIcon);
|
int IconIndex = ImageList_AddIcon(m_hImageListView, hIcon);
|
||||||
DestroyIcon(hIcon);
|
DestroyIcon(hIcon);
|
||||||
|
@ -2024,4 +2043,3 @@ BOOL CApplicationView::ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// **** CApplicationView ****
|
// **** CApplicationView ****
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
#define LISTVIEW_ICON_SIZE 24
|
#define LISTVIEW_ICON_SIZE 32
|
||||||
|
|
||||||
// default broken-image icon size
|
// default broken-image icon size
|
||||||
#define BROKENIMG_ICON_SIZE 96
|
#define BROKENIMG_ICON_SIZE 96
|
||||||
|
|
|
@ -16,9 +16,11 @@ public:
|
||||||
CInstalledApplicationInfo(BOOL bIsUserKey, REGSAM RegWowKey, HKEY hKey);
|
CInstalledApplicationInfo(BOOL bIsUserKey, REGSAM RegWowKey, HKEY hKey);
|
||||||
BOOL GetApplicationRegString(LPCWSTR lpKeyName, ATL::CStringW& String);
|
BOOL GetApplicationRegString(LPCWSTR lpKeyName, ATL::CStringW& String);
|
||||||
BOOL GetApplicationRegDword(LPCWSTR lpKeyName, DWORD *lpValue);
|
BOOL GetApplicationRegDword(LPCWSTR lpKeyName, DWORD *lpValue);
|
||||||
|
BOOL RetrieveIcon(ATL::CStringW& IconLocation);
|
||||||
BOOL UninstallApplication(BOOL bModify);
|
BOOL UninstallApplication(BOOL bModify);
|
||||||
LSTATUS RemoveFromRegistry();
|
LSTATUS RemoveFromRegistry();
|
||||||
|
|
||||||
|
ATL::CStringW szDisplayIcon;
|
||||||
ATL::CStringW szDisplayName;
|
ATL::CStringW szDisplayName;
|
||||||
ATL::CStringW szDisplayVersion;
|
ATL::CStringW szDisplayVersion;
|
||||||
ATL::CStringW szPublisher;
|
ATL::CStringW szPublisher;
|
||||||
|
|
|
@ -126,6 +126,16 @@ BOOL CInstalledApplicationInfo::GetApplicationRegDword(LPCWSTR lpKeyName, DWORD
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CInstalledApplicationInfo::RetrieveIcon(ATL::CStringW& IconLocation)
|
||||||
|
{
|
||||||
|
if (szDisplayIcon.IsEmpty())
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
IconLocation = szDisplayIcon;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CInstalledApplicationInfo::UninstallApplication(BOOL bModify)
|
BOOL CInstalledApplicationInfo::UninstallApplication(BOOL bModify)
|
||||||
{
|
{
|
||||||
return StartProcess(bModify ? szModifyPath : szUninstallString, TRUE);
|
return StartProcess(bModify ? szModifyPath : szUninstallString, TRUE);
|
||||||
|
@ -206,6 +216,7 @@ BOOL CInstalledApps::Enum(INT EnumType, APPENUMPROC lpEnumProc, PVOID param)
|
||||||
// those items without display name are ignored
|
// those items without display name are ignored
|
||||||
if (Info->GetApplicationRegString(L"DisplayName", Info->szDisplayName))
|
if (Info->GetApplicationRegString(L"DisplayName", Info->szDisplayName))
|
||||||
{
|
{
|
||||||
|
Info->GetApplicationRegString(L"DisplayIcon", Info->szDisplayIcon);
|
||||||
Info->GetApplicationRegString(L"DisplayVersion", Info->szDisplayVersion);
|
Info->GetApplicationRegString(L"DisplayVersion", Info->szDisplayVersion);
|
||||||
Info->GetApplicationRegString(L"Publisher", Info->szPublisher);
|
Info->GetApplicationRegString(L"Publisher", Info->szPublisher);
|
||||||
Info->GetApplicationRegString(L"RegOwner", Info->szRegOwner);
|
Info->GetApplicationRegString(L"RegOwner", Info->szRegOwner);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue