提交 02a5d3e5 编写于 作者: R Richard Stanway

UI/updater: Add marquee progress bar for existing file check

This can take a while on a hard drive since it hashes the entire OBS
installation, show a undetermined progress marquee to avoid users
thinking that the updater has frozen.
上级 5048fe20
......@@ -1141,6 +1141,12 @@ static bool Update(wchar_t *cmdLine)
SetDlgItemTextW(hwndMain, IDC_STATUS,
L"Searching for available updates...");
HWND hProgress = GetDlgItem(hwndMain, IDC_PROGRESS);
LONG_PTR style = GetWindowLongPtr(hProgress, GWL_STYLE);
SetWindowLongPtr(hProgress, GWL_STYLE, style | PBS_MARQUEE);
SendDlgItemMessage(hwndMain, IDC_PROGRESS, PBM_SETMARQUEE, 1, 0);
/* ------------------------------------- *
* Check if updating portable build */
......@@ -1250,6 +1256,9 @@ static bool Update(wchar_t *cmdLine)
}
}
SendDlgItemMessage(hwndMain, IDC_PROGRESS, PBM_SETMARQUEE, 0, 0);
SetWindowLongPtr(hProgress, GWL_STYLE, style);
/* ------------------------------------- *
* Exit if updates already installed */
......@@ -1460,8 +1469,10 @@ static DWORD WINAPI UpdateThread(void *arg)
if (WaitForSingleObject(cancelRequested, 0) == WAIT_OBJECT_0)
Status(L"Update aborted.");
SendDlgItemMessage(hwndMain, IDC_PROGRESS, PBM_SETSTATE,
PBST_ERROR, 0);
HWND hProgress = GetDlgItem(hwndMain, IDC_PROGRESS);
LONG_PTR style = GetWindowLongPtr(hProgress, GWL_STYLE);
SetWindowLongPtr(hProgress, GWL_STYLE, style & ~PBS_MARQUEE);
SendMessage(hProgress, PBM_SETSTATE, PBST_ERROR, 0);
SetDlgItemText(hwndMain, IDC_BUTTON, L"Exit");
EnableWindow(GetDlgItem(hwndMain, IDC_BUTTON), true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册