mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 01:54:21 +00:00
[SYSDM] Improvements to the user profile size format
This commit is contained in:
parent
7072a34739
commit
6984729f81
1 changed files with 29 additions and 2 deletions
|
@ -431,6 +431,33 @@ GetProfileName(
|
|||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
FormatProfileSize(LPWSTR Buffer, double size)
|
||||
{
|
||||
const LPWSTR units[] = {L"MB", L"GB", L"TB"};
|
||||
int i = 0, j;
|
||||
|
||||
size /= 1024;
|
||||
size /= 1024;
|
||||
|
||||
while (size >= 1024 && i < 3)
|
||||
{
|
||||
size /= 1024;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (size < 10)
|
||||
j = 2;
|
||||
else if (size < 100)
|
||||
j = 1;
|
||||
else
|
||||
j = 0;
|
||||
|
||||
swprintf(Buffer, L"%.*f %s", j, size, units[i]);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
AddUserProfile(
|
||||
_In_ HWND hwndListView,
|
||||
|
@ -532,8 +559,8 @@ AddUserProfile(
|
|||
lvi.lParam = (LPARAM)pProfileData;
|
||||
iItem = ListView_InsertItem(hwndListView, &lvi);
|
||||
|
||||
/* FIXME: Set the profile size */
|
||||
swprintf(szNameBuffer, L"%I64u MB", ullProfileSize / (1024 * 1024));
|
||||
/* Set the profile size */
|
||||
FormatProfileSize(szNameBuffer, (double)ullProfileSize);
|
||||
ListView_SetItemText(hwndListView, iItem, 1, szNameBuffer);
|
||||
|
||||
/* Set the profile type */
|
||||
|
|
Loading…
Reference in a new issue