~aleteoryx/muditaos

ref: 19d6468e30978f3214546e8a3237db3be00b87cc muditaos/module-apps/apps-common/WindowsPopupQueue.cpp -rw-r--r-- 748 bytes
19d6468e — Przemyslaw Brudny [EGD-8035] Fixed looped lists and applied to all Pure lists 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "WindowsPopupQueue.hpp"
#include "WindowsPopupFilter.hpp"

namespace app
{
    std::optional<gui::popup::Request> WindowsPopupQueue::popRequest(const gui::popup::Filter &filter)
    {
        for (const auto &val : requests) {
            if (filter.isPermitted(val.getPopupParams())) {
                return {std::move(requests.extract(val).value())};
            }
        }
        return {std::nullopt};
    }

    bool WindowsPopupQueue::pushRequest(gui::popup::Request &&r)
    {
        const auto &[_, success] = requests.emplace(std::move(r));
        return success;
    }
} // namespace app