~neon/juk/master

« back to all changes in this revision

Viewing changes to mpris2/mediaplayer2.h

  • Committer: Michael Pyne
  • Date: 2012-04-16 01:53:04 UTC
  • Revision ID: git-v1:54c6db81c2fe09999b9953249dce839f5c7a0a66
Initial MPRIS2 support.

Eike Hein has kindly donated a working Mpris2 adaptor with instructions
on how to integrate into JuK, so I've done so.

This is just at the "compiles and links" stage and the track ID will
give a lot of weirdness due to the strictness of the D-Bus Object Path
name spec.

The reason we don't just use an identifier for a track is that the
"primary key" JuK uses is the canonical file name. JuK has no internal
RDBMS or anything similar where primary keys would be assigned. Because
of this we encode track IDs using z-Base-32 so they will not violate the
D-Bus spec.

Thanks to Eike for the large code contribution and integration support!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************
 
2
 * Copyright 2012  Eike Hein <hein@kde.org>
 
3
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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
 ***********************************************************************/
 
20
 
 
21
#ifndef JUK_MEDIAPLAYRER2_H
 
22
#define JUK_MEDIAPLAYRER2_H
 
23
 
 
24
#include <QDBusAbstractAdaptor>
 
25
 
 
26
class MediaPlayer2 : public QDBusAbstractAdaptor
 
27
{
 
28
    Q_OBJECT
 
29
    Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2") // Docs: http://www.mpris.org/2.1/spec/Root_Node.html
 
30
 
 
31
    Q_PROPERTY(bool CanRaise READ CanRaise)
 
32
    Q_PROPERTY(bool CanQuit READ CanQuit)
 
33
 
 
34
    Q_PROPERTY(bool HasTrackList READ HasTrackList)
 
35
 
 
36
    Q_PROPERTY(QString Identity READ Identity)
 
37
    Q_PROPERTY(QString DesktopEntry READ DesktopEntry)
 
38
 
 
39
    Q_PROPERTY(QStringList SupportedUriSchemes READ SupportedUriSchemes)
 
40
    Q_PROPERTY(QStringList SupportedMimeTypes READ SupportedMimeTypes)
 
41
 
 
42
    public:
 
43
        explicit MediaPlayer2(QObject* parent);
 
44
        ~MediaPlayer2();
 
45
 
 
46
        bool CanRaise() const;
 
47
        bool CanQuit() const;
 
48
 
 
49
        bool HasTrackList() const;
 
50
 
 
51
        QString Identity() const;
 
52
        QString DesktopEntry() const;
 
53
 
 
54
        QStringList SupportedUriSchemes() const;
 
55
        QStringList SupportedMimeTypes() const;
 
56
 
 
57
    public slots:
 
58
        void Raise() const;
 
59
        void Quit() const;
 
60
};
 
61
 
 
62
#endif