~aleteoryx/muditaos

1860bf210f5f128ee8cf780c0cb332abc918dbd1 — tkros 5 years ago f893ca8
[EGD-5744] Phone mode status bar widget

Added phone mode widget to top bar. The widget is mutually exclusive
with NAT widget. Phone mode is determined using phone mode observer.
M module-apps/Application.cpp => module-apps/Application.cpp +19 -0
@@ 119,6 119,14 @@ namespace app
                [&](sys::Message *msg) -> sys::MessagePointer { return handleGetDOM(msg); });
        connect(typeid(AppUpdateWindowMessage),
                [&](sys::Message *msg) -> sys::MessagePointer { return handleUpdateWindow(msg); });

        // handle phone mode changes
        bus.channels.push_back(sys::BusChannel::PhoneModeChanges);
        phoneModeObserver->connect(this);
        phoneModeObserver->subscribe(
            [&](sys::phone_modes::PhoneMode phoneMode, sys::phone_modes::Tethering tetheringMode) {
                handlePhoneModeChanged(phoneMode, tetheringMode);
            });
    }

    Application::~Application() noexcept


@@ 174,6 182,7 @@ namespace app
            window->updateSignalStrength();
            window->updateNetworkAccessTechnology();
            window->updateTime();
            window->updatePhoneMode(phoneModeObserver->getCurrentPhoneMode());

            auto message = std::make_shared<service::gui::DrawMessage>(window->buildDrawList(), mode);



@@ 675,6 684,16 @@ namespace app
        sender->bus.sendUnicast(msg, application);
    }

    void Application::handlePhoneModeChanged(sys::phone_modes::PhoneMode mode, sys::phone_modes::Tethering tethering)
    {
        // only foreground rendering application will react to mode changes
        if (state != State::ACTIVE_FORGROUND) {
            return;
        }

        refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
    }

    void Application::attachPopups(const std::vector<gui::popup::ID> &popupsList)
    {
        using namespace gui::popup;

M module-apps/Application.hpp => module-apps/Application.hpp +5 -0
@@ 320,6 320,11 @@ namespace app
        /// Method closing application's windows.
        virtual void destroyUserInterface() = 0;

        /// Handle the change of phone mode and tethering mode
        /// @param mode new phone mode
        /// @param tethering new tethering mode
        void handlePhoneModeChanged(sys::phone_modes::PhoneMode mode, sys::phone_modes::Tethering tethering);

        /// @ingrup AppWindowStack
        WindowsStack windowsStack;
        WindowsFactory windowsFactory;

M module-apps/TopBarManager.cpp => module-apps/TopBarManager.cpp +1 -1
@@ 18,6 18,6 @@ namespace app

    void TopBarManager::set(gui::top_bar::TimeMode timeMode)
    {
        topBarConfiguration.set(timeMode);
        topBarConfiguration.setTimeMode(timeMode);
    }
} // namespace app

M module-apps/application-call/ApplicationCall.cpp => module-apps/application-call/ApplicationCall.cpp +2 -1
@@ 38,7 38,8 @@ namespace app
                                         Indicator::Time,
                                         Indicator::Battery,
                                         Indicator::SimCard,
                                         Indicator::NetworkAccessTechnology});
                                         Indicator::NetworkAccessTechnology,
                                         Indicator::PhoneMode});
        addActionReceiver(manager::actions::Call, [this](auto &&data) {
            switchWindow(window::name_call, std::forward<decltype(data)>(data));
            return actionHandled();

M module-apps/application-desktop/ApplicationDesktop.cpp => module-apps/application-desktop/ApplicationDesktop.cpp +2 -1
@@ 49,7 49,8 @@ namespace app
                                         Indicator::Time,
                                         Indicator::Battery,
                                         Indicator::SimCard,
                                         Indicator::NetworkAccessTechnology});
                                         Indicator::NetworkAccessTechnology,
                                         Indicator::PhoneMode});
        bus.channels.push_back(sys::BusChannel::ServiceDBNotifications);

        addActionReceiver(app::manager::actions::RequestPin, [this](auto &&data) {

M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +1 -1
@@ 74,7 74,7 @@ namespace gui
    {
        auto app            = getAppDesktop();
        const auto isLocked = app->lockHandler.isScreenLocked();
        appConfiguration.set(top_bar::Indicator::Lock, isLocked);
        appConfiguration.setIndicator(top_bar::Indicator::Lock, isLocked);
        return appConfiguration;
    }


M module-apps/application-meditation/windows/MeditationTimerWindow.cpp => module-apps/application-meditation/windows/MeditationTimerWindow.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationTimerWindow.hpp"


@@ 113,7 113,7 @@ auto MeditationTimerWindow::onInput(const InputEvent &inputEvent) -> bool
void MeditationTimerWindow::setWidgetVisible(bool tBar, bool bBar, bool counter)
{
    applyToTopBar([tBar](top_bar::Configuration configuration) {
        configuration.set(top_bar::Indicator::Time, tBar);
        configuration.setIndicator(top_bar::Indicator::Time, tBar);
        return configuration;
    });


M module-apps/application-onboarding/ApplicationOnBoarding.cpp => module-apps/application-onboarding/ApplicationOnBoarding.cpp +2 -1
@@ 37,7 37,8 @@ namespace app
                                         Indicator::Time,
                                         Indicator::Battery,
                                         Indicator::SimCard,
                                         Indicator::NetworkAccessTechnology});
                                         Indicator::NetworkAccessTechnology,
                                         Indicator::PhoneMode});

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

M module-apps/application-onboarding/windows/OnBoardingMainWindow.cpp => module-apps/application-onboarding/windows/OnBoardingMainWindow.cpp +4 -4
@@ 30,10 30,10 @@ namespace app::onBoarding

    gui::top_bar::Configuration OnBoardingMainWindow::configureTopBar(gui::top_bar::Configuration appConfiguration)
    {
        appConfiguration.set(gui::top_bar::Indicator::Time, false);
        appConfiguration.set(gui::top_bar::Indicator::Battery, false);
        appConfiguration.set(gui::top_bar::Indicator::SimCard, false);
        appConfiguration.set(gui::top_bar::Indicator::Signal, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Time, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Battery, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::SimCard, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Signal, false);
        return appConfiguration;
    }


M module-apps/application-onboarding/windows/SkipDialogWindow.cpp => module-apps/application-onboarding/windows/SkipDialogWindow.cpp +4 -4
@@ 14,10 14,10 @@ namespace app::onBoarding

    gui::top_bar::Configuration SkipDialogWindow::configureTopBar(gui::top_bar::Configuration appConfiguration)
    {
        appConfiguration.set(gui::top_bar::Indicator::Time, true);
        appConfiguration.set(gui::top_bar::Indicator::Battery, false);
        appConfiguration.set(gui::top_bar::Indicator::SimCard, false);
        appConfiguration.set(gui::top_bar::Indicator::Signal, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Time, true);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Battery, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::SimCard, false);
        appConfiguration.setIndicator(gui::top_bar::Indicator::Signal, false);
        return appConfiguration;
    }
} // namespace app::onBoarding

M module-apps/windows/AppWindow.cpp => module-apps/windows/AppWindow.cpp +13 -2
@@ 102,11 102,22 @@ namespace gui
        return topBar->updateNetworkAccessTechnology();
    }

    void AppWindow::updatePhoneMode(sys::phone_modes::PhoneMode mode)
    {
        auto fn = [&](gui::top_bar::Configuration cfg) -> gui::top_bar::Configuration {
            gui::top_bar::Configuration ret(cfg);
            ret.setPhoneMode(mode);
            return ret;
        };

        applyToTopBar(std::move(fn));
    }

    bool AppWindow::updateTime()
    {
        applyToTopBar([](top_bar::Configuration configuration) {
            configuration.set(utils::dateAndTimeSettings.isTimeFormat12() ? gui::top_bar::TimeMode::Time12h
                                                                          : (gui::top_bar::TimeMode::Time24h));
            configuration.setTimeMode(utils::dateAndTimeSettings.isTimeFormat12() ? gui::top_bar::TimeMode::Time12h
                                                                                  : (gui::top_bar::TimeMode::Time24h));
            return configuration;
        });
        if (topBar == nullptr) {

M module-apps/windows/AppWindow.hpp => module-apps/windows/AppWindow.hpp +1 -0
@@ 66,6 66,7 @@ namespace gui
        bool updateBatteryStatus();
        bool updateSignalStrength();
        bool updateNetworkAccessTechnology();
        void updatePhoneMode(sys::phone_modes::PhoneMode mode);
        virtual bool updateTime();
        void setTitle(const UTF8 &text);


M module-gui/gui/widgets/CMakeLists.txt => module-gui/gui/widgets/CMakeLists.txt +1 -0
@@ 29,6 29,7 @@ target_sources( ${PROJECT_NAME}
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/SignalStrengthBar.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/SignalStrengthText.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/NetworkAccessTechnology.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/PhoneMode.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/Time.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/TopBar/Lock.cpp"
        "${CMAKE_CURRENT_LIST_DIR}/Text.cpp"

M module-gui/gui/widgets/TopBar.cpp => module-gui/gui/widgets/TopBar.cpp +46 -6
@@ 14,6 14,7 @@
#include "TopBar/SignalStrengthBar.hpp"
#include "TopBar/SignalStrengthText.hpp"
#include "TopBar/NetworkAccessTechnology.hpp"
#include "TopBar/PhoneMode.hpp"
#include "TopBar/SIM.hpp"
#include "TopBar/Time.hpp"
#include "TopBar/Lock.hpp"


@@ 31,7 32,7 @@ namespace gui::top_bar

    void Configuration::enable(Indicator indicator)
    {
        set(indicator, true);
        setIndicator(indicator, true);
    }

    void Configuration::enable(const Indicators &indicators)


@@ 43,22 44,32 @@ namespace gui::top_bar

    void Configuration::disable(Indicator indicator)
    {
        set(indicator, false);
        setIndicator(indicator, false);
    }

    void Configuration::set(Indicator indicator, bool enabled)
    void Configuration::setIndicator(Indicator indicator, bool enabled)
    {
        indicatorStatuses[indicator] = enabled;
    }

    auto Configuration::getTimeMode() const noexcept -> TimeMode
    {
        return timeMode;
        return mTimeMode;
    }

    void Configuration::set(TimeMode _timeMode)
    auto Configuration::getPhoneMode() const noexcept -> sys::phone_modes::PhoneMode
    {
        timeMode = _timeMode;
        return mPhoneMode;
    }

    void Configuration::setTimeMode(TimeMode timeMode)
    {
        mTimeMode = timeMode;
    }

    void Configuration::setPhoneMode(sys::phone_modes::PhoneMode phoneMode)
    {
        mPhoneMode = phoneMode;
    }

    auto Configuration::isEnabled(Indicator indicator) const -> bool


@@ 95,6 106,10 @@ namespace gui::top_bar
        networkAccessTechnology = new NetworkAccessTechnology(leftBox, 0, 0, 0, 0);
        networkAccessTechnology->setMaximumSize(nat::maxX, this->drawArea.h);
        networkAccessTechnology->setMargins(gui::Margins(margins::between, 0, 0, margins::textBottom));
        phoneMode = new PhoneMode(leftBox, 0, 0, 0, 0);
        phoneMode->setMaximumSize(phonemode::maxX, this->drawArea.h);
        phoneMode->setMargins(gui::Margins(margins::between, 0, 0, margins::textBottom));
        phoneMode->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Bottom));

        // center
        centralBox = new HBox(this, 0, 0, 0, 0);


@@ 119,6 134,7 @@ namespace gui::top_bar

        updateSignalStrength();
        updateNetworkAccessTechnology();
        updatePhoneMode();
    }

    auto TopBar::getConfiguration() const noexcept -> const Configuration &


@@ 134,6 150,12 @@ namespace gui::top_bar
            config.disable(Indicator::Time);
        }

        // phone mode and NAT are mutually exclusive.
        if (config.isEnabled(Indicator::PhoneMode)) {
            phoneMode->setPhoneMode(config.getPhoneMode());
            config.disable(Indicator::NetworkAccessTechnology);
        }

        using namespace utils::time;
        config.getTimeMode() == TimeMode::Time12h ? time->setFormat(Locale::format(Locale::TimeFormat::FormatTime12H))
                                                  : time->setFormat(Locale::format(Locale::TimeFormat::FormatTime24H));


@@ 143,6 165,7 @@ namespace gui::top_bar
        }
        configuration = std::move(config);

        leftBox->resizeItems();
        resizeItems();
    }



@@ 167,6 190,9 @@ namespace gui::top_bar
        case Indicator::NetworkAccessTechnology:
            showNetworkAccessTechnology(enabled);
            break;
        case Indicator::PhoneMode:
            showPhoneMode(enabled);
            break;
        }
    }



@@ 216,6 242,20 @@ namespace gui::top_bar
        return true;
    }

    bool TopBar::updatePhoneMode()
    {
        if (phoneMode == nullptr) {
            return false;
        }
        showPhoneMode(configuration.isEnabled(Indicator::PhoneMode));
        return true;
    }

    void TopBar::showPhoneMode(bool enabled)
    {
        enabled ? phoneMode->show() : phoneMode->hide();
    }

    bool TopBar::updateNetworkAccessTechnology()
    {
        if (networkAccessTechnology == nullptr) {

M module-gui/gui/widgets/TopBar.hpp => module-gui/gui/widgets/TopBar.hpp +156 -44
@@ 4,6 4,9 @@
#pragma once

#include <BoxLayout.hpp>

#include <PhoneModes/Common.hpp>

#include <vector>
#include <map>



@@ 15,6 18,7 @@ namespace gui
    namespace top_bar
    {
        class SignalStrengthBase;
        class PhoneMode;
        class BatteryBase;
        class NetworkAccessTechnology;
        class SIM;


@@ 27,96 31,204 @@ class UTF8;

namespace gui::top_bar
{

    enum class Indicator
    {
        Signal,
        Time,
        Lock,
        Battery,
        SimCard,
        NetworkAccessTechnology,
        Signal,                  /// signal strenght
        Time,                    /// digital clock
        Lock,                    /// is phone locked
        Battery,                 /// battery status
        SimCard,                 /// sim card info
        NetworkAccessTechnology, /// NAT (eg 3G, 4G, LTE)
        PhoneMode,               /// phone mode
    };

    using Indicators        = std::vector<Indicator>;
    using IndicatorStatuses = std::map<Indicator, bool>;

    enum class TimeMode
    {
        Time12h,
        Time24h
        Time12h, /// 12h time format
        Time24h  /// 24h time format
    };

    /**
     * Carries the top bar configuration.
     */
    /// Carries the top bar configuration.
    class Configuration
    {
      public:
        /// Enable specified indicator
        /// @param indicator indicator type to be enabled
        void enable(Indicator indicator);

        /// Enable number of specified indicators
        /// @param indicators vectior of indicators to enable
        void enable(const Indicators &indicators);

        /// Disable specified indicator
        /// @param indicator indicator type to disable
        void disable(Indicator indicator);
        void set(Indicator indicator, bool enabled);
        void set(TimeMode timeMode);

        /// Set the state of specified indicator
        /// @param indicator indicator type to set state
        /// @param enabled desired status to be set (true=enabled, false=disabled)
        void setIndicator(Indicator indicator, bool enabled);

        /// Set time mode (12h/24h)
        /// @param timeMode desired time mode configuration
        void setTimeMode(TimeMode timeMode);

        /// Set phone mode (connected/dnd/offline)
        /// @param phoneMode desired phone mode configuration
        void setPhoneMode(sys::phone_modes::PhoneMode phoneMode);

        /// Return the time mode configuration
        /// @return cuurent time mode configuration
        [[nodiscard]] auto getTimeMode() const noexcept -> TimeMode;

        /// Get the phone mode configuration
        /// @return phone mode
        [[nodiscard]] auto getPhoneMode() const noexcept -> sys::phone_modes::PhoneMode;

        /// Check if the specified indicator is enabled
        /// @param indicator indicator to be checked
        /// @return indicator status
        [[nodiscard]] auto isEnabled(Indicator indicator) const -> bool;

        /// Return the indicator statuses
        /// @return indicator statuses
        [[nodiscard]] auto getIndicatorsConfiguration() const noexcept -> const IndicatorStatuses &;

      private:
        /// Current indicator statuses
        IndicatorStatuses indicatorStatuses = {{Indicator::Signal, false},
                                               {Indicator::PhoneMode, false},
                                               {Indicator::Time, false},
                                               {Indicator::Lock, false},
                                               {Indicator::Battery, false},
                                               {Indicator::SimCard, false},
                                               {Indicator::NetworkAccessTechnology, false}};
        TimeMode timeMode                   = TimeMode::Time12h;

        /// Time mode
        TimeMode mTimeMode = TimeMode::Time12h;

        /// Phone mode
        sys::phone_modes::PhoneMode mPhoneMode = sys::phone_modes::PhoneMode::Connected;
    };

    /// Header of most of design Windows
    /// Top bar widget class.
    /// This is horizontal box with three sections
    /// * left showing signal strenght, NAT info, and/or phone mode
    /// * center showing lock info or digital clock
    /// * right showing sim card and battery status
    class TopBar : public HBox
    {
      protected:
        Time *time                                       = nullptr;
        NetworkAccessTechnology *networkAccessTechnology = nullptr;
        SignalStrengthBase *signal                       = nullptr;
        Lock *lock                                       = nullptr;
        SIM *sim                                         = nullptr;
        BatteryBase *battery                             = nullptr;
        HBox *leftBox                                    = nullptr;
        HBox *centralBox                                 = nullptr;
        HBox *rightBox                                   = nullptr;
        Configuration configuration;
      public:
        /// Constructor
        /// @param parent parent item pointer
        /// @param x widget x position
        /// @param y widget y position
        /// @param w widget width
        /// @param h widget height
        TopBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h);

        /// Set the configuration basing on the specialized gui::top_bar::Configuration class
        /// @param configuration desired configuration
        void configure(Configuration &&config);

        /// Returns the current configuration
        /// @return configuration stored in Configuration class
        [[nodiscard]] auto getConfiguration() const noexcept -> const Configuration &;

        /// Update sim card status widget state depending on the current configuration
        bool updateSim();

        /// Update clock widget state depending on the current configuration
        bool updateTime();

        /// Update battery status widget state depending on the current configuration
        bool updateBattery();

        /// Update signal widget state depending on the current configuration
        bool updateSignalStrength();

        /// Update phone mode widget state depending on the current configuration
        bool updatePhoneMode();

        /// Update NAT widget state depending on the current configuration
        bool updateNetworkAccessTechnology();

        /// Accepts GuiVisitor to update the top bar
        void accept(GuiVisitor &visitor) override;

      protected:
        /// Set up and add all the widgets to the top bar
        void prepareWidget();

        /// Show/hide sim card status widget
        /// @param enabled true to show false to hide the widget
        void showSim(bool enabled);

        /// Show/hide clock widget
        /// @param enabled true to show false to hide the widget
        void showTime(bool enabled);

        /// Show/hide lock status widget
        /// @param enabled true to show false to hide the widget
        void showLock(bool enabled);

        /// Show/hide battery status widget
        /// @param enabled true to show false to hide the widget
        void showBattery(bool enabled);

        /// Show/hide signal strenght widget
        /// @param enabled true to show false to hide the widget
        void showSignalStrength(bool enabled);

        /// Show/hide phone mode widget
        /// @param enabled true to show false to hide the widget
        void showPhoneMode(bool enabled);

        /// Show/hide NAT widget
        /// @param enabled true to show false to hide the widget
        void showNetworkAccessTechnology(bool enabled);

        /**
         * Sets the status of the top bar indicator.
         * @param indicator     Indicator
         */
        /// Sets the status of the specified indicator on the top bar
        /// @param indicator indicator id
        /// @param enabled enable or disable the specified indicator
        void setIndicatorStatus(Indicator indicator, bool enabled);

      public:
        TopBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
        /// Pointer to widget showing digital clock
        Time *time = nullptr;

        /**
         * Configures the top bar.
         * @param configuration     Top bar configuration
         */
        void configure(Configuration &&config);
        [[nodiscard]] auto getConfiguration() const noexcept -> const Configuration &;
        /// Pointer to widget showing NAT (eg 3G, 4G, LTE)
        NetworkAccessTechnology *networkAccessTechnology = nullptr;

        bool updateSim();
        bool updateTime();
        bool updateBattery();
        bool updateSignalStrength();
        bool updateNetworkAccessTechnology();
        /// Pointer to widget showing current signal strenght
        SignalStrengthBase *signal = nullptr;

        void accept(GuiVisitor &visitor) override;
        /// Pointer to widget with current phone mode
        PhoneMode *phoneMode = nullptr;

        /// Pointer to widget showing lock status
        Lock *lock = nullptr;

        /// Pointer to widget with sim card status
        SIM *sim = nullptr;

        /// Pointer to widget with battery status
        BatteryBase *battery = nullptr;

        /// Pointer to the left horizontal box
        HBox *leftBox = nullptr;

        /// Pointer to the central horizontal box
        HBox *centralBox = nullptr;

        /// Pointer to the right horizontal box
        HBox *rightBox = nullptr;

        /// Current configuration of the TopBar
        Configuration configuration;
    };

} // namespace gui::top_bar

A module-gui/gui/widgets/TopBar/PhoneMode.cpp => module-gui/gui/widgets/TopBar/PhoneMode.cpp +38 -0
@@ 0,0 1,38 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "PhoneMode.hpp"

#include <log/log.hpp>
#include <i18n/i18n.hpp>

#include "Item.hpp"
#include "Style.hpp"

namespace gui::top_bar
{
    PhoneMode::PhoneMode(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
        : StatusBarWidgetBase(parent, x, y, w, h)
    {
        setEdges(RectangleEdge::None);
        setFont(style::header::status_bar::nat::font);
        setAlignment(gui::Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Center));
    }

    void PhoneMode::setPhoneMode(sys::phone_modes::PhoneMode mode)
    {
        switch (mode) {
        case sys::phone_modes::PhoneMode::DoNotDisturb:
            setText(utils::localize.get("home_modes_notdisturb"));
            break;

        case sys::phone_modes::PhoneMode::Offline:
            setText(utils::localize.get("home_modes_offline"));
            break;

        case sys::phone_modes::PhoneMode::Connected:
            setText("");
            break;
        }
    }
} // namespace gui::top_bar

A module-gui/gui/widgets/TopBar/PhoneMode.hpp => module-gui/gui/widgets/TopBar/PhoneMode.hpp +31 -0
@@ 0,0 1,31 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "StatusBarWidgetBase.hpp"
#include <Label.hpp>
#include <common_data/EventStore.hpp>
#include <gui/widgets/TopBar.hpp>

namespace gui::top_bar
{
    /// widget drawn on the top bar showing current phone mode:
    class PhoneMode : public StatusBarWidgetBase<Label>
    {

      public:
        /// Phone mode widget class constructor
        /// @param parent parent item pointer
        /// @param x widget x position
        /// @param y widget y position
        /// @param w widget width
        /// @param h widget height
        PhoneMode(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h);

        /// Set the current phone mode
        /// @param mode desired mode
        void setPhoneMode(sys::phone_modes::PhoneMode mode);
    };

} // namespace gui::top_bar

M module-gui/gui/widgets/TopBar/Style.hpp => module-gui/gui/widgets/TopBar/Style.hpp +5 -0
@@ 29,6 29,11 @@ namespace style::header::status_bar
        inline constexpr auto maxX = 35u;
        inline constexpr auto font = "gt_pressura_regular_20";
    }; // namespace nat
    namespace phonemode
    {
        inline constexpr auto maxX = 157u;
        inline constexpr auto font = "gt_pressura_regular_20";
    }; // namespace phonemode
    namespace signal
    {
        inline constexpr auto font = "gt_pressura_regular_20";