~aleteoryx/muditaos

ref: 05847f09d10bef7c7579b55de45f22a462ccb4b4 muditaos/module-apps/application-desktop/windows/DesktopMainWindow.hpp -rw-r--r-- 1.8 KiB
05847f09 — Paweł Joński [BH-743] Fix alarm deletion from DB 4 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
// 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 "ActiveNotificationsModel.hpp"

#include <AppWindow.hpp>
#include <gui/widgets/Label.hpp>
#include <ListView.hpp>
#include <Translator.hpp>

namespace app
{
    class ApplicationDesktop;
}

namespace gui
{
    class NotificationsModel;

    class DesktopMainWindow : public AppWindow
    {
      protected:
        gui::Label *time    = nullptr;
        gui::Label *dayText = nullptr;

        gui::ListView *notificationsList                                  = nullptr;
        std::shared_ptr<gui::ActiveNotificationsModel> notificationsModel = nullptr;

        // method hides or show widgets and sets bars according to provided state
        void setVisibleState();
        void setActiveState();
        bool processLongReleaseEvent(const InputEvent &inputEvent);
        bool processShortReleaseEvent(const InputEvent &inputEvent);
        app::ApplicationDesktop *getAppDesktop() const;

      public:
        explicit DesktopMainWindow(app::Application *app);

        // virtual methods gui::Window
        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        // virtual methods gui::AppWindow
        void rebuild() override;
        void buildInterface() override;
        void destroyInterface() override;
        status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;

        bool updateTime() override;

      private:
        bool resolveDialAction(const std::string &number);
        bool showInformationPopup(std::function<bool()> action, const std::string &notification);
        void invalidate() noexcept;

        gui::KeyInputMappedTranslation translator;
    };

} /* namespace gui */