UI/updater: Restart progress bar when installing updates

When updating large files such as libcef, the patching process can take a
decent amount of time. Previously the progress bar would remain at 100%
after completing the downloads, so the user may think the updater has
frozen. Now it shows the process of the install / patching process.
上级 c8c6f076
......@@ -1211,9 +1211,25 @@ static bool Update(wchar_t *cmdLine)
/* ------------------------------------- *
* Install updates */
int updatesInstalled = 0;
int lastPosition = 0;
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, 0, 0);
for (update_t &update : updates) {
if (!UpdateFile(update))
if (!UpdateFile(update)) {
return false;
} else {
updatesInstalled++;
int position = (int)(((float)updatesInstalled /
(float)completedUpdates) * 100.0f);
if (position > lastPosition) {
lastPosition = position;
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, position, 0);
}
}
}
/* If we get here, all updates installed successfully so we can purge
......@@ -1227,6 +1243,9 @@ static bool Update(wchar_t *cmdLine)
DeleteFile(update.tempPath.c_str());
}
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, 100, 0);
Status(L"Update complete.");
SetDlgItemText(hwndMain, IDC_BUTTON, L"Launch OBS");
return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册