Files
MuditaOS/module-apps/application-settings/models/apps/AudioSettingsModel.hpp
Mateusz Grzegorzek 58dd02cff1 [BH-861] Cleanup Application split - part I
1. Prepare Pure and Bell specific `Application`
   classes and add them to `app` target:

- `products/BellHybrid/apps/Application.cpp`
- `products/PurePhone/apps/Application.cpp`

2. Update `CMakeLists.txt` files.
3. Move `ApplicationBell` implementation to Bell-specific
   `Application` class and remove `ApplicationBell` files.
4. Change Bell apps parent classes from `ApplicationBell`
  to Bell-specific `Application` class.
5. Rename `Application` to `ApplicationCommon` in the rest of the files.
2021-09-13 11:58:10 +02:00

69 lines
2.3 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <Application.hpp>
namespace audio
{
enum class PlaybackType;
}
namespace audio_settings
{
enum class PlaybackType
{
Notifications,
KeypadSound,
CallRingtone,
TextMessageRingtone,
Alarm
};
/// @brief Abstract audio settings model interface class
class AbstractAudioSettingsModel
{
public:
virtual ~AbstractAudioSettingsModel() noexcept = default;
[[nodiscard]] virtual bool isVibrationEnabled() = 0;
virtual void setVibrationEnabled() = 0;
virtual void setVibrationDisabled() = 0;
[[nodiscard]] virtual bool isSoundEnabled() = 0;
virtual void setSoundEnabled() = 0;
virtual void setSoundDisabled() = 0;
/// @return sound file path, returns empty string if not found
[[nodiscard]] virtual std::string getSound() = 0;
/// @param sound file path
virtual void setSound(std::string filePath) = 0;
[[nodiscard]] virtual audio::Volume getVolume() = 0;
virtual void setVolume(audio::Volume vol) = 0;
[[nodiscard]] virtual audio::PlaybackType getPlaybackType() = 0;
};
class AudioSettingsModel : public AbstractAudioSettingsModel
{
public:
/// @param application application pointer
/// @param playbackType playback type
AudioSettingsModel(app::ApplicationCommon *application, PlaybackType playbackType);
bool isVibrationEnabled() override;
void setVibrationEnabled() override;
void setVibrationDisabled() override;
bool isSoundEnabled() override;
void setSoundEnabled() override;
void setSoundDisabled() override;
std::string getSound() override;
void setSound(std::string) override;
audio::Volume getVolume() override;
void setVolume(audio::Volume vol) override;
audio::PlaybackType getPlaybackType() override;
private:
app::ApplicationCommon *application = nullptr;
audio::PlaybackType playbackType;
};
} // namespace audio_settings