~aleteoryx/muditaos

ref: b95894a8abc10cddf0b58dda4b2569b01eec0d7e muditaos/products/PurePhone/apps/Application.cpp -rw-r--r-- 7.5 KiB
b95894a8 — Lefucjusz [MOS-1064] Fix no input language selected for French/Spanish 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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <Application.hpp>
#include <popups/AlarmPopup.hpp>
#include <popups/VolumeWindow.hpp>
#include <popups/HomeModesWindow.hpp>
#include <popups/TetheringPhoneModePopup.hpp>
#include <popups/TetheringConfirmationPopup.hpp>
#include <popups/BluetoothAuthenticatePopup.hpp>
#include <popups/BluetoothInfoPopup.hpp>
#include <popups/PowerOffWindow.hpp>
#include <popups/presenter/PowerOffPresenter.hpp>
#include <popups/presenter/WallpaperPresenter.hpp>
#include <popups/lock-popups/PhoneLockedWindow.hpp>
#include <popups/lock-popups/PhoneLockedInfoWindow.hpp>
#include <popups/lock-popups/PhoneLockInputWindow.hpp>
#include <popups/lock-popups/PhoneLockChangeInfoWindow.hpp>
#include <popups/lock-popups/SimLockInputWindow.hpp>
#include <popups/lock-popups/SimInfoWindow.hpp>
#include <popups/lock-popups/SimNotReadyWindow.hpp>
#include <popups/lock-popups/SimSwitchingWindow.hpp>
#include <service-db/agents/settings/SystemSettings.hpp>

namespace app
{
    void Application::updateStatuses(gui::AppWindow *window) const
    {
        window->updateBatteryStatus();
        window->updateBluetooth(statusIndicators.bluetoothMode);
        window->updateAlarmClock(statusIndicators.alarmClockStatus);
        window->updateSim();
        window->updateSignalStrength();
        window->updateNetworkAccessTechnology();
        window->updatePhoneMode(statusIndicators.phoneMode);
        window->updateTethering(statusIndicators.tetheringState);
    }

    void Application::attachPopups(const std::vector<gui::popup::ID> &popupsList)
    {
        using namespace gui::popup;
        for (auto popup : popupsList) {
            switch (popup) {
            case ID::Volume:
                windowsFactory.attach(window::volume_window, [](ApplicationCommon *app, const std::string &name) {
                    return std::make_unique<gui::VolumeWindow>(app, window::volume_window);
                });
                break;
            case ID::Tethering:
            case ID::TetheringPhoneModeChangeProhibited:
                windowsFactory.attach(window::tethering_confirmation_window,
                                      [](ApplicationCommon *app, const std::string &name) {
                                          return std::make_unique<gui::TetheringConfirmationPopup>(
                                              app, window::tethering_confirmation_window);
                                      });
                windowsFactory.attach(window::tethering_phonemode_change_window,
                                      [](ApplicationCommon *app, const std::string &name) {
                                          return std::make_unique<gui::TetheringPhoneModePopup>(
                                              app, window::tethering_phonemode_change_window);
                                      });
                break;
            case ID::PhoneModes:
                windowsFactory.attach(window::phone_modes_window, [](ApplicationCommon *app, const std::string &name) {
                    return std::make_unique<gui::HomeModesWindow>(app, window::phone_modes_window);
                });
                break;
            case ID::BluetoothAuthenticate:
            case ID::BluetoothInfo:
                windowsFactory.attach(
                    window::bluetooth_authenticate, [](ApplicationCommon *app, const std::string &name) {
                        return std::make_unique<gui::BluetoothAuthenticatePopup>(app, window::bluetooth_authenticate);
                    });
                windowsFactory.attach(window::bluetooth_info, [](ApplicationCommon *app, const std::string &name) {
                    return std::make_unique<gui::BluetoothInfoPopup>(app, window::bluetooth_info);
                });
                break;
            case ID::Brightness:
                break;
            case ID::PhoneLock:
            case ID::PhoneLockInput:
            case ID::PhoneLockInfo:
            case ID::PhoneLockChangeInfo:
                windowsFactory.attach(
                    window::phone_lock_window, [this](ApplicationCommon *app, const std::string &name) {
                        auto presenter                 = std::make_unique<gui::WallpaperPresenter>(app);
                        auto lockScreenDeepRefreshRate = utils::getNumericValue<unsigned>(settings->getValue(
                            settings::Display::lockScreenDeepRefreshRate, settings::SettingsScope::Global));
                        return std::make_unique<gui::PhoneLockedWindow>(
                            app, window::phone_lock_window, std::move(presenter), lockScreenDeepRefreshRate);
                    });
                windowsFactory.attach(
                    window::phone_lock_info_window, [](ApplicationCommon *app, const std::string &name) {
                        return std::make_unique<gui::PhoneLockedInfoWindow>(app, window::phone_lock_info_window);
                    });
                windowsFactory.attach(
                    window::phone_lock_input_window, [](ApplicationCommon *app, const std::string &name) {
                        return std::make_unique<gui::PhoneLockInputWindow>(app, window::phone_lock_input_window);
                    });
                windowsFactory.attach(window::phone_lock_change_info_window,
                                      [](ApplicationCommon *app, const std::string &name) {
                                          return std::make_unique<gui::PhoneLockChangeInfoWindow>(
                                              app, window::phone_lock_change_info_window);
                                      });
                windowsFactory.attach(window::power_off_window, [](ApplicationCommon *app, const std::string &name) {
                    auto presenter = std::make_unique<gui::PowerOffPresenter>(app);
                    return std::make_unique<gui::PowerOffWindow>(app, std::move(presenter));
                });
                break;
            case ID::SimLock:
            case ID::SimInfo:
            case ID::SimNotReady:
            case ID::SimSwitching:
                windowsFactory.attach(window::sim_unlock_window, [](ApplicationCommon *app, const std::string &name) {
                    return std::make_unique<gui::SimLockInputWindow>(app, window::sim_unlock_window);
                });
                windowsFactory.attach(window::sim_info_window, [](ApplicationCommon *app, const std::string &name) {
                    return std::make_unique<gui::SimInfoWindow>(app, window::sim_info_window);
                });
                windowsFactory.attach(
                    window::sim_not_ready_window, [](ApplicationCommon *app, const std::string &name) {
                        return std::make_unique<gui::SimNotReadyWindow>(app, window::sim_not_ready_window);
                    });
                windowsFactory.attach(
                    window::sim_switching_window, [](ApplicationCommon *app, const std::string &name) {
                        return std::make_unique<gui::SimSwitchingWindow>(app, window::sim_switching_window);
                    });
                break;
            case ID::Alarm:
                windowsFactory.attach(window::alarm_window, [](ApplicationCommon *app, const std::string &name) {
                    auto presenter = std::make_shared<popup::AlarmPopupPresenter>(app);
                    return std::make_unique<gui::AlarmPopup>(app, window::alarm_window, presenter);
                });
            default:
                break;
            }
        }
    }
} // namespace app