~aleteoryx/muditaos

muditaos/module-apps/application-call/windows/CallWindow.hpp -rw-r--r-- 2.9 KiB
a405cad6Aleteoryx trim readme 6 days 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include "ApplicationCall.hpp"
#include "StateIcons.hpp"
#include <application-call/presenter/CallPresenter.hpp>

#include <AppWindow.hpp>
#include <gui/input/Translator.hpp>
#include <Image.hpp>
#include <Rect.hpp>
#include <time/time_conversion.hpp>

namespace gui
{
    class CallWindow : public AppWindow, public app::call::CallWindowContract::View
    {
      private:
        gui::KeyInputMappedTranslation translator;
        sys::TimerHandle delayedExitTimer;
        static constexpr inline auto callDelayedStopTime = std::chrono::milliseconds{3000};

        [[nodiscard]] auto getDelayedStopTime() const
        {
            return callDelayedStopTime;
        }
        app::call::CallWindowContract::Presenter &presenter;

      protected:
        // used to display both number and name of contact
        gui::Label *numberLabel = nullptr;
        // used to inform user about call state of call and display duration of call
        gui::Label *durationLabel = nullptr;
        // used to inform user about provided numbers during the call
        gui::Label *enteredDigitsLabel = nullptr;

        gui::HBox *iconsBox                 = nullptr;
        gui::SendSmsIcon *sendSmsIcon       = nullptr;
        gui::MicrophoneIcon *microphoneIcon = nullptr;
        gui::SpeakerIcon *speakerIcon       = nullptr;
        gui::Image *imageCircleTop          = nullptr;
        gui::Image *imageCircleBottom       = nullptr;

        utils::PhoneNumber::View phoneNumber;

      public:
        CallWindow(app::ApplicationCommon *app, app::call::CallWindowContract::Presenter &presenter);
        ~CallWindow() noexcept override;

        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;

        void rebuild() override;
        void buildInterface() override;
        void destroyInterface() override;
        status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;

        void connectTimerOnExit();
        void refreshWindow() override;

        void updateDuration(const UTF8 &text, bool isVisible = true) override;
        void updateEnteredNumber(const char &newCharacter, bool isVisible = true) override;
        void setEnteredNumberVisible(bool isVisible) override;
        void setNavBarForActiveCall() override;
        void setNavBarForIncomingCall() override;
        void clearNavBar() override;
        void setIncomingCallLayout(bool isValidCallerId) override;
        void setActiveCallLayout() override;
        void setCallEndedLayout(bool delayedClose = true) override;
        void updateNumber(const UTF8 &text) override;
        gui::SpeakerIconState getSpeakerIconState() override;
        void setSpeakerIconState(const gui::SpeakerIconState &icon) override;
    };
} /* namespace gui */