~aleteoryx/muditaos

dfafd1fb5f2daf000eb41c726f66e1877132a336 — Przemyslaw Brudny 4 years ago 460858b
[EGD-7987] Closing window refactor

Closing window refactor.
M module-apps/application-desktop/ApplicationDesktop.cpp => module-apps/application-desktop/ApplicationDesktop.cpp +4 -4
@@ 6,7 6,7 @@
#include "DeadBatteryWindow.hpp"
#include "DesktopData.hpp"
#include "DesktopMainWindow.hpp"
#include "LogoWindow.hpp"
#include "ClosingWindow.hpp"
#include "MenuWindow.hpp"
#include "MmiInternalMsgWindow.hpp"
#include "MmiPullWindow.hpp"


@@ 74,8 74,8 @@ namespace app
        });

        addActionReceiver(app::manager::actions::DisplayLogoAtExit, [this](auto &&data) {
            switchWindow(app::window::name::closing_window, std::move(data));
            setSystemCloseInProgress();
            switchWindow(app::window::name::logo_window, std::move(data));
            return actionHandled();
        });
    }


@@ 153,8 153,8 @@ namespace app
        windowsFactory.attach(dead_battery, [](ApplicationCommon *app, const std::string newname) {
            return std::make_unique<gui::DeadBatteryWindow>(app);
        });
        windowsFactory.attach(logo_window, [](ApplicationCommon *app, const std::string newname) {
            return std::make_unique<gui::LogoWindow>(app);
        windowsFactory.attach(closing_window, [](ApplicationCommon *app, const std::string newname) {
            return std::make_unique<gui::ClosingWindow>(app);
        });
        windowsFactory.attach(charging_battery, [](ApplicationCommon *app, const std::string newname) {
            return std::make_unique<gui::ChargingBatteryWindow>(app);

M module-apps/application-desktop/CMakeLists.txt => module-apps/application-desktop/CMakeLists.txt +2 -2
@@ 32,8 32,8 @@ target_sources(application-desktop
		windows/DeadBatteryWindow.hpp
		windows/DesktopMainWindow.cpp
		windows/DesktopMainWindow.hpp
		windows/LogoWindow.cpp
		windows/LogoWindow.hpp
		windows/ClosingWindow.cpp
		windows/ClosingWindow.hpp
		windows/MenuWindow.cpp
		windows/MenuWindow.hpp
		windows/MmiInternalMsgWindow.cpp

M module-apps/application-desktop/include/application-desktop/Names.hpp => module-apps/application-desktop/include/application-desktop/Names.hpp +1 -1
@@ 12,7 12,7 @@ namespace app::window::name
    inline constexpr auto desktop_reboot             = "Reboot";
    inline constexpr auto dead_battery               = "DeadBatteryWindow";
    inline constexpr auto charging_battery           = "CharginBatteryWindow";
    inline constexpr auto logo_window                = "LogoWindow";
    inline constexpr auto closing_window             = "ClosingWindow";
    inline constexpr auto desktop_pin_lock           = "PinLockWindow";
    inline constexpr auto desktop_update             = "Update";
    inline constexpr auto desktop_update_progress    = "UpdateProgress";

R module-apps/application-desktop/windows/LogoWindow.cpp => module-apps/application-desktop/windows/ClosingWindow.cpp +3 -18
@@ 1,35 1,20 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "LogoWindow.hpp"
#include "ClosingWindow.hpp"
#include "Names.hpp"

#include <gui/widgets/Image.hpp>
#include <log/log.hpp>

namespace gui
{
    LogoWindow::LogoWindow(app::ApplicationCommon *app) : AppWindow(app, app::window::name::logo_window)
    {
        buildInterface();
    }

    void LogoWindow::rebuild()
    ClosingWindow::ClosingWindow(app::ApplicationCommon *app) : AppWindow(app, app::window::name::closing_window)
    {
        destroyInterface();
        buildInterface();
    }

    void LogoWindow::buildInterface()
    void ClosingWindow::buildInterface()
    {
        AppWindow::buildInterface();
        navBar->setVisible(false);
        statusBar->setVisible(false);
        new gui::Image(this, 0, 0, 0, 0, "logo");
    }

    void LogoWindow::destroyInterface()
    {
        erase();
    }
} /* namespace gui */

R module-apps/application-desktop/windows/LogoWindow.hpp => module-apps/application-desktop/windows/ClosingWindow.hpp +2 -5
@@ 7,13 7,10 @@

namespace gui
{
    class LogoWindow : public AppWindow
    class ClosingWindow : public AppWindow
    {
      public:
        explicit LogoWindow(app::ApplicationCommon *app);
        void rebuild() override;
        explicit ClosingWindow(app::ApplicationCommon *app);
        void buildInterface() override;
        void destroyInterface() override;
    };

} /* namespace gui */