Files
MuditaOS/module-apps/application-settings/windows/EinkModeWindow.cpp
Lucjan Bryndza e5199a3764 [EGD-4261] stdlib file access syscalls for RT1051 platform (#952)
* [EGD-4261] Initial version of syscalls

* [EGD-4261]  CR small fixes

* [EGD-4261] Rename namespace and fsync call

Rename namespace vfs::internal for clarify that syscall functions are for internal use only

* [EGD-4261] Handle manager for stdlib

Handle manager layer for STDIO compatibility.

* [EGD-4261] Initial version of sysscall (old vfs)

* [EGD-4261] Direntry syscalls completed

* [EGD-4261] Fixes in handle manager

* [EGD-4261] Add support for std::filesystem.

libstdc++ from compiler is compiled without <dirent.h>
, so std::directory_iterator doesn't work.
Our implementation fix this issue and override
libstdc++ library code

* [EGD-4261] Compile syscalls only on RT1051 target

* [EGD-4261] RT compile fix

* [EGD-4261] Code review small fixes

* [EGD-4261] Code review fixes

* [EGD-4261] Remove redundant noisy debug log msg.

Co-authored-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2020-11-06 09:45:15 +01:00

54 lines
1.9 KiB
C++

// Copyright (c) 2017-2020, 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 "i18/i18.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::localize.get(style::strings::common::select));
bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
topBar->setActive(TopBar::Elements::SIGNAL, true);
topBar->setActive(TopBar::Elements::BATTERY, true);
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;
}
sys::Bus::SendUnicast(std::make_shared<service::eink::EinkModeMessage>(last_mode),
service::name::eink,
this->application,
5000);
return true;
};
setFocusItem(label);
}
} /* namespace gui */