~aleteoryx/muditaos

ref: 5cfd688f510cc32a965d5cb1f052d7025d1d84a3 muditaos/module-apps/application-calllog/widgets/CalllogItem.hpp -rw-r--r-- 1.8 KiB
5cfd688f — Lefucjusz [MOS-1043] Enable VoLTE only for Poland and US 2 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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 "CalllogModel.hpp"
#include "data/CallLogInternals.hpp"
#include <BoxLayout.hpp>
#include <Label.hpp>
#include <Image.hpp>
#include <ListItem.hpp>

namespace gui
{
    namespace clItemStyle
    {
        inline constexpr auto w               = style::window::default_body_width;
        inline constexpr auto h               = style::window::label::big_h;
        inline constexpr auto internal_margin = 4;
        inline constexpr auto right_margin    = 10;
        inline constexpr auto top_margin      = style::margins::big;

        namespace timestamp
        {
            inline constexpr auto min_w = 132;
        }
    } // namespace clItemStyle

    /*
     * @brief Widget used to display information about calllog entry in the calllog list view.
     */
    class CalllogItem : public ListItem
    {
        CalllogModel *model = nullptr;
        // pointer to the calls record
        std::shared_ptr<CalllogRecord> call = nullptr;
        gui::HBox *hBox                     = nullptr;
        // this is timestamp in the mode defined in settings
        gui::Label *timestamp                                                  = nullptr;
        gui::Image *imageCallType[calllog::CallLogCallType::NUM_OF_CALL_TYPES] = {nullptr, nullptr, nullptr};
        gui::Label *text                                                       = nullptr;

      public:
        explicit CalllogItem(CalllogModel *model);
        virtual ~CalllogItem() = default;
        // sets copy of alarm's
        void setCall(std::shared_ptr<CalllogRecord> &);
        [[nodiscard]] auto getCall() const -> CalllogRecord
        {
            return call != nullptr ? *call : CalllogRecord();
        };
    };

} /* namespace gui */