~aleteoryx/muditaos

33825dec3048f8c2302a7ead252a2052041eb71d — Tomasz Rybarski 4 years ago f46a7ef
[BH-1404] Aligment of two elements

Two elements in statusbox are properly aligned
M products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp => products/BellHybrid/apps/common/include/common/widgets/BellBattery.hpp +1 -2
@@ 19,8 19,7 @@ namespace gui
        constexpr auto font_small            = style::window::font::largelight;
        constexpr auto image_h               = 64;
        constexpr auto image_w               = 64U;
        constexpr auto image_left_margin     = 24U;
        constexpr auto image_left_margin_big = 48U;
        constexpr auto image_left_margin     = 0U;
        constexpr auto image_right_margin    = 10U;
        constexpr auto percent_h             = 102U;
        constexpr auto percent_w             = 106U;

M products/BellHybrid/apps/common/src/widgets/BellBattery.cpp => products/BellHybrid/apps/common/src/widgets/BellBattery.cpp +0 -22
@@ 16,7 16,6 @@ namespace

    constexpr auto betteryFullLevel = 100;
    constexpr auto lowBatteryLimit  = 20;
    constexpr auto singleDigitLimit = 10;
} // namespace

namespace gui


@@ 47,29 46,8 @@ namespace gui

        if (batteryContext.state == Store::Battery::State::Charging) {
            img->set(battery::battery_charging, gui::ImageTypeSpecifier::W_M);

            if (level == betteryFullLevel) {
                img->setMargins(gui::Margins(0, 0, battery::image_right_margin, 0));
                img->informContentChanged();
            }
            else if (level < singleDigitLimit) {
                img->setMargins(gui::Margins(battery::image_left_margin_big, 0, battery::image_right_margin, 0));
                img->informContentChanged();
            }
            else {
                img->setMargins(gui::Margins(battery::image_left_margin, 0, battery::image_right_margin, 0));
                img->informContentChanged();
            }
        }
        else {
            if (level <= lowBatteryLimit) {
                if (level < singleDigitLimit) {
                    img->setMargins(gui::Margins(battery::image_left_margin_big, 0, battery::image_right_margin, 0));
                }
                else {
                    img->setMargins(gui::Margins(battery::image_left_margin, 0, battery::image_right_margin, 0));
                }
            }
            img->set(image->data(), gui::ImageTypeSpecifier::W_M);
            img->informContentChanged();
        }