mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-07 06:34:16 +02:00
Prepare BearWave for public repository
This commit is contained in:
68
src/bearwavecontroladaptor.cpp
Normal file
68
src/bearwavecontroladaptor.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include "bearwavecontroladaptor.h"
|
||||
|
||||
#include "radiobackend.h"
|
||||
|
||||
BearWaveControlAdaptor::BearWaveControlAdaptor(RadioBackend *backend)
|
||||
: QDBusAbstractAdaptor(backend)
|
||||
, m_backend(backend)
|
||||
{
|
||||
connect(m_backend, &RadioBackend::listsChanged, this, &BearWaveControlAdaptor::StationsChanged);
|
||||
}
|
||||
|
||||
QVariantList BearWaveControlAdaptor::GetFavorites() const
|
||||
{
|
||||
return m_backend ? m_backend->getFavoriteStations() : QVariantList();
|
||||
}
|
||||
|
||||
QVariantList BearWaveControlAdaptor::GetRecentStations() const
|
||||
{
|
||||
return m_backend ? m_backend->getRecentStations() : QVariantList();
|
||||
}
|
||||
|
||||
bool BearWaveControlAdaptor::PlayFavoriteByUuid(const QString &uuid, const QString &urlResolved)
|
||||
{
|
||||
return m_backend ? m_backend->playFavoriteByUuid(uuid, urlResolved) : false;
|
||||
}
|
||||
|
||||
bool BearWaveControlAdaptor::PlayRecentByUuid(const QString &uuid, const QString &urlResolved)
|
||||
{
|
||||
return m_backend ? m_backend->playRecentByUuid(uuid, urlResolved) : false;
|
||||
}
|
||||
|
||||
bool BearWaveControlAdaptor::HasNext() const
|
||||
{
|
||||
return m_backend ? m_backend->hasNextStation() : false;
|
||||
}
|
||||
|
||||
bool BearWaveControlAdaptor::HasPrevious() const
|
||||
{
|
||||
return m_backend ? m_backend->hasPreviousStation() : false;
|
||||
}
|
||||
|
||||
void BearWaveControlAdaptor::PlayNext()
|
||||
{
|
||||
if (m_backend) {
|
||||
m_backend->playNextStation();
|
||||
}
|
||||
}
|
||||
|
||||
void BearWaveControlAdaptor::PlayPrevious()
|
||||
{
|
||||
if (m_backend) {
|
||||
m_backend->playPreviousStation();
|
||||
}
|
||||
}
|
||||
|
||||
void BearWaveControlAdaptor::PlayPause()
|
||||
{
|
||||
if (m_backend && m_backend->player()) {
|
||||
m_backend->player()->togglePlayPause();
|
||||
}
|
||||
}
|
||||
|
||||
void BearWaveControlAdaptor::Stop()
|
||||
{
|
||||
if (m_backend && m_backend->player()) {
|
||||
m_backend->player()->stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user