ui improve

This commit is contained in:
2026-04-25 10:34:50 +03:00
parent 7515e0334b
commit a2e874de85
9 changed files with 162 additions and 108 deletions
+10 -5
View File
@@ -19,17 +19,17 @@ namespace ui {
TransferOverlay(const std::string &title)
: Overlay(OvlX, OvlY, OvlW, OvlH, pu::ui::Color(30, 30, 30, 220))
{
titleText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 30, title);
titleText = pu::ui::elm::TextBlock::New(40, 30, title);
titleText->SetColor(pu::ui::Color(255, 255, 255, 255));
statusText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 90, "");
statusText = pu::ui::elm::TextBlock::New(40, 90, "");
statusText->SetColor(pu::ui::Color(180, 180, 180, 255));
progressBar = pu::ui::elm::ProgressBar::New(OvlX + 40, OvlY + 140, OvlW - 80, 20, 100.0);
progressBar = pu::ui::elm::ProgressBar::New(40, 140, OvlW - 80, 20, 100.0);
progressBar->SetProgressColor(pu::ui::Color(100, 180, 255, 255));
progressBar->SetBackgroundColor(pu::ui::Color(70, 70, 70, 255));
hintText = pu::ui::elm::TextBlock::New(OvlX + 40, OvlY + 195, "Press B to cancel");
hintText = pu::ui::elm::TextBlock::New(40, 195, "Press B to cancel");
hintText->SetColor(pu::ui::Color(130, 130, 130, 255));
this->Add(titleText);
@@ -40,7 +40,12 @@ namespace ui {
PU_SMART_CTOR(TransferOverlay)
void SetStatus(const std::string &status) {
statusText->SetText(status);
static constexpr size_t MaxChars = 48;
if (status.size() > MaxChars) {
statusText->SetText(status.substr(0, MaxChars - 3) + "...");
} else {
statusText->SetText(status);
}
}
void SetProgress(double val) {