Files
MuditaOS/module-apps/application-test/presenters/TestPresenter.cpp
Adam Dobrowolski 1cb4da819d [MOS-307] Application and Service example and docs
Working example of application and service ready to copy from
with minimum documentation
Apply suggestions from code review
Co-authored-by:
* Paweł Olejniczak <58421550+pawel-mudita@users.noreply.github.com>
* Paweł Joński <79840715+paweljonskim@users.noreply.github.com>
* Bartosz Cichocki <sp2fet@gmail.com>
2022-03-28 08:17:39 +02:00

42 lines
1.0 KiB
C++

// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "TestPresenter.hpp"
namespace gui
{
TestPresenter::TestPresenter(app::ApplicationTest *app) : app(app)
{}
void TestPresenter::attachWindow(TestMainWindow *window)
{
this->windowMain = window;
}
void TestPresenter::changeButtonState()
{
switch (state) {
case ButtonState::Disabled:
state = ButtonState::Enabled;
break;
case ButtonState::Enabled:
state = ButtonState::Disabled;
break;
}
}
UTF8 TestPresenter::getTestButtonText()
{
if (state == ButtonState::Disabled) {
return utils::translate("disabled");
}
return utils::translate("enabled");
}
void TestPresenter::handleTestButtonPressed()
{
changeButtonState();
windowMain->changeButtonText(getTestButtonText());
}
} // namespace gui