From c832a74114782c04f69c2b0ce695a9a17887ea5c Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 22 Jul 2021 09:00:26 +0200 Subject: [PATCH] [color] fix statistics view (now displays proper numbers) --- radio/src/gui/colorlcd/view_statistics.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/radio/src/gui/colorlcd/view_statistics.h b/radio/src/gui/colorlcd/view_statistics.h index f9632e628..5305dbca5 100644 --- a/radio/src/gui/colorlcd/view_statistics.h +++ b/radio/src/gui/colorlcd/view_statistics.h @@ -32,19 +32,19 @@ class DebugInfoNumber : public Window public: DebugInfoNumber(Window * parent, const rect_t & rect, std::function numberHandler, LcdFlags textFlags = 0, const char * prefix = nullptr, const char * suffix = nullptr): Window(parent, rect, 0, textFlags), - numberHandler(std::move(numberHandler)), prefix(prefix), suffix(suffix) { - coord_t prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS)); - new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS)); - new DynamicNumber(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, [] { - return menusStack.available(); - }); + coord_t prefixSize = 0; + if (prefix != nullptr) { + prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS)); + new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS)); + } + new DynamicNumber(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, + numberHandler); } protected: - std::function numberHandler; const char * prefix; const char * suffix; };