~aleteoryx/muditaos

ref: 6f257d38dbd42ac6aa54258e640571b6cbe003ad muditaos/module-gui/gui/widgets/status-bar/PhoneMode.cpp -rw-r--r-- 1.2 KiB
6f257d38 — Marcin Lyda [MOS-303] Add playback path gain params to json 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2017-2022, 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::status_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::status_bar::nat::font);
        setTextEllipsisType(TextEllipsis::Right);
        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::translate("home_modes_notdisturb"));
            break;

        case sys::phone_modes::PhoneMode::Offline:
            setText(utils::translate("home_modes_offline"));
            break;

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