1
/***********************************************************************
2
* Copyright 2012 Eike Hein <hein@kde.org>
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of
7
* the License or (at your option) version 3 or any later version
8
* accepted by the membership of KDE e.V. (or its successor approved
9
* by the membership of KDE e.V.), which shall act as a proxy
10
* defined in Section 14 of version 3 of the license.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
***********************************************************************/
21
#ifndef JUK_MEDIAPLAYRER2PLAYER_H
22
#define JUK_MEDIAPLAYRER2PLAYER_H
24
#include <QDBusAbstractAdaptor>
25
#include <QDBusObjectPath>
28
#include <Phonon/MediaSource>
30
#include "playermanager.h"
32
class MediaPlayer2Player : public QDBusAbstractAdaptor
35
Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2.Player") // Docs: http://www.mpris.org/2.1/spec/Player_Node.html
37
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus)
38
Q_PROPERTY(QString LoopStatus READ LoopStatus WRITE setLoopStatus)
39
Q_PROPERTY(double Rate READ Rate WRITE setRate)
40
Q_PROPERTY(bool Shuffle READ Shuffle WRITE setShuffle)
41
Q_PROPERTY(QVariantMap Metadata READ Metadata)
42
Q_PROPERTY(double Volume READ Volume WRITE setVolume)
43
Q_PROPERTY(qlonglong Position READ Position)
44
Q_PROPERTY(double MinimumRate READ MinimumRate)
45
Q_PROPERTY(double MaximumRate READ MaximumRate)
46
Q_PROPERTY(bool CanGoNext READ CanGoNext)
47
Q_PROPERTY(bool CanGoPrevious READ CanGoPrevious)
48
Q_PROPERTY(bool CanPlay READ CanPlay)
49
Q_PROPERTY(bool CanPause READ CanPause)
50
Q_PROPERTY(bool CanSeek READ CanSeek)
51
Q_PROPERTY(bool CanControl READ CanControl)
54
explicit MediaPlayer2Player(QObject* parent);
55
~MediaPlayer2Player();
57
QString PlaybackStatus() const;
58
QString LoopStatus() const;
59
void setLoopStatus(const QString& loopStatus) const;
61
void setRate(double rate) const;
63
void setShuffle(bool shuffle) const;
64
QVariantMap Metadata() const;
65
double Volume() const;
66
void setVolume(double volume) const;
67
qlonglong Position() const;
68
double MinimumRate() const;
69
double MaximumRate() const;
70
bool CanGoNext() const;
71
bool CanGoPrevious() const;
73
bool CanPause() const;
75
bool CanControl() const;
78
void Seeked(qlonglong Position) const;
82
void Previous() const;
84
void PlayPause() const;
87
void Seek(qlonglong Offset) const;
88
void SetPosition(const QDBusObjectPath& TrackId, qlonglong Position) const;
89
void OpenUri(QString Uri) const;
92
void tick(qint64 newPos);
93
void currentSourceChanged() const;
94
void stateUpdated() const;
95
void totalTimeChanged() const;
96
void seekableChanged(bool seekable) const;
97
void volumeChanged(qreal newVol) const;
100
void signalPropertiesChange(const QVariantMap& properties) const;
103
QPointer<PlayerManager> m_player;