~aleteoryx/muditaos

c1a8e47c439acc89ac675cd1f5071744b21697e1 — Lukasz Mastalerz 2 years ago c96dc7d
[BH-1690] Add information about the connection to the PC

Added text with information about the connection to the main window
when the USB cable is connected to the PC
28 files changed, 229 insertions(+), 39 deletions(-)

M harmony_changelog.md
M image/system_a/data/lang/Deutsch.json
M image/system_a/data/lang/English.json
M image/system_a/data/lang/Espanol.json
M image/system_a/data/lang/Francais.json
M image/system_a/data/lang/Polski.json
M module-apps/apps-common/widgets/BellBaseLayout.cpp
M module-apps/apps-common/widgets/BellBaseLayout.hpp
M module-services/service-desktop/WorkerDesktop.cpp
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp
M products/BellHybrid/apps/application-bell-main/include/application-bell-main/presenters/HomeScreenPresenter.hpp
M products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp
M products/BellHybrid/apps/common/CMakeLists.txt
M products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp
A products/BellHybrid/apps/common/include/common/widgets/BellConnectionStatus.hpp
M products/BellHybrid/apps/common/include/common/widgets/LayoutVertical.hpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp
A products/BellHybrid/apps/common/src/widgets/BellConnectionStatus.cpp
M products/BellHybrid/apps/common/src/widgets/ClockVertical.cpp
M products/BellHybrid/apps/common/src/widgets/LayoutVertical.cpp
M products/BellHybrid/apps/common/src/windows/BellWelcomeWindow.cpp
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 24,6 24,7 @@

* Added error handling for incorrect audio formats and corrupted files inside Relaxation app
* Added error message when files limit is exceeded in Relaxation app
* Added label informing about PC connection.

### Changed / Improved


M image/system_a/data/lang/Deutsch.json => image/system_a/data/lang/Deutsch.json +1 -0
@@ 115,6 115,7 @@
    "app_bellmain_power_nap": "Kraft-Schl\u00e4fchen",
    "app_bellmain_relaxation": "Entspannung",
    "app_bellmain_settings": "Einstellungen",
    "app_bellmain_usb_status_connected": "Verbunden",
    "app_calculator_decimal_separator": ".",
    "app_calculator_equals": "GLEICH",
    "app_calculator_error": "Fehler",

M image/system_a/data/lang/English.json => image/system_a/data/lang/English.json +1 -0
@@ 150,6 150,7 @@
    "app_bellmain_power_nap": "Power nap",
    "app_bellmain_relaxation": "Relaxation",
    "app_bellmain_settings": "Settings",
    "app_bellmain_usb_status_connected": "Connected",
    "app_calculator_decimal_separator": ".",
    "app_calculator_equals": "EQUALS",
    "app_calculator_error": "Error",

M image/system_a/data/lang/Espanol.json => image/system_a/data/lang/Espanol.json +1 -0
@@ 114,6 114,7 @@
    "app_bellmain_power_nap": "Siesta",
    "app_bellmain_relaxation": "Relajaci\u00f3n",
    "app_bellmain_settings": "Ajustes",
    "app_bellmain_usb_status_connected": "Conectado",
    "app_calculator_decimal_separator": ",",
    "app_calculator_equals": "IGUAL A",
    "app_calculator_error": "Error",

M image/system_a/data/lang/Francais.json => image/system_a/data/lang/Francais.json +1 -0
@@ 118,6 118,7 @@
    "app_bellmain_power_nap": "Sieste \u00e9clair",
    "app_bellmain_relaxation": "Bruits de fond",
    "app_bellmain_settings": "Param\u00e8tres",
    "app_bellmain_usb_status_connected" : "Connect\u00e9",
    "app_calculator_decimal_separator": ",",
    "app_calculator_equals": "\u00c9QUIVAUT \u00c0",
    "app_calculator_error": "Erreur",

M image/system_a/data/lang/Polski.json => image/system_a/data/lang/Polski.json +1 -0
@@ 116,6 116,7 @@
    "app_bellmain_power_nap": "Drzemka",
    "app_bellmain_relaxation": "Relaks",
    "app_bellmain_settings": "Ustawienia",
    "app_bellmain_usb_status_connected" : "Połączony",
    "app_calculator_decimal_separator": ",",
    "app_calculator_equals": "WYNIK",
    "app_calculator_error": "B\u0142\u0105d",

M module-apps/apps-common/widgets/BellBaseLayout.cpp => module-apps/apps-common/widgets/BellBaseLayout.cpp +5 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BellBaseLayout.hpp"


@@ 14,8 14,9 @@ namespace gui
        setEdges(RectangleEdge::None);

        firstBox = new VBox(this);
        firstBox->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::first_layout_min_h);
        firstBox->setMaximumHeight(style::bell_base_layout::outer_layouts_h);
        firstBox->setMinimumSize(style::bell_base_layout::first_layout_w, style::bell_base_layout::first_layout_min_h);
        firstBox->setMargins(Margins(0U, style::bell_base_layout::first_top_margin, 0U, 0U));
        firstBox->setMaximumHeight(style::bell_base_layout::first_layout_h);
        firstBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
        firstBox->setEdges(RectangleEdge::None);
        firstBox->activeItem = false;


@@ 26,7 27,7 @@ namespace gui
        centerBox->setMinimumSize(style::bell_base_layout::center_layout_w, style::bell_base_layout::center_layout_h);

        lastBox = new VBox(this);
        lastBox->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
        lastBox->setMinimumSize(style::bell_base_layout::last_layout_w, style::bell_base_layout::last_layout_h);
        lastBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
        lastBox->setEdges(RectangleEdge::None);
        lastBox->activeItem = false;

M module-apps/apps-common/widgets/BellBaseLayout.hpp => module-apps/apps-common/widgets/BellBaseLayout.hpp +8 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 11,11 11,18 @@ namespace style::bell_base_layout
    constexpr inline auto w                   = style::window_width;
    constexpr inline auto h                   = style::window_height;
    constexpr inline auto first_layout_min_h  = 30U;
    constexpr inline auto first_top_margin    = 38U;
    constexpr inline auto first_layout_w      = 448U;
    constexpr inline auto first_layout_h      = 102U;
    constexpr inline auto last_layout_w       = 448U;
    constexpr inline auto last_layout_h       = 127U;
    constexpr inline auto outer_layouts_w     = 448U;
    constexpr inline auto outer_layouts_h     = 102U;
    constexpr inline auto center_layout_w     = w;
    constexpr inline auto center_layout_h     = 200U;
    constexpr inline auto arrows_layout_w     = 504U;
    constexpr inline auto info_box_top_margin = 18U;

} // namespace style::bell_base_layout

namespace gui

M module-services/service-desktop/WorkerDesktop.cpp => module-services/service-desktop/WorkerDesktop.cpp +2 -1
@@ 213,7 213,8 @@ bool WorkerDesktop::handleIrqQueueMessage(std::shared_ptr<sys::WorkerQueue> &que
    }
    else if (notification == bsp::USBDeviceStatus::Configured) {
        LOG_DEBUG("USB status: Configured");
        ownerService->bus.sendUnicast(std::make_shared<sdesktop::usb::USBConfigured>(), service::name::service_desktop);
        ownerService->bus.sendMulticast(std::make_shared<sdesktop::usb::USBConfigured>(),
                                        sys::BusChannel::USBNotifications);
        usbStatus = bsp::USBDeviceStatus::Configured;
    }
    else if (notification == bsp::USBDeviceStatus::Disconnected) {

M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +7 -0
@@ 25,6 25,7 @@
#include <apps-common/WindowsPopupFilter.hpp>
#include <WindowsStack.hpp>
#include <popups/Popups.hpp>
#include <service-desktop/DesktopMessages.hpp>

namespace app
{


@@ 46,6 47,7 @@ namespace app
        });

        bus.channels.push_back(sys::BusChannel::ServiceDBNotifications);
        bus.channels.push_back(sys::BusChannel::USBNotifications);

        addActionReceiver(manager::actions::ShowAlarm, [this](auto &&data) {
            switchWindow(gui::name::window::main_window, std::move(data));


@@ 72,6 74,11 @@ namespace app
            requestShutdownWindow(gui::window::name::bell_battery_shutdown);
            return actionHandled();
        });

        connect(typeid(sdesktop::usb::USBConfigured), [&](sys::Message *msg) -> sys::MessagePointer {
            homeScreenPresenter->setUSBStatusConnected();
            return sys::msgHandled();
        });
    }

    sys::ReturnCodes ApplicationBellMain::InitHandler()

M products/BellHybrid/apps/application-bell-main/include/application-bell-main/presenters/HomeScreenPresenter.hpp => products/BellHybrid/apps/application-bell-main/include/application-bell-main/presenters/HomeScreenPresenter.hpp +5 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 63,6 63,7 @@ namespace app::home_screen
        virtual void setTemperature(utils::temperature::Temperature newTemp)    = 0;
        virtual void setTextDescription(const UTF8 &desc)                       = 0;
        virtual void setBatteryLevelState(const Store::Battery &batteryContext) = 0;
        virtual void setUSBStatusConnected()                                    = 0;

        /// Various
        virtual void setLayout(gui::LayoutGenerator layoutGenerator) = 0;


@@ 97,6 98,7 @@ namespace app::home_screen
        virtual void switchToMenu()                                                              = 0;
        virtual void switchToBatteryStatus()                                                     = 0;
        virtual UTF8 getGreeting()                                                               = 0;
        virtual void setUSBStatusConnected()                                                     = 0;

        static constexpr auto defaultTimeout = std::chrono::milliseconds{5000};
    };


@@ 136,6 138,8 @@ namespace app::home_screen
        std::uint32_t getBatteryLvl() const override;
        bool isBatteryCharging() const override;
        bool isAlarmActivatedByLatch() const override;
        void setUSBStatusConnected() override;

        void incAlarmMinute();
        void decAlarmMinute();
        void switchToMenu();

M products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp => products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp +6 -0
@@ 259,4 259,10 @@ namespace app::home_screen
        std::uniform_int_distribution<std::mt19937::result_type> dist(0, greetingCollection.size() - 1);
        return greetingCollection[dist(*rngEngine)];
    };

    void HomeScreenPresenter::setUSBStatusConnected()
    {
        getView()->setUSBStatusConnected();
    }

} // namespace app::home_screen

M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +8 -0
@@ 190,4 190,12 @@ namespace gui
        return false;
    }

    void BellHomeScreenWindow::setUSBStatusConnected()
    {
        if (currentLayout) {
            currentLayout->setUSBStatusConnected();
            application->refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
        }
    }

} // namespace gui

M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp +2 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 40,6 40,7 @@ namespace gui
        void setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) override;
        void setSnoozeFormat(utils::time::Locale::TimeFormat fmt) override;
        bool updateBatteryStatus() override;
        void setUSBStatusConnected() override;

        std::shared_ptr<app::home_screen::AbstractPresenter> presenter;


M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +2 -0
@@ 41,6 41,7 @@ target_sources(application-bell-common
        src/widgets/AlarmIcon.cpp
        src/widgets/ListItems.cpp
        src/widgets/BellBattery.cpp
        src/widgets/BellConnectionStatus.cpp
        src/widgets/BellStatusClock.cpp
        src/widgets/DuoHBox.cpp
        src/widgets/ProgressTimerWithSnoozeTimer.cpp


@@ 99,6 100,7 @@ target_sources(application-bell-common
        include/common/popups/BellRebootWindow.hpp
        include/common/widgets/AlarmIcon.hpp
        include/common/widgets/BellBattery.hpp
        include/common/widgets/BellConnectionStatus.hpp
        include/common/widgets/BellSideListItemWithCallbacks.hpp
        include/common/widgets/BellStatusClock.hpp
        include/common/widgets/DuoHBox.hpp

M products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp => products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp +2 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 49,6 49,7 @@ namespace gui
        virtual void setViewState(app::home_screen::ViewState state)            = 0;
        virtual void setTextDescription(const UTF8 &desc)                       = 0;
        virtual void setBatteryLevelState(const Store::Battery &batteryContext) = 0;
        virtual void setUSBStatusConnected()                                    = 0;
        virtual void setTime(std::time_t newTime)                               = 0;
        virtual void setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt)    = 0;
        virtual std::time_t getAlarmTime() const                                = 0;

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp +16 -7
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 9,7 9,10 @@

namespace style::homescreen_classic
{
    constexpr inline auto status_box_layout_w = 350U;
    constexpr inline auto status_box_layout_w     = 350U;
    constexpr inline auto info_box_layout_h       = 70U;
    constexpr inline auto connection_box_layout_h = 44U;

} // namespace style::homescreen_classic
namespace gui
{


@@ 20,6 23,7 @@ namespace gui
    class TimeSetFmtSpinner;
    class SnoozeTimer;
    class BellBattery;
    class BellConnectionStatus;
    class DuoHBox;

    enum class LayoutClassicVersion


@@ 53,6 57,7 @@ namespace gui
        auto getAlarmTime() const -> std::time_t override;
        auto setAlarmTime(std::time_t newTime) -> void override;
        auto setSnoozeTime(std::time_t newTime) -> void override;
        auto setUSBStatusConnected() -> void override;

        auto getSnoozeTimer() -> SnoozeTimer * override;
        auto getLayout() -> Item * override;


@@ 63,11 68,15 @@ namespace gui
        virtual bool isBatteryVisibilityAllowed(const Store::Battery &batteryContext);
        void removeTextDescription();

        HBox *timeHBox            = nullptr;
        TimeSetFmtSpinner *time   = nullptr;
        HBox *statusBox           = nullptr;
        BellBattery *battery      = nullptr;
        TextFixedSize *bottomText = nullptr;
        VBox *widgetBox                        = nullptr;
        HBox *timeHBox                         = nullptr;
        TimeSetFmtSpinner *time                = nullptr;
        HBox *statusBox                        = nullptr;
        HBox *infoBox                          = nullptr;
        HBox *connectionBox                    = nullptr;
        BellBattery *battery                   = nullptr;
        BellConnectionStatus *connectionStatus = nullptr;
        TextFixedSize *bottomText              = nullptr;
        AlarmSetSpinner *alarm    = nullptr;
        SnoozeTimer *snoozeTimer  = nullptr;
    };

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp +2 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 44,6 44,7 @@ namespace gui
        auto setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto getAlarmTime() const -> std::time_t override;
        auto setAlarmTime(std::time_t newTime) -> void override;
        auto setUSBStatusConnected() -> void override;

        auto getSnoozeTimer() -> SnoozeTimer * override;
        auto getLayout() -> Item * override;

A products/BellHybrid/apps/common/include/common/widgets/BellConnectionStatus.hpp => products/BellHybrid/apps/common/include/common/widgets/BellConnectionStatus.hpp +24 -0
@@ 0,0 1,24 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Units.hpp>
#include <gui/widgets/BoxLayout.hpp>
#include <gui/widgets/Image.hpp>

namespace gui
{

    class BellConnectionStatus : public gui::HBox
    {
      public:
        BellConnectionStatus(Item *parent);
        void setFont(const UTF8 &fontName);
        void checkIfConnected(const Store::Battery::State &state);
        void setConnected();

      private:
        Text *statusText = nullptr;
    };
} // namespace gui

M products/BellHybrid/apps/common/include/common/widgets/LayoutVertical.hpp => products/BellHybrid/apps/common/include/common/widgets/LayoutVertical.hpp +7 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 15,8 15,9 @@ namespace style::homescreen_vertical
    constexpr inline auto digit_box_w       = 125U;
    constexpr inline auto leftMargin        = 60U;
    constexpr inline auto rightMargin       = 60U;
    constexpr inline auto topNegativeMargin = -35;
    constexpr inline auto topNegativeMargin = -10;
    constexpr inline auto info_line_h       = 44U;
    constexpr inline auto connectionBoxSize = 44U;
} // namespace style::homescreen_vertical

namespace gui


@@ 31,6 32,7 @@ namespace gui
    class BellBattery;
    class DuoHBox;
    class Icon;
    class BellConnectionStatus;

    class LayoutVertical : public HBox
    {


@@ 49,9 51,12 @@ namespace gui
        ClockVertical *time = nullptr;
        VBox *leftBox       = nullptr;
        VBox *rightBox      = nullptr;
        HBox *connectionBox = nullptr;

        // Set Alarm Screen
        AlarmIcon *alarmTopIcon               = nullptr;
        TimeSetFmtSpinner *setAlarmFmtSpinner = nullptr;

        BellConnectionStatus *connectionStatus = nullptr;
    };
}; // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp +37 -4
@@ 1,9 1,10 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutClassic.hpp"
#include "data/BellMainStyle.hpp"
#include "widgets/BellBattery.hpp"
#include "widgets/BellConnectionStatus.hpp"
#include "widgets/DuoHBox.hpp"
#include "widgets/SnoozeTimer.hpp"



@@ 64,18 65,42 @@ namespace gui

        statusBox = new HBox(this->lastBox);
        statusBox->setMinimumSize(style::homescreen_classic::status_box_layout_w,
                                  style::bell_base_layout::outer_layouts_h);
                                  style::bell_base_layout::last_layout_h);
        statusBox->setEdges(RectangleEdge::None);
        statusBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        statusBox->setVisible(true);

        battery = new BellBattery(statusBox, gui::BatteryWidthMode::FitToContent);
        widgetBox = new VBox(statusBox);
        widgetBox->setMinimumSize(style::homescreen_classic::status_box_layout_w,
                                  style::bell_base_layout::last_layout_h);
        widgetBox->setEdges(RectangleEdge::None);
        widgetBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        widgetBox->setVisible(true);

        infoBox = new HBox(widgetBox);
        infoBox->setMinimumSize(style::homescreen_classic::status_box_layout_w,
                                style::homescreen_classic::info_box_layout_h);
        infoBox->setEdges(RectangleEdge::None);
        infoBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        infoBox->setVisible(true);

        connectionBox = new HBox(widgetBox);
        connectionBox->setMinimumSize(style::homescreen_classic::status_box_layout_w,
                                      style::homescreen_classic::connection_box_layout_h);
        connectionBox->setEdges(RectangleEdge::None);
        connectionBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        connectionBox->setVisible(true);

        battery = new BellBattery(infoBox, gui::BatteryWidthMode::FitToContent);
        battery->setMargins(Margins(0U, style::bell_base_layout::info_box_top_margin, 0U, 0U));
        battery->setMaximumSize(battery::battery_widget_w, battery::battery_widget_h);
        battery->setEdges(RectangleEdge::None);
        battery->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        battery->setVisible(true);
        battery->setVisible(false);
        battery->setBatteryPercentMode(BatteryPercentMode::Show);

        connectionStatus = new BellConnectionStatus(connectionBox);

        bottomText = new TextFixedSize(this->lastBox, 0, 0, 0, 0);
        bottomText->setMaximumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
        bottomText->setFont(mainWindow::bottomDescription::font_small);


@@ 212,6 237,8 @@ namespace gui
    void HomeScreenLayoutClassic::setBatteryLevelState(const Store::Battery &batteryContext)
    {
        battery->update(batteryContext.level, isBatteryCharging(batteryContext.state));
        connectionStatus->checkIfConnected(batteryContext.state);

        if (isBatteryVisibilityAllowed(batteryContext)) {
            battery->setVisible(true);
        }


@@ 219,6 246,7 @@ namespace gui
            battery->setVisible(false);
        }
        battery->informContentChanged();
        connectionStatus->informContentChanged();
    }

    void HomeScreenLayoutClassic::setTime(std::time_t newTime)


@@ 268,4 296,9 @@ namespace gui
    {
        return this;
    }
    auto HomeScreenLayoutClassic::setUSBStatusConnected() -> void
    {
        connectionStatus->setConnected();
        connectionStatus->informContentChanged();
    }
}; // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp +5 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutClassicWithAmPm.hpp"


@@ 23,7 23,7 @@ namespace gui

        battery->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));

        fmt = new TextFixedSize(statusBox);
        fmt = new TextFixedSize(infoBox);
        fmt->setMaximumSize(style::homescreen_classic::status_box_layout_w, style::bell_base_layout::outer_layouts_h);
        fmt->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        fmt->setFont(mainWindow::bottomDescription::font_normal);


@@ 31,6 31,7 @@ namespace gui
        fmt->activeItem = false;
        fmt->drawUnderline(false);
        fmt->setText("");
        fmt->setMargins({0, style::bell_base_layout::info_box_top_margin, 0, 0});
    }

    auto HomeScreenLayoutClassicWithAmPm::setTime(std::time_t newTime) -> void


@@ 53,10 54,10 @@ namespace gui
    void HomeScreenLayoutClassicWithAmPm::handleContentChanged()
    {
        if (battery->visible) {
            fmt->setMargins({20, 0, 0, 0});
            fmt->setMargins({20, style::bell_base_layout::info_box_top_margin, 0, 0});
        }
        else {
            fmt->setMargins({0, 0, 0, 0});
            fmt->setMargins({0, style::bell_base_layout::info_box_top_margin, 0, 0});
        }
        HomeScreenLayoutClassic::handleContentChanged();
    }

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp +5 -5
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutClassicWithDate.hpp"


@@ 30,11 30,11 @@ namespace gui
        date->activeItem = false;
        date->drawUnderline(false);
        date->setText("00/00");
        date->setMargins({0, 0, 20, 0});
        date->setMargins({0, style::bell_base_layout::info_box_top_margin, 20, 0});

        statusBox->removeWidget(battery);
        statusBox->addWidget(date);
        statusBox->addWidget(battery);
        infoBox->removeWidget(battery);
        infoBox->addWidget(date);
        infoBox->addWidget(battery);

        // Assume format is 12h
        time->setMargins({style::homescreen_classic::ampm_time_margin_w, 0, 0, 0});

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp +11 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutVertical.hpp"


@@ 6,6 6,7 @@
#include "widgets/BellBattery.hpp"
#include "widgets/DuoHBox.hpp"
#include "widgets/SnoozeTimer.hpp"
#include "widgets/BellConnectionStatus.hpp"

#include <apps-common/actions/AlarmRingingData.hpp>
#include <gui/widgets/Icon.hpp>


@@ 149,6 150,8 @@ namespace gui
    void HomeScreenLayoutVertical::setBatteryLevelState(const Store::Battery &batteryContext)
    {
        battery->update(batteryContext.level, isBatteryCharging(batteryContext.state));
        connectionStatus->checkIfConnected(batteryContext.state);

        if (isBatteryVisibilityAllowed(batteryContext)) {
            battery->setVisible(true);
        }


@@ 156,6 159,7 @@ namespace gui
            battery->setVisible(false);
        }
        battery->informContentChanged();
        connectionStatus->informContentChanged();
    }

    void HomeScreenLayoutVertical::setTime(std::time_t newTime)


@@ 194,4 198,10 @@ namespace gui
    {
        return this;
    }
    auto HomeScreenLayoutVertical::setUSBStatusConnected() -> void
    {
        connectionStatus->setConnected();
        connectionStatus->informContentChanged();
    }

}; // namespace gui

A products/BellHybrid/apps/common/src/widgets/BellConnectionStatus.cpp => products/BellHybrid/apps/common/src/widgets/BellConnectionStatus.cpp +50 -0
@@ 0,0 1,50 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <EventStore.hpp>
#include <common/widgets/BellConnectionStatus.hpp>
#include <gui/widgets/text/TextFixedSize.hpp>
#include "i18n/i18n.hpp"

namespace
{
    constexpr auto usb_connected_status     = "app_bellmain_usb_status_connected";
    constexpr inline auto status_text_max_w = 350U;
    constexpr inline auto status_text_max_h = 102U;

} // namespace

namespace gui
{
    BellConnectionStatus::BellConnectionStatus(Item *parent) : HBox(parent)
    {
        statusText = new Text(parent);
        statusText->setMaximumSize(status_text_max_w, status_text_max_h);
        statusText->setFont(style::window::font::verybiglight);
        statusText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        statusText->setEdges(RectangleEdge::None);
        statusText->setEditMode(EditMode::Browse);
        statusText->activeItem = false;
        statusText->drawUnderline(false);
        statusText->setText(utils::translate(usb_connected_status));
        statusText->setVisible(true);
    }

    void BellConnectionStatus::setFont(const UTF8 &fontName)
    {
        statusText->setFont(fontName);
    }

    void BellConnectionStatus::checkIfConnected(const Store::Battery::State &state)
    {
        if (state == Store::Battery::State::Discharging) {
            statusText->setVisible(false);
        }
    }

    void BellConnectionStatus::setConnected()
    {
        statusText->setVisible(true);
    }

} // namespace gui

M products/BellHybrid/apps/common/src/widgets/ClockVertical.cpp => products/BellHybrid/apps/common/src/widgets/ClockVertical.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <common/widgets/ClockVertical.hpp>


@@ 59,7 59,7 @@ namespace gui

        hBoxMinutes = new gui::HBox(this, 0, 0, style::homescreen_vertical::center_box_w, 0);
        hBoxMinutes->setEdges(gui::RectangleEdge::None);
        hBoxMinutes->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        hBoxMinutes->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Bottom));
        hBoxMinutes->setMargins(gui::Margins(0, 0, 0, 0));
        hBoxMinutes->setMinimumSize(style::homescreen_vertical::center_box_w, style::homescreen_vertical::center_box_h);


M products/BellHybrid/apps/common/src/widgets/LayoutVertical.cpp => products/BellHybrid/apps/common/src/widgets/LayoutVertical.cpp +16 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "widgets/LayoutVertical.hpp"


@@ 17,6 17,7 @@
#include <widgets/AlarmIcon.hpp>
#include <widgets/AlarmSetSpinner.hpp>
#include <widgets/ClockVertical.hpp>
#include <widgets/BellConnectionStatus.hpp>

namespace gui
{


@@ 47,9 48,22 @@ namespace gui

        time = new ClockVertical(centerBox);
        time->setFont(style::window::font::colossal);
        time->setMinimumSize(style::homescreen_vertical::center_box_w, style::window_height);
        time->setMinimumSize(style::homescreen_vertical::center_box_w,
                             style::window_height - style::homescreen_vertical::connectionBoxSize);
        time->setEdges(RectangleEdge::None);
        time->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        time->setMargins(Margins(0, 0, 0, -30));

        connectionBox = new HBox(centerBox);
        connectionBox->setMinimumSize(style::homescreen_vertical::center_box_w,
                                      style::homescreen_vertical::connectionBoxSize);
        connectionBox->setEdges(RectangleEdge::None);
        connectionBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        connectionBox->setVisible(true);

        leftBox->setMargins(Margins({style::homescreen_vertical::leftMargin, 0, 0, 0}));

        connectionStatus = new BellConnectionStatus(connectionBox);

        rightBox = new VBox(mainScreen, 0, 0, 0, 0);
        rightBox->setMinimumSize(style::homescreen_vertical::side_box_w, style::window_height);

M products/BellHybrid/apps/common/src/windows/BellWelcomeWindow.cpp => products/BellHybrid/apps/common/src/windows/BellWelcomeWindow.cpp +1 -2
@@ 46,8 46,7 @@ namespace gui
        midLine->setEdges(RectangleEdge::Bottom);

        auto informationBody = new HBox(body->lastBox);
        informationBody->setMinimumSize(style::bell_base_layout::outer_layouts_w,
                                        style::bell_base_layout::outer_layouts_h);
        informationBody->setMinimumSize(style::bell_base_layout::last_layout_w, style::bell_base_layout::last_layout_h);
        informationBody->setEdges(RectangleEdge::None);
        informationBody->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));