1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /***********************************************************************
|
---|
20 | * Copyright 2012 Eike Hein <hein@kde.org>
|
---|
21 | *
|
---|
22 | * This program is free software; you can redistribute it and/or
|
---|
23 | * modify it under the terms of the GNU General Public License as
|
---|
24 | * published by the Free Software Foundation; either version 2 of
|
---|
25 | * the License or (at your option) version 3 or any later version
|
---|
26 | * accepted by the membership of KDE e.V. (or its successor approved
|
---|
27 | * by the membership of KDE e.V.), which shall act as a proxy
|
---|
28 | * defined in Section 14 of version 3 of the license.
|
---|
29 | *
|
---|
30 | * This program is distributed in the hope that it will be useful,
|
---|
31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
33 | * GNU General Public License for more details.
|
---|
34 | *
|
---|
35 | * You should have received a copy of the GNU General Public License
|
---|
36 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
37 | ***********************************************************************/
|
---|
38 |
|
---|
39 | #ifndef MEDIAPLAYER2PLAYER_H
|
---|
40 | #define MEDIAPLAYER2PLAYER_H
|
---|
41 |
|
---|
42 | #include <QDBusAbstractAdaptor>
|
---|
43 | #include <QDBusObjectPath>
|
---|
44 |
|
---|
45 | class BaseGui;
|
---|
46 | class Core;
|
---|
47 | class Playlist;
|
---|
48 |
|
---|
49 | class MediaPlayer2Player : public QDBusAbstractAdaptor
|
---|
50 | {
|
---|
51 | Q_OBJECT
|
---|
52 | Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2.Player") // Docs: http://www.mpris.org/2.1/spec/Player_Node.html
|
---|
53 |
|
---|
54 | Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus)
|
---|
55 | Q_PROPERTY(QString LoopStatus READ LoopStatus WRITE setLoopStatus)
|
---|
56 | Q_PROPERTY(double Rate READ Rate WRITE setRate)
|
---|
57 | Q_PROPERTY(bool Shuffle READ Shuffle WRITE setShuffle)
|
---|
58 | Q_PROPERTY(QVariantMap Metadata READ Metadata)
|
---|
59 | Q_PROPERTY(double Volume READ Volume WRITE setVolume)
|
---|
60 | Q_PROPERTY(qlonglong Position READ Position)
|
---|
61 | Q_PROPERTY(double MinimumRate READ MinimumRate)
|
---|
62 | Q_PROPERTY(double MaximumRate READ MaximumRate)
|
---|
63 | Q_PROPERTY(bool CanGoNext READ CanGoNext)
|
---|
64 | Q_PROPERTY(bool CanGoPrevious READ CanGoPrevious)
|
---|
65 | Q_PROPERTY(bool CanPlay READ CanPlay)
|
---|
66 | Q_PROPERTY(bool CanPause READ CanPause)
|
---|
67 | Q_PROPERTY(bool CanSeek READ CanSeek)
|
---|
68 | Q_PROPERTY(bool CanControl READ CanControl)
|
---|
69 |
|
---|
70 | public:
|
---|
71 | explicit MediaPlayer2Player(BaseGui * gui, QObject* parent);
|
---|
72 | ~MediaPlayer2Player();
|
---|
73 |
|
---|
74 | QString PlaybackStatus() const;
|
---|
75 | QString LoopStatus() const;
|
---|
76 | void setLoopStatus(const QString& loopStatus) const;
|
---|
77 | double Rate() const;
|
---|
78 | void setRate(double rate) const;
|
---|
79 | bool Shuffle() const;
|
---|
80 | void setShuffle(bool shuffle) const;
|
---|
81 | QVariantMap Metadata() const;
|
---|
82 | double Volume() const;
|
---|
83 | void setVolume(double volume) const;
|
---|
84 | qlonglong Position() const;
|
---|
85 | double MinimumRate() const;
|
---|
86 | double MaximumRate() const;
|
---|
87 | bool CanGoNext() const;
|
---|
88 | bool CanGoPrevious() const;
|
---|
89 | bool CanPlay() const;
|
---|
90 | bool CanPause() const;
|
---|
91 | bool CanSeek() const;
|
---|
92 | bool CanControl() const;
|
---|
93 |
|
---|
94 | signals:
|
---|
95 | void Seeked(qlonglong Position) const;
|
---|
96 |
|
---|
97 | public slots:
|
---|
98 | void Next() const;
|
---|
99 | void Previous() const;
|
---|
100 | void Pause() const;
|
---|
101 | void PlayPause() const;
|
---|
102 | void Stop() const;
|
---|
103 | void Play() const;
|
---|
104 | void Seek(qlonglong Offset) const;
|
---|
105 | void SetPosition(const QDBusObjectPath& TrackId, qlonglong Position) const;
|
---|
106 | void OpenUri(QString uri) const;
|
---|
107 |
|
---|
108 | private slots:
|
---|
109 | void tick(qint64 newPos);
|
---|
110 | void emitMetadataChange() const;
|
---|
111 | void currentSourceChanged() const;
|
---|
112 | void stateUpdated() const;
|
---|
113 | void totalTimeChanged() const;
|
---|
114 | void seekableChanged(bool seekable) const;
|
---|
115 | void volumeChanged() const;
|
---|
116 |
|
---|
117 | private:
|
---|
118 | qint64 oldPos;
|
---|
119 | Core* m_core;
|
---|
120 | Playlist* m_playlist;
|
---|
121 | };
|
---|
122 |
|
---|
123 | #endif
|
---|