From 20ef02ceccbb61a3c4e157fe02aaaa454980dced Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 25 Jul 2018 03:53:44 -0400 Subject: [PATCH] move download progress to screensystemoverlay, same as reload --- .../ScreenSystemLayer overlay/default.lua | 36 +++++++++++++++++-- src/ScreenInstallOverlay.cpp | 33 +++++++++++------ 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua b/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua index 45030a37b5..17441c1208 100644 --- a/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua +++ b/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua @@ -38,8 +38,11 @@ t[#t+1] = Def.ActorFrame { end } +-- song reload local www = 1366 * 0.8 local hhh = SCREEN_HEIGHT * 0.8 +local rtzoom = 1 + t[#t+1] = Def.ActorFrame { DFRStartedMessageCommand=function(self) self:visible(true) @@ -59,7 +62,7 @@ t[#t+1] = Def.ActorFrame { Def.BitmapText{ Font="Common Normal", InitCommand=function(self) - self:diffusealpha(0.9):settext(""):maxwidth(www/4-40) + self:diffusealpha(0.9):settext(""):maxwidth(www/4-40/rtzoom):zoom(rtzoom) end, DFRUpdateMessageCommand=function(self,params) self:settext(params.txt) @@ -67,5 +70,34 @@ t[#t+1] = Def.ActorFrame { } } - +local dltzoom = 0.5 +-- download queue/progress +t[#t+1] = Def.ActorFrame { + AllDownloadsCompletedMessageCommand=function(self) + self:visible(false) + end, + DLProgressAndQueueUpdateMessageCommand=function(self) + self:visible(true) + end, + BeginCommand=function(self) + self:visible(false) + self:x(www/8 + 10):y(SCREEN_TOP + hhh/8 +10) + end, + Def.Quad { + Name = "BGQframe", + InitCommand=function(self) + self:zoomto(www/4, hhh/4):diffuse(color("0.1,0.1,0.1,0.8")) + end, + }, + Def.BitmapText{ + Font="Common Normal", + InitCommand=function(self) + self:xy(-www/8 + 10, -hhh/8):diffusealpha(0.9):settext("5 items in queue:\ndoot\nmcscoot"):maxwidth((www/4-40)/dltzoom):halign(0):valign(0):zoom(dltzoom) + end, + DLProgressAndQueueUpdateMessageCommand=function(self,params) + self:settext(params.dlsize.. " items currently downloading\n".. params.dlprogress.."\n\n"..params.queuesize.." items in download queue:\n"..params.queuedpacks) + self:GetParent():GetChild("BGQframe"):zoomy(self:GetHeight() - hhh/4) + end, + }, +} return t diff --git a/src/ScreenInstallOverlay.cpp b/src/ScreenInstallOverlay.cpp index d387f39020..bd506182f2 100644 --- a/src/ScreenInstallOverlay.cpp +++ b/src/ScreenInstallOverlay.cpp @@ -137,16 +137,29 @@ void ScreenInstallOverlay::Update(float fDeltaTime) DoInstalls(args); } #if !defined(WITHOUT_NETWORKING) - vector vsMessages; - if (!DLMAN->DownloadQueue.empty()) { - vsMessages.push_back(RString(to_string(DLMAN->DownloadQueue.size())) + " items left in download queue.\nCurrently downloading:"); - } - for(auto &dl : DLMAN->downloads) - { - vsMessages.push_back(dl.second->Status()); - } - m_textStatus.SetText(join("\n", vsMessages)); - + if (!DLMAN->downloads.empty()) { + Message msg("DLProgressAndQueueUpdate"); + + vector dls; + for (auto &dl : DLMAN->downloads) { + dls.push_back(dl.second->Status()); + } + msg.SetParam("dlsize", DLMAN->downloads.size()); + msg.SetParam("dlprogress", join("\n", dls)); + + if (!DLMAN->DownloadQueue.empty()) { + vector cue; + for (auto &q : DLMAN->DownloadQueue) { + cue.push_back(q->name); + } + msg.SetParam("queuesize", DLMAN->DownloadQueue.size()); + msg.SetParam("queuedpacks", join("\n", cue)); + } + msg.SetParam("queuesize", 0); + msg.SetParam("queuedpacks", RString("")); + MESSAGEMAN->Broadcast(msg); + } else + MESSAGEMAN->Broadcast("AllDownloadsCompleted"); // silly to handle this through updates but im not sure where is better atm -mina #endif }