[ui] add experimental optional display of transfer speed and time remaining

* You can use <Alt> to switch modes during an operation that supports it (e.g. Checksum
  computation, DD image writing or zeroing, save to VHD, download, etc.
* IMPORTANT: This is *NOT* available for all operations. Especially, if you were hoping
  to get transfer speed or ETA during ISO or WIM extraction, you *WILL* be disappointed.
* Also harmonize the code in checksum.c
This commit is contained in:
Pete Batard 2019-08-20 18:06:07 +01:00
parent 94e2015edf
commit af95de8198
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
16 changed files with 525 additions and 430 deletions

View file

@ -2870,6 +2870,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
FILE* fd;
BOOL attached_console = FALSE, external_loc_file = FALSE, lgp_set = FALSE, automount = TRUE;
BOOL disable_hogger = FALSE, previous_enable_HDDs = FALSE, vc = IsRegistryNode(REGKEY_HKCU, vs_reg);
BOOL alt_pressed = FALSE, alt_command = FALSE;
BYTE *loc_data;
DWORD loc_size, size;
char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb";
@ -3245,6 +3246,12 @@ relaunch:
// ** ***** **** ** **********
// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ
// Sigh... The things one need to do to detect standalone use of the 'Alt' key.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam != VK_MENU))
alt_command = TRUE;
else if (GetAsyncKeyState(VK_MENU))
alt_pressed = TRUE;
// Ctrl-A => Select the log data
if ( (IsWindowVisible(hLogDialog)) && (GetKeyState(VK_CONTROL) & 0x8000) &&
(msg.message == WM_KEYDOWN) && (msg.wParam == 'A') ) {
@ -3478,6 +3485,15 @@ relaunch:
continue;
}
// Standalone 'Alt' key toggles progress report between percent, rate (if available)
// and remaining time (if availabe)
if (alt_pressed && !GetAsyncKeyState(VK_MENU)) {
alt_pressed = FALSE;
if (!alt_command)
update_progress_type = (update_progress_type + 1) % UPT_MAX;
alt_command = FALSE;
}
// Let the system handle dialog messages (e.g. those from the tab key)
if (!IsDialogMessage(hDlg, &msg) && !IsDialogMessage(hLogDialog, &msg)) {
TranslateMessage(&msg);