~aleteoryx/muditaos

ref: 299be4daf6da880f495f4dc363e480d6ff0f0e9b muditaos/module-apps/application-settings/windows/FotaWindow.hpp -rw-r--r-- 1.6 KiB
299be4da — Piotr Tanski [EGD-4151] Application manager actions introduced. (#905) 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Application.hpp>
#include <AppWindow.hpp>
#include <gui/widgets/BoxLayout.hpp>
#include <gui/widgets/Label.hpp>
#include <gui/widgets/Text.hpp>
#include <gui/widgets/BoxLayout.hpp>
#include <gui/widgets/ProgressBar.hpp>

#include <memory>
#include <string>

class Fota;

namespace gui
{
    namespace window
    {
        namespace name
        {
            inline const std::string fota_window = "fota_window";
        } // namespace name
    }     // namespace window
    /** @brief Window managing modem firmware update
     *
     */
    class FotaWindow : public AppWindow
    {
      public:
        FotaWindow(app::Application *app);
        virtual ~FotaWindow();

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void rebuild() override;
        void buildInterface() override;
        void destroyInterface() override;

        //        Text apnName;
        //        Text apnUser;
        //        Text apnPassword;
        gui::BottomBar *getBottomBar();

      public:
        Label *addBoxLabel(BoxLayout *layout, const std::string &text);

        Label *currentFirmwareLabel   = nullptr;
        Label *statusLabel            = nullptr;
        Label *newFirmwareLabelText   = nullptr;
        Label *newFirmwareLabel       = nullptr;
        ProgressBar *downloadProgress = nullptr;
        VBox *mainBox                 = nullptr;

      private:
        void invalidate() noexcept;

        std::unique_ptr<Fota> fotaUpdater;
    };
} // namespace gui