mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-01 10:28:52 -05:00
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>
42 lines
1.0 KiB
C++
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
|