~aleteoryx/muditaos

ref: 1f9c6b4a5174aab1e88ac5f3bba1e1bc791eb207 muditaos/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp -rw-r--r-- 2.0 KiB
1f9c6b4a — Maciej-Mudita [MOS-26] Add tethering info on status bar 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
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
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <apps-common/popups/presenter/WallpaperPresenter.hpp>
#include <AppWindow.hpp>

namespace app
{
    class ApplicationDesktop;
}

namespace gui
{
    class PhoneLockedWindow : public AppWindow
    {
      public:
        PhoneLockedWindow(app::ApplicationCommon *app,
                          const std::string &name,
                          std::unique_ptr<WallpaperPresenter> &&presenter,
                          unsigned lockScreenDeepRefreshRate);

        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void onClose(CloseReason reason) override;
        void buildInterface() override;
        status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;

        RefreshModes updateTime() override;

      private:
        bool processLongReleaseEvent(const InputEvent &inputEvent);

        std::unique_ptr<WallpaperPresenter> wallpaperPresenter;
        bool refreshedOnPhoneLockTimeLock = false;

        void initializeDeepRefreshCounter(unsigned deepRefreshRate);

        struct
        {
            unsigned currentValue;
            unsigned referenceValue;

            [[nodiscard]] inline auto overflow() const noexcept -> bool
            {
                return currentValue >= referenceValue;
            }

            inline auto reset() noexcept -> void
            {
                currentValue = 0;
            }

            inline auto setReference(unsigned reference) noexcept -> void
            {
                referenceValue = reference;
            }

            inline auto operator++(int) noexcept -> unsigned
            {
                auto temp = currentValue;
                currentValue++;
                return temp;
            }
        } deepRefreshCounter;
    };

} /* namespace gui */