From df05c14fe9ce2b09e8cd5c3c759bc3a792ad4c3e Mon Sep 17 00:00:00 2001 From: Barinade Date: Mon, 22 Apr 2024 19:33:56 -0500 Subject: [PATCH] display more detailed info about score uploads in progress --- .../BGAnimations/playerInfoFrame/main.lua | 7 ++++++- Themes/Til Death/BGAnimations/_PlayerInfo.lua | 18 ++++++++++++++++-- src/Etterna/Singletons/DownloadManager.cpp | 12 ++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua b/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua index e306c84700..74859cbb08 100644 --- a/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua +++ b/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua @@ -995,7 +995,12 @@ t[#t+1] = Def.ActorFrame { ToolTipCommand = function(self) -- weird check here to throw out nan if isOver(self) and self.percent ~= nil and self.percent ~= 1 and self.percent == self.percent then - local st = string.format("%s: %5.2f%%", translations["UploadPercent"], self.percent * 100) + local st = string.format( + "%s: %5.2f%% (%d/%d)", + translations["UploadPercent"], + self.percent * 100, + DLMAN:GetQueuedScoreUploadTotal() * self.percent, + DLMAN:GetQueuedScoreUploadTotal()) TOOLTIP:SetText(st) TOOLTIP:Show() else diff --git a/Themes/Til Death/BGAnimations/_PlayerInfo.lua b/Themes/Til Death/BGAnimations/_PlayerInfo.lua index d8b31f6e50..3d2b9c4e12 100644 --- a/Themes/Til Death/BGAnimations/_PlayerInfo.lua +++ b/Themes/Til Death/BGAnimations/_PlayerInfo.lua @@ -501,7 +501,7 @@ t[#t + 1] = Def.ActorFrame { }, -- ok coulda done this as a separate object to avoid copy paste but w.e -- upload progress bar bg - Def.Quad { + UIElements.QuadButton(1,1) .. { InitCommand = function(self) self:xy(SCREEN_WIDTH * 2/3, AvatarY + 41):zoomto(uploadbarwidth, uploadbarheight) self:diffuse(color("#111111")):diffusealpha(0):halign(0) @@ -510,8 +510,22 @@ t[#t + 1] = Def.ActorFrame { self:diffusealpha(1) if params.percent == 1 then self:diffusealpha(0) + if isOver(self) then + TOOLTIP:Hide() + end end - end + end, + MouseOverCommand = function(self) + if not self:IsVisible() then return end + local remaining = DLMAN:GetQueuedScoreUploadsRemaining() + local total = DLMAN:GetQueuedScoreUploadTotal() + TOOLTIP:SetText("Remaining Scores: "..remaining.." out of "..total) + TOOLTIP:Show() + end, + MouseOutCommand = function(self) + if not self:IsVisible() then return end + TOOLTIP:Hide() + end, }, -- fill bar Def.Quad { diff --git a/src/Etterna/Singletons/DownloadManager.cpp b/src/Etterna/Singletons/DownloadManager.cpp index f863a7ebab..a45930e575 100644 --- a/src/Etterna/Singletons/DownloadManager.cpp +++ b/src/Etterna/Singletons/DownloadManager.cpp @@ -6475,6 +6475,16 @@ class LunaDownloadManager : public Luna p->ForceUploadAllPBs(); return 0; } + static int GetQueuedScoreUploadsRemaining(T* p, lua_State* L) + { + lua_pushnumber(L, DLMAN->ScoreUploadSequentialQueue.size()); + return 1; + } + static int GetQueuedScoreUploadTotal(T* p, lua_State* L) + { + lua_pushnumber(L, DLMAN->sequentialScoreUploadTotalWorkload); + return 1; + } LunaDownloadManager() { ADD_METHOD(GetUserCountryCode); @@ -6511,6 +6521,8 @@ class LunaDownloadManager : public Luna ADD_METHOD(UploadScoresForChart); ADD_METHOD(UploadScoresForPack); ADD_METHOD(UploadAllScores); + ADD_METHOD(GetQueuedScoreUploadsRemaining); + ADD_METHOD(GetQueuedScoreUploadTotal); ADD_METHOD(Logout); } };