~aleteoryx/muditaos

1fff0a5115f78af1d5bccad88e366dd1d9663e36 — Lukasz Mastalerz 2 years ago 1c18ac4
[BH-1768] Snooze mode with deep pressed knob

Fixed not disappearing snooze icon when an alarm is deactivated
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 7,6 7,7 @@
* Fixed meditation countdown timer when a deep press is performed
* Fixed "turn off" window display time
* Fixed uneven screen refresh when turning on the device
* Fixed not disappearing snooze icon when an alarm is deactivated

### Added
* Files not fully transferred via Center will be now removed when USB cable is unplugged

M module-gui/gui/widgets/BoxLayout.cpp => module-gui/gui/widgets/BoxLayout.cpp +1 -2
@@ 5,7 5,6 @@
#include "BoxLayoutSizeStore.hpp"
#include <InputEvent.hpp>
#include <Label.hpp>
#include <log/log.hpp>
#include "assert.h"

namespace gui


@@ 203,7 202,7 @@ namespace gui
        resizeItems();
    }

    // space left distposition `first is better` tactics
    // space left disposition `first is better` tactics
    // there could be other i.e. socialism: each element take in equal part up to it's max size
    // not needed now == not implemented
    template <Axis axis>

M products/BellHybrid/apps/common/include/common/widgets/SnoozeTimer.hpp => products/BellHybrid/apps/common/include/common/widgets/SnoozeTimer.hpp +1 -11
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 19,15 19,6 @@ namespace gui
    class SnoozeTimer : public HBox
    {
      public:
        enum class Status
        {
            UNKNOWN,
            RINGING,
            ACTIVATED,
            DEACTIVATED,
            SNOOZE
        };

        explicit SnoozeTimer(Item *parent = nullptr, Position x = 0U, Position y = 0U, Length w = 0U, Length h = 0U);

        auto setFont(std::string newFontName) noexcept -> void;


@@ 39,7 30,6 @@ namespace gui
      private:
        TimeSetFmtSpinner *timeSpinner = nullptr;

        Status alarmStatus   = Status::DEACTIVATED;
        std::string fontName = style::window::font::largelight;
    };
} /* namespace gui */

M products/BellHybrid/apps/common/src/AlarmModel.cpp => products/BellHybrid/apps/common/src/AlarmModel.cpp +3 -6
@@ 80,14 80,11 @@ namespace app
            return;
        }
        alarmEventPtr->enabled = value;
        updateAlarm(*alarmEventPtr);
        if (value) {
            alarmStatus = alarms::AlarmStatus::Activated;
        }
        else {
            alarmStatus = alarms::AlarmStatus::Deactivated;
        if (isSnoozeActive()) {
            disableSnooze(*alarmEventPtr);
        }
        updateAlarm(*alarmEventPtr);
        alarmStatus = value ? alarms::AlarmStatus::Activated : alarms::AlarmStatus::Deactivated;
    }
    void AlarmModel::updateAlarm(AlarmEventRecord &alarm)
    {

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp +4 -2
@@ 182,18 182,20 @@ namespace gui
            alarm->setVisible(false);
            alarm->setAlarmTimeVisible(false);
            snoozeTimer->setVisible(false);
            snoozeTimer->setTimerVisible(false);
            alarm->informContentChanged();
            break;
        case HeaderViewMode::AlarmIconAndTime:
            snoozeTimer->setVisible(false);
            snoozeTimer->informContentChanged();
            alarm->setVisible(true);
            alarm->setAlarmTimeVisible(true);
            snoozeTimer->setVisible(false);
            alarm->informContentChanged();
            break;
        case HeaderViewMode::AlarmIcon:
            snoozeTimer->setVisible(false);
            alarm->setVisible(true);
            alarm->setAlarmTimeVisible(false);
            snoozeTimer->setVisible(false);
            alarm->informContentChanged();
            break;
        case HeaderViewMode::SnoozeIconAndTime:

M products/BellHybrid/apps/common/src/widgets/SnoozeTimer.cpp => products/BellHybrid/apps/common/src/widgets/SnoozeTimer.cpp +1 -2
@@ 1,9 1,8 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <common/widgets/SnoozeTimer.hpp>
#include <FontManager.hpp>
#include <RawFont.hpp>
#include <gui/widgets/text/Label.hpp>
#include <gui/widgets/ImageBox.hpp>