diff --git a/UI/win-update/updater/updater.cpp b/UI/win-update/updater/updater.cpp index 10f850d38..80d999184 100644 --- a/UI/win-update/updater/updater.cpp +++ b/UI/win-update/updater/updater.cpp @@ -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;