Files
MuditaOS/module-apps/application-music-player/models/SongContext.cpp
tomaszkrosnowski cf96290deb [EGD-7232] Music player track preview
Added track progress bar and track preview window.
2021-10-14 18:43:32 +02:00

32 lines
823 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "SongContext.hpp"
#include <optional>
namespace app::music_player
{
void SongContext::clear()
{
currentSongState = SongState::NotPlaying;
currentFileToken = std::nullopt;
filePath = "";
currentPos = 0;
}
bool SongContext::isValid() const
{
return (currentFileToken && currentFileToken->IsValid() && !filePath.empty());
}
bool SongContext::isPlaying() const
{
return isValid() && currentSongState == SongState::Playing;
}
bool SongContext::isPaused() const
{
return isValid() && currentSongState == SongState::NotPlaying;
}
} // namespace app::music_player