mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-18 22:18:38 -04:00
Updated AlarmOptionsItem to use UTF8Spinner. Created specialized widgets to cover options sets. Updated GenericSpinner to handle Pure navigation and content swap. Updated Alarm RRule code to work with Custom Days selection and new widgets. Added Tests. General GUI stylistic fixes. Increased app Alarm Clock and service Time stack sizes.
37 lines
1.2 KiB
C++
37 lines
1.2 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 "AlarmSnoozeOptionsItem.hpp"
|
|
#include <i18n/i18n.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
AlarmSnoozeOptionsItem::AlarmSnoozeOptionsItem(const std::string &description) : AlarmOptionsItem(description)
|
|
{
|
|
std::vector<UTF8> printOptions;
|
|
|
|
for (auto const &option : snoozeOptions) {
|
|
printOptions.push_back(option.second);
|
|
}
|
|
|
|
optionSpinner->setData({printOptions});
|
|
|
|
onSaveCallback = [&](std::shared_ptr<AlarmEventRecord> alarm) {
|
|
for (auto const &option : snoozeOptions) {
|
|
if (option.second == optionSpinner->getCurrentValue().c_str()) {
|
|
alarm->snoozeDuration = option.first.count();
|
|
}
|
|
}
|
|
};
|
|
|
|
onLoadCallback = [&](std::shared_ptr<AlarmEventRecord> alarm) {
|
|
auto valueToLoad = alarm->snoozeDuration;
|
|
for (auto const &option : snoozeOptions) {
|
|
if (option.first.count() == valueToLoad) {
|
|
optionSpinner->setCurrentValue(option.second);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
} /* namespace gui */
|