mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-20 23:17:35 -04:00
Single api to rule i18n all calls to localistaion in cpp files unified cut off ass many dependencies in i18n header as possible
50 lines
1.7 KiB
C++
50 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 <memory>
|
|
#include <functional>
|
|
|
|
#include "Common.hpp"
|
|
#include "service-eink/Common.hpp"
|
|
#include "messages/EinkModeMessage.hpp"
|
|
#include "service-appmgr/Controller.hpp"
|
|
#include "../ApplicationSettings.hpp"
|
|
|
|
#include <i18n/i18n.hpp>
|
|
|
|
#include "Label.hpp"
|
|
#include "Margins.hpp"
|
|
#include "EinkModeWindow.hpp"
|
|
#include <Style.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
|
|
EinkModeWindow::EinkModeWindow(app::Application *app) : AppWindow(app, window::name::eink)
|
|
{
|
|
AppWindow::buildInterface();
|
|
bottomBar->setActive(BottomBar::Side::CENTER, true);
|
|
bottomBar->setActive(BottomBar::Side::RIGHT, true);
|
|
bottomBar->setText(BottomBar::Side::CENTER, utils::translate(style::strings::common::select));
|
|
bottomBar->setText(BottomBar::Side::RIGHT, utils::translate(style::strings::common::back));
|
|
|
|
setTitle("Change eink mode");
|
|
auto label = new Label(this, 100, 200, 300, 50, "Change mode on click");
|
|
label->activatedCallback = [this](Item &) -> bool {
|
|
static auto last_mode = service::eink::EinkModeMessage::Mode::Normal;
|
|
if (last_mode == service::eink::EinkModeMessage::Mode::Normal) {
|
|
last_mode = service::eink::EinkModeMessage::Mode::Invert;
|
|
}
|
|
else {
|
|
last_mode = service::eink::EinkModeMessage::Mode::Normal;
|
|
}
|
|
|
|
application->bus.sendUnicastSync(
|
|
std::make_shared<service::eink::EinkModeMessage>(last_mode), service::name::eink, 5000);
|
|
return true;
|
|
};
|
|
setFocusItem(label);
|
|
}
|
|
|
|
} /* namespace gui */
|