2015-08-24 03:11:13 +02:00
|
|
|
#ifndef PLAYERWATCHER_H
|
|
|
|
#define PLAYERWATCHER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QDBusServiceWatcher)
|
|
|
|
|
|
|
|
class OrgFreedesktopDBusPropertiesInterface;
|
|
|
|
class OrgMprisMediaPlayer2PlayerInterface;
|
|
|
|
|
|
|
|
namespace DBusSoundRecorder {
|
|
|
|
|
|
|
|
class PlayerWatcher : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit PlayerWatcher(const QString &appName, QObject *parent = nullptr);
|
|
|
|
|
2015-08-25 19:53:54 +02:00
|
|
|
void play();
|
|
|
|
void stop();
|
|
|
|
void pause();
|
|
|
|
void playPause();
|
|
|
|
|
|
|
|
bool isPlaying() const;
|
2015-08-24 03:11:13 +02:00
|
|
|
const QString &title() const;
|
|
|
|
const QString &album() const;
|
|
|
|
const QString &artist() const;
|
|
|
|
const QString &year() const;
|
|
|
|
const QString &genre() const;
|
|
|
|
unsigned int trackNumber() const;
|
2015-08-25 19:53:54 +02:00
|
|
|
unsigned int diskNumber() const;
|
|
|
|
unsigned long long length() const;
|
2015-08-24 03:11:13 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void nextSong();
|
2015-08-25 19:53:54 +02:00
|
|
|
void playbackStarted();
|
|
|
|
void playbackStopped();
|
2015-08-24 03:11:13 +02:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
|
2015-08-25 19:53:54 +02:00
|
|
|
void propertiesChanged();
|
|
|
|
void seeked(qlonglong pos);
|
2015-08-24 03:11:13 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_service;
|
|
|
|
QDBusServiceWatcher *m_serviceWatcher;
|
|
|
|
OrgFreedesktopDBusPropertiesInterface *m_propertiesInterface;
|
|
|
|
OrgMprisMediaPlayer2PlayerInterface *m_playerInterface;
|
2015-08-25 19:53:54 +02:00
|
|
|
bool m_isPlaying;
|
2015-08-24 03:11:13 +02:00
|
|
|
QString m_title;
|
|
|
|
QString m_album;
|
|
|
|
QString m_artist;
|
|
|
|
QString m_year;
|
|
|
|
QString m_genre;
|
|
|
|
unsigned int m_trackNumber;
|
2015-08-25 19:53:54 +02:00
|
|
|
unsigned int m_diskNumber;
|
|
|
|
unsigned long long m_length;
|
2015-08-24 03:11:13 +02:00
|
|
|
};
|
|
|
|
|
2015-08-25 19:53:54 +02:00
|
|
|
inline bool PlayerWatcher::isPlaying() const
|
|
|
|
{
|
|
|
|
return m_isPlaying;
|
|
|
|
}
|
|
|
|
|
2015-08-24 03:11:13 +02:00
|
|
|
inline const QString &PlayerWatcher::title() const
|
|
|
|
{
|
|
|
|
return m_title;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QString &PlayerWatcher::album() const
|
|
|
|
{
|
|
|
|
return m_album;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QString &PlayerWatcher::artist() const
|
|
|
|
{
|
|
|
|
return m_artist;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QString &PlayerWatcher::year() const
|
|
|
|
{
|
|
|
|
return m_year;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QString &PlayerWatcher::genre() const
|
|
|
|
{
|
|
|
|
return m_genre;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline unsigned int PlayerWatcher::trackNumber() const
|
|
|
|
{
|
|
|
|
return m_trackNumber;
|
|
|
|
}
|
|
|
|
|
2015-08-25 19:53:54 +02:00
|
|
|
inline unsigned int PlayerWatcher::diskNumber() const
|
|
|
|
{
|
|
|
|
return m_diskNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline unsigned long long PlayerWatcher::length() const
|
|
|
|
{
|
|
|
|
return m_length;
|
|
|
|
}
|
|
|
|
|
2015-08-24 03:11:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PLAYERWATCHER_H
|