mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-19 14:40:57 -04:00
1. Prepare Pure and Bell specific `Application` classes and add them to `app` target: - `products/BellHybrid/apps/Application.cpp` - `products/PurePhone/apps/Application.cpp` 2. Update `CMakeLists.txt` files. 3. Move `ApplicationBell` implementation to Bell-specific `Application` class and remove `ApplicationBell` files. 4. Change Bell apps parent classes from `ApplicationBell` to Bell-specific `Application` class. 5. Rename `Application` to `ApplicationCommon` in the rest of the files.
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "ApplicationDesktop.hpp"
|
|
#include "Reboot.hpp"
|
|
|
|
#include <i18n/i18n.hpp>
|
|
#include <Style.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
|
|
RebootWindow::RebootWindow(app::ApplicationCommon *app, std::unique_ptr<PowerOffPresenter> &&presenter)
|
|
: AppWindow(app, app::window::name::desktop_reboot), presenter(std::move(presenter))
|
|
{
|
|
buildInterface();
|
|
}
|
|
|
|
void RebootWindow::rebuild()
|
|
{
|
|
destroyInterface();
|
|
buildInterface();
|
|
}
|
|
|
|
void RebootWindow::buildInterface()
|
|
{
|
|
AppWindow::buildInterface();
|
|
|
|
auto text_y_offset = 270;
|
|
auto text_height = 300;
|
|
|
|
text = new Text(this,
|
|
style::window::default_left_margin,
|
|
text_y_offset,
|
|
style::window_width - style::window::default_left_margin * 2,
|
|
text_height);
|
|
text->setText(utils::translate("phone_needs_rebooting"));
|
|
text->setFilled(false);
|
|
text->setBorderColor(gui::ColorFullBlack);
|
|
text->setFont(style::header::font::title);
|
|
text->setEdges(RectangleEdge::None);
|
|
text->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Bottom));
|
|
}
|
|
|
|
void RebootWindow::destroyInterface()
|
|
{
|
|
erase();
|
|
invalidate();
|
|
}
|
|
|
|
void RebootWindow::invalidate() noexcept
|
|
{
|
|
text = nullptr;
|
|
}
|
|
|
|
void RebootWindow::onBeforeShow(ShowMode mode, SwitchData *data)
|
|
{
|
|
}
|
|
|
|
bool RebootWindow::onInput(const InputEvent &inputEvent)
|
|
{
|
|
presenter->powerOff();
|
|
return true;
|
|
}
|
|
|
|
} /* namespace gui */
|