~aleteoryx/muditaos

ref: 22d9134476faadbdb0f0f45e2bd796f9d4b754ae muditaos/module-apps/apps-common/popups/PowerOffWindow.cpp -rw-r--r-- 1.2 KiB
22d91344 — Lefucjusz [MOS-1052] Change VoLTE label from 'beta' to 'experimental' 2 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "PowerOffWindow.hpp"
#include "Popups.hpp"

#include <log/log.hpp>
#include <messages/DialogMetadataMessage.hpp>
#include <i18n/i18n.hpp>

namespace gui
{
    PowerOffWindow::PowerOffWindow(app::ApplicationCommon *app, std::unique_ptr<PowerOffPresenter> &&presenter)
        : DialogYesNo(app, popup::window::power_off_window), presenter(std::move(presenter))
    {}

    void PowerOffWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        DialogMetadata metadata;
        metadata.action = [=]() -> bool {
            LOG_INFO("User call close system");
            preventsAutoLock = true;
            presenter->powerOff();
            return true;
        };
        metadata.title = utils::translate("app_desktop_poweroff_title");
        metadata.text  = utils::translate("app_desktop_poweroff_question");
        metadata.icon  = "turn_off_128px_W_G";
        auto msg       = std::make_unique<DialogMetadataMessage>(std::move(metadata));
        DialogYesNo::onBeforeShow(mode, msg.get());
    }

} /* namespace gui */