~aleteoryx/muditaos

ref: 29f455d46bbddee9a8f0ea860e84c9b6e5ab38b5 muditaos/module-apps/apps-common/popups/lock-popups/PhoneLockChangeInfoWindow.cpp -rw-r--r-- 1.7 KiB
29f455d4 — Przemyslaw Brudny [EGD-7998] Pure image assets cleanup and update 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "PhoneLockChangeInfoWindow.hpp"
#include <locks/data/LockStyle.hpp>
#include <locks/data/LockData.hpp>
#include <i18n/i18n.hpp>

using namespace gui;

PhoneLockChangeInfoWindow::PhoneLockChangeInfoWindow(app::ApplicationCommon *app, const std::string &name)
    : WindowWithTimer(app, name)
{
    buildInterface();
}

void PhoneLockChangeInfoWindow::onBeforeShow(ShowMode mode, SwitchData *data)
{
    WindowWithTimer::onBeforeShow(mode, data);

    if (auto infoData = dynamic_cast<locks::LockData *>(data)) {

        switch (infoData->getPhoneLockInputTypeAction()) {
        case locks::PhoneLockInputTypeAction::Disable:
            infoIcon->text->setRichText(utils::translate("phone_lock_disabled"));
            break;
        case locks::PhoneLockInputTypeAction::Enable:
        case locks::PhoneLockInputTypeAction::Change:
            infoIcon->text->setRichText(utils::translate("phone_lock_changed_successfully"));
            break;
        default:
            break;
        }
    }
}

void PhoneLockChangeInfoWindow::buildInterface()
{
    AppWindow::buildInterface();

    setTitle(utils::translate("phone_lock_configure"));

    infoIcon = new gui::Icon(this,
                             style::window::default_left_margin,
                             style::window::default_vertical_pos,
                             style::window::default_body_width,
                             style::window::default_body_height,
                             "success_128px_W_G",
                             "");
    infoIcon->setAlignment(Alignment::Horizontal::Center);
}