M products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp => products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +10 -3
@@ 20,7 20,8 @@ namespace app
StartInBackground startInBackground,
uint32_t stackDepth)
: Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth),
- audioModel{std::make_unique<AudioModel>(this)}
+ audioModel{std::make_unique<AudioModel>(this)},
+ frontLightModel{std::make_unique<app::bell_settings::FrontlightModel>(this)}
{
bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications);
}
@@ 46,9 47,15 @@ namespace app
windowsFactory.attach(
gui::window::name::powernapProgress, [this](ApplicationCommon *app, const std::string &name) {
auto timeModel = std::make_unique<app::TimeModel>();
+ auto alarmLightOnOff = std::make_unique<bell_settings::AlarmLightOnOffModel>(this);
auto soundsRepository = std::make_unique<SoundsRepository>(alarms::paths::getAlarmDir());
- auto presenter = std::make_unique<powernap::PowerNapProgressPresenter>(
- app, settings.get(), std::move(soundsRepository), *audioModel, std::move(timeModel));
+ auto presenter = std::make_unique<powernap::PowerNapProgressPresenter>(app,
+ settings.get(),
+ std::move(soundsRepository),
+ *audioModel,
+ *frontLightModel,
+ std::move(timeModel),
+ std::move(alarmLightOnOff));
return std::make_unique<gui::PowerNapProgressWindow>(app, std::move(presenter));
});
windowsFactory.attach(gui::window::session_paused::sessionPaused,
M products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp => products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp +3 -0
@@ 5,6 5,8 @@
#include <Application.hpp>
#include <common/models/AbstractAudioModel.hpp>
+#include <common/models/FrontlightModel.hpp>
+#include <common/models/AlarmSettingsModel.hpp>
namespace gui::window::name
{
@@ 24,6 26,7 @@ namespace app
{
private:
std::unique_ptr<AbstractAudioModel> audioModel;
+ std::unique_ptr<app::bell_settings::AbstractFrontlightModel> frontLightModel;
void onStop() override;
public:
M products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp => products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp +16 -7
@@ 23,13 23,17 @@ namespace
namespace app::powernap
{
- PowerNapProgressPresenter::PowerNapProgressPresenter(app::ApplicationCommon *app,
- settings::Settings *settings,
- std::unique_ptr<AbstractSoundsRepository> soundsRepository,
- AbstractAudioModel &audioModel,
- std::unique_ptr<AbstractTimeModel> timeModel)
- : app{app}, settings{settings}, soundsRepository{std::move(soundsRepository)},
- audioModel{audioModel}, timeModel{std::move(timeModel)},
+ PowerNapProgressPresenter::PowerNapProgressPresenter(
+ app::ApplicationCommon *app,
+ settings::Settings *settings,
+ std::unique_ptr<AbstractSoundsRepository> soundsRepository,
+ AbstractAudioModel &audioModel,
+ app::bell_settings::AbstractFrontlightModel &frontLightModel,
+ std::unique_ptr<AbstractTimeModel> timeModel,
+ std::unique_ptr<app::bell_settings::AlarmLightOnOffModel> alarmLightOnOffModel)
+ : app{app}, settings{settings}, soundsRepository{std::move(soundsRepository)}, audioModel{audioModel},
+ frontLightModel{frontLightModel}, timeModel{std::move(timeModel)}, alarmLightOnOffModel{std::move(
+ alarmLightOnOffModel)},
napAlarmTimer{sys::TimerFactory::createSingleShotTimer(
app, powernapAlarmTimerName, powernapAlarmTimeout, [this](sys::Timer &) { onNapAlarmFinished(); })}
@@ 71,6 75,11 @@ namespace app::powernap
void PowerNapProgressPresenter::onNapFinished()
{
+ if (alarmLightOnOffModel->getValue()) {
+ frontLightModel.restorePreviousState();
+ frontLightModel.setStatus(true);
+ }
+
const auto filePath = soundsRepository->titleToPath(
settings->getValue(bell::settings::Alarm::tone, settings::SettingsScope::Global));
M products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp => products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp +14 -1
@@ 10,11 10,20 @@
#include <time/time_locale.hpp>
#include <Timers/TimerHandle.hpp>
#include <memory>
+#include <common/models/FrontlightModel.hpp>
+#include <common/models/AlarmSettingsModel.hpp>
+
namespace app
{
class AbstractTimeModel;
class ApplicationCommon;
} // namespace app
+
+namespace app::bell_settings
+{
+ class AbstractFrontlightModel;
+ class AlarmLightOnOffModel;
+} // namespace app::bell_settings
namespace gui
{
class Item;
@@ 58,8 67,10 @@ namespace app::powernap
settings::Settings *settings{};
std::unique_ptr<AbstractSoundsRepository> soundsRepository;
AbstractAudioModel &audioModel;
+ app::bell_settings::AbstractFrontlightModel &frontLightModel;
std::unique_ptr<app::TimerWithCallbacks> timer;
std::unique_ptr<AbstractTimeModel> timeModel;
+ std::unique_ptr<app::bell_settings::AlarmLightOnOffModel> alarmLightOnOffModel;
sys::TimerHandle napAlarmTimer;
bool napFinished{false};
@@ 80,6 91,8 @@ namespace app::powernap
settings::Settings *settings,
std::unique_ptr<AbstractSoundsRepository> soundsRepository,
AbstractAudioModel &audioModel,
- std::unique_ptr<AbstractTimeModel> timeModel);
+ app::bell_settings::AbstractFrontlightModel &frontLightModel,
+ std::unique_ptr<AbstractTimeModel> timeModel,
+ std::unique_ptr<app::bell_settings::AlarmLightOnOffModel> alarmLightOnOffModel);
};
} // namespace app::powernap
M products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp => products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +1 -1
@@ 6,7 6,6 @@
#include "models/TemperatureUnitModel.hpp"
#include "models/advanced/AboutYourBellModel.hpp"
#include "models/alarm_settings/AlarmSettingsListItemProvider.hpp"
-#include "models/alarm_settings/AlarmSettingsModel.hpp"
#include "models/alarm_settings/PrewakeUpListItemProvider.hpp"
#include "models/alarm_settings/BedtimeSettingsListItemProvider.hpp"
#include "models/alarm_settings/PrewakeUpSettingsModel.hpp"
@@ 38,6 37,7 @@
#include <common/windows/BellTurnOffWindow.hpp>
#include <common/popups/BellTurnOffOptionWindow.hpp>
#include <common/models/AudioModel.hpp>
+#include <common/models/AlarmSettingsModel.hpp>
#include <service-evtmgr/EventManagerServiceAPI.hpp>
#include <service-appmgr/messages/GetCurrentDisplayLanguageResponse.hpp>
M products/BellHybrid/apps/application-bell-settings/CMakeLists.txt => products/BellHybrid/apps/application-bell-settings/CMakeLists.txt +0 -3
@@ 66,12 66,9 @@ target_sources(application-bell-settings
models/advanced/AboutYourBellModel.hpp
models/advanced/FrontlightListItemProvider.hpp
- models/advanced/FrontlightModel.hpp
- models/alarm_settings/AbstractAlarmSettingsModel.hpp
models/alarm_settings/AbstractPrewakeUpSettingsModel.hpp
models/alarm_settings/AbstractSnoozeSettingsModel.hpp
models/alarm_settings/AlarmSettingsListItemProvider.hpp
- models/alarm_settings/AlarmSettingsModel.hpp
models/alarm_settings/BedtimeSettingsListItemProvider.cpp
models/alarm_settings/PrewakeUpListItemProvider.hpp
models/alarm_settings/PrewakeUpSettingsModel.hpp
M products/BellHybrid/apps/application-bell-settings/models/advanced/FrontlightListItemProvider.cpp => products/BellHybrid/apps/application-bell-settings/models/advanced/FrontlightListItemProvider.cpp +1 -1
@@ 2,7 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "FrontlightListItemProvider.hpp"
-#include "FrontlightModel.hpp"
+#include <common/models/FrontlightModel.hpp>
#include <gui/widgets/ListViewEngine.hpp>
#include <common/widgets/ListItems.hpp>
M products/BellHybrid/apps/application-bell-settings/models/advanced/FrontlightModel.cpp => products/BellHybrid/apps/application-bell-settings/models/advanced/FrontlightModel.cpp +4 -2
@@ 1,7 1,7 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#include "FrontlightModel.hpp"
+#include <common/models/FrontlightModel.hpp>
#include <apps-common/ApplicationCommon.hpp>
#include <service-evtmgr/screen-light-control/ScreenLightControl.hpp>
@@ 44,7 44,9 @@ namespace app::bell_settings
this->brightnessAdapter->update(percentageToFixedVal(resp->getParams().manualModeBrightness));
this->modeAdapter->update(
resp->getMode() == screen_light_control::ScreenLightMode::Automatic ? autoStr : onDemandStr);
- this->onReady();
+ if (this->onReady) {
+ this->onReady();
+ }
}
return true;
};
M products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsListItemProvider.hpp => products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsListItemProvider.hpp +1 -1
@@ 4,7 4,7 @@
#pragma once
#include "SettingsListItemProvider.hpp"
-#include "AbstractAlarmSettingsModel.hpp"
+#include <common/models/AbstractAlarmSettingsModel.hpp>
namespace app::bell_settings
{
M products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsModel.cpp => products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsModel.cpp +1 -1
@@ 1,7 1,7 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#include <models/alarm_settings/AlarmSettingsModel.hpp>
+#include <common/models/AlarmSettingsModel.hpp>
#include <apps-common/ApplicationCommon.hpp>
#include <db/SystemSettings.hpp>
M products/BellHybrid/apps/application-bell-settings/presenter/advanced/FrontlightPresenter.hpp => products/BellHybrid/apps/application-bell-settings/presenter/advanced/FrontlightPresenter.hpp +1 -1
@@ 4,7 4,7 @@
#pragma once
-#include "models/advanced/FrontlightModel.hpp"
+#include <common/models/FrontlightModel.hpp>
#include "models/advanced/FrontlightListItemProvider.hpp"
#include <apps-common/BasePresenter.hpp>
#include <memory>
M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +3 -0
@@ 62,6 62,9 @@ target_sources(application-bell-common
include/common/models/BedtimeModel.hpp
include/common/models/TimeModel.hpp
include/common/models/AudioModel.hpp
+ include/common/models/FrontlightModel.hpp
+ include/common/models/AlarmSettingsModel.hpp
+ include/common/models/AbstractAlarmSettingsModel.hpp
include/common/popups/presenter/AlarmActivatedPresenter.hpp
include/common/popups/AlarmActivatedWindow.hpp
include/common/popups/AlarmDeactivatedWindow.hpp
R products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AbstractAlarmSettingsModel.hpp => products/BellHybrid/apps/common/include/common/models/AbstractAlarmSettingsModel.hpp +0 -0
R products/BellHybrid/apps/application-bell-settings/models/alarm_settings/AlarmSettingsModel.hpp => products/BellHybrid/apps/common/include/common/models/AlarmSettingsModel.hpp +0 -0
R products/BellHybrid/apps/application-bell-settings/models/advanced/FrontlightModel.hpp => products/BellHybrid/apps/common/include/common/models/FrontlightModel.hpp +0 -0