~aleteoryx/muditaos

ref: dfcf9817b7a1dd1a5a7e1522e363f8aa1980a5fb muditaos/module-apps/application-desktop/data/LockPhoneData.hpp -rw-r--r-- 1.7 KiB
dfcf9817 — Michał Kamoń [EGD-5790] Fix end of line display in message thumbnail 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#ifndef MODULE_APPS_APPLICATION_DESKTOP_DATA_LOCKPHONEDATA_HPP_
#define MODULE_APPS_APPLICATION_DESKTOP_DATA_LOCKPHONEDATA_HPP_

#include "gui/SwitchData.hpp"
#include <service-desktop/DesktopMessages.hpp>
#include <service-desktop/ServiceDesktop.hpp>
#include <filesystem>

#include "application-desktop/widgets/PinLock.hpp"

namespace gui
{

    // class template that stores information that was sent along with switch message
    class LockPhoneData : public gui::SwitchData
    {
        std::string previousApplication;
        std::unique_ptr<PinLock> lock;

      public:
        LockPhoneData(std::unique_ptr<PinLock> &&lock) : SwitchData(), lock(std::move(lock))
        {
            description = "LockPhoneData";
        }

        virtual ~LockPhoneData(){};

        void setPrevApplication(const std::string &prevApp)
        {
            previousApplication = prevApp;
        };
        [[nodiscard]] const std::string &getPreviousApplication()
        {
            return previousApplication;
        };

        [[nodiscard]] std::unique_ptr<PinLock> getLock()
        {
            return std::make_unique<PinLock>(*lock.get());
        }
    };

    class UpdateSwitchData : public gui::SwitchData
    {
      public:
        UpdateSwitchData(sdesktop::UpdateOsMessage *messageToCopyFrom) : updateOsMessage(*messageToCopyFrom)
        {}

        const sdesktop::UpdateOsMessage &getUpdateOsMessage()
        {
            return updateOsMessage;
        }

      private:
        sdesktop::UpdateOsMessage updateOsMessage;
    };

} // namespace gui

#endif /* MODULE_APPS_APPLICATION_DESKTOP_DATA_LOCKPHONEDATA_HPP_ */