~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/infoplugins/linux/mpris/MprisPlugin.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 
2
 *
 
3
 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 
4
 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
 
5
 *
 
6
 *   Tomahawk is free software: you can redistribute it and/or modify
 
7
 *   it under the terms of the GNU General Public License as published by
 
8
 *   the Free Software Foundation, either version 3 of the License, or
 
9
 *   (at your option) any later version.
 
10
 *
 
11
 *   Tomahawk is distributed in the hope that it will be useful,
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
 *   GNU General Public License for more details.
 
15
 *
 
16
 *   You should have received a copy of the GNU General Public License
 
17
 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef MPRISPLUGIN_H
 
21
#define MPRISPLUGIN_H
 
22
 
 
23
#include "audio/AudioEngine.h"
 
24
#include "infosystem/InfoSystem.h"
 
25
#include "infoplugins/InfoPluginDllMacro.h"
 
26
 
 
27
#include <QObject>
 
28
#include <QVariant>
 
29
#include <QtDBus/QtDBus>
 
30
 
 
31
namespace Tomahawk
 
32
{
 
33
 
 
34
namespace InfoSystem
 
35
{
 
36
 
 
37
class INFOPLUGINDLLEXPORT MprisPlugin : public InfoPlugin
 
38
{
 
39
    Q_OBJECT
 
40
    Q_INTERFACES( Tomahawk::InfoSystem::InfoPlugin )
 
41
 
 
42
public:
 
43
    MprisPlugin();
 
44
    virtual ~MprisPlugin();
 
45
 
 
46
    // MPRIS DBus Methods
 
47
 
 
48
    // org.mpris.MediaPlayer2
 
49
 
 
50
    Q_PROPERTY( bool CanQuit READ canQuit )
 
51
    bool canQuit() const;
 
52
 
 
53
    Q_PROPERTY( bool CanRaise READ canRaise )
 
54
    bool canRaise() const;
 
55
 
 
56
    Q_PROPERTY( QString DesktopEntry READ desktopEntry )
 
57
    QString desktopEntry() const;
 
58
 
 
59
    Q_PROPERTY( bool HasTrackList READ hasTrackList )
 
60
    bool hasTrackList() const;
 
61
 
 
62
    Q_PROPERTY( QString Identity READ identity )
 
63
    QString identity() const;
 
64
 
 
65
    Q_PROPERTY( QStringList SupportedMimeTypes READ supportedMimeTypes )
 
66
    QStringList supportedMimeTypes() const;
 
67
 
 
68
    Q_PROPERTY( QStringList SupportedUriSchemes READ supportedUriSchemes )
 
69
    QStringList supportedUriSchemes() const;
 
70
 
 
71
    // org.mpris.MediaPlayer2.Player
 
72
 
 
73
    Q_PROPERTY( bool CanControl READ canControl )
 
74
    bool canControl() const;
 
75
 
 
76
    Q_PROPERTY( bool CanGoNext READ canGoNext )
 
77
    bool canGoNext() const;
 
78
 
 
79
    Q_PROPERTY( bool CanGoPrevious READ canGoPrevious )
 
80
    bool canGoPrevious() const;
 
81
 
 
82
    Q_PROPERTY( bool CanPause READ canPause )
 
83
    bool canPause() const;
 
84
 
 
85
    Q_PROPERTY( bool CanPlay READ canPlay )
 
86
    bool canPlay() const;
 
87
 
 
88
    Q_PROPERTY( bool CanSeek READ canSeek )
 
89
    bool canSeek() const;
 
90
 
 
91
    Q_PROPERTY( QString LoopStatus READ loopStatus WRITE setLoopStatus )
 
92
    QString loopStatus() const;
 
93
    void setLoopStatus( const QString& value );
 
94
 
 
95
    Q_PROPERTY( double MaximumRate READ maximumRate )
 
96
    double maximumRate() const;
 
97
 
 
98
    Q_PROPERTY( QVariantMap Metadata READ metadata )
 
99
    QVariantMap metadata() const;
 
100
 
 
101
    Q_PROPERTY( double MinimumRate READ minimumRate )
 
102
    double minimumRate() const;
 
103
 
 
104
    Q_PROPERTY( QString PlaybackStatus READ playbackStatus )
 
105
    QString playbackStatus() const;
 
106
 
 
107
    Q_PROPERTY( qlonglong Position READ position )
 
108
    qlonglong position() const;
 
109
 
 
110
    Q_PROPERTY( double Rate READ rate WRITE setRate )
 
111
    double rate() const;
 
112
    void setRate( double value );
 
113
 
 
114
    Q_PROPERTY( bool Shuffle READ shuffle WRITE setShuffle )
 
115
    bool shuffle() const;
 
116
    void setShuffle( bool value );
 
117
 
 
118
    Q_PROPERTY( double Volume READ volume WRITE setVolume )
 
119
    double volume() const;
 
120
    void setVolume( double value );
 
121
 
 
122
public slots:
 
123
    virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
 
124
    {
 
125
        Q_UNUSED( criteria );
 
126
        Q_UNUSED( requestData );
 
127
    }
 
128
 
 
129
    // org.mpris.MediaPlayer2
 
130
    void Raise();
 
131
    void Quit();
 
132
 
 
133
    // org.mpris.MediaPlayer2.Player
 
134
    void Next();
 
135
    void OpenUri( const QString& Uri );
 
136
    void Pause();
 
137
    void Play();
 
138
    void PlayPause();
 
139
    void Previous();
 
140
    void Seek( qlonglong Offset );
 
141
    void SetPosition( const QDBusObjectPath& TrackId, qlonglong Position );
 
142
    void Stop();
 
143
 
 
144
protected slots:
 
145
    virtual void init();
 
146
    
 
147
    virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
 
148
    {
 
149
        Q_UNUSED( requestData );
 
150
    }
 
151
    void pushInfo( Tomahawk::InfoSystem::InfoPushData pushData );
 
152
 
 
153
private slots:
 
154
    void stateChanged( AudioState newState, AudioState oldState );
 
155
    void onVolumeChanged( int volume );
 
156
    void onPlaylistChanged( Tomahawk::playlistinterface_ptr );
 
157
    void onTrackCountChanged( unsigned int tracks );
 
158
    void onSeeked( qint64 ms );
 
159
 
 
160
signals:
 
161
    void Seeked( qlonglong Position );
 
162
 
 
163
private:
 
164
    // Get Info
 
165
 
 
166
    // Push Info
 
167
    void audioStarted( const QVariant& input );
 
168
    void audioFinished( const QVariant& input );
 
169
    void audioStopped();
 
170
    void audioPaused();
 
171
    void audioResumed( const QVariant& input );
 
172
 
 
173
    // DBus
 
174
    void notifyPropertyChanged( const QString& interface, const QString& propertyName );
 
175
    QString m_playbackStatus;
 
176
    QString m_coverTempFile;
 
177
};
 
178
 
 
179
};
 
180
 
 
181
}
 
182
 
 
183
#endif // MPRISPLUGIN_H