~aleteoryx/muditaos

ref: 97760f7765e0cdf678e0b4e976cd36f731879a36 muditaos/module-apps/popups/lock-popups/PhoneLockChangeInfoWindow.cpp -rw-r--r-- 2.2 KiB
97760f77 — Kuba Kleczkowski [EGD-6567] Add GSM time update handling 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
61
62
63
// 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::Application *app, const std::string &name)
    : WindowWithTimer(app, name)
{
    buildInterface();
}

top_bar::Configuration PhoneLockChangeInfoWindow::configureTopBar(top_bar::Configuration appConfiguration)
{
    appConfiguration.enable(top_bar::Indicator::NetworkAccessTechnology);
    appConfiguration.enable(top_bar::Indicator::Time);
    appConfiguration.enable(top_bar::Indicator::PhoneMode);
    appConfiguration.enable(top_bar::Indicator::Battery);
    appConfiguration.enable(top_bar::Indicator::Signal);
    appConfiguration.enable(top_bar::Indicator::SimCard);
    return appConfiguration;
}

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:
            infoText->setRichText(utils::translate("phone_lock_disabled"));
            break;
        case locks::PhoneLockInputTypeAction::Enable:
        case locks::PhoneLockInputTypeAction::Change:
            infoText->setRichText(utils::translate("phone_lock_changed_successfully"));
            break;
        default:
            break;
        }
    }
}

void PhoneLockChangeInfoWindow::buildInterface()
{
    namespace lock_style = style::window::pin_lock;
    AppWindow::buildInterface();

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

    infoImage = new gui::Image(this, lock_style::image::x, lock_style::image::y, 0, 0, "success_icon_W_G");
    infoText  = new Text(this,
                        lock_style::primary_text::x,
                        lock_style::primary_text::y,
                        lock_style::primary_text::w,
                        lock_style::primary_text::h);

    infoText->setAlignment(Alignment::Horizontal::Center);
}