~ci-train-bot/qtubuntu-media/qtubuntu-media-ubuntu-xenial-landing-035

« back to all changes in this revision

Viewing changes to src/aal/aalmediaplaylistcontrol.h

  • Committer: Alfonso Sanchez-Beato
  • Date: 2015-09-02 08:02:08 UTC
  • mfrom: (83.1.2 qtubuntu-media)
  • Revision ID: alfonso.sanchez-beato@canonical.com-20150902080208-tsxsb1ixf7qph5fm
[ Jim Hodapp ]
Added background playlist support connecting qtmultimedia with media-hub.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef AALMEDIAPLAYLISTCONTROL_H
 
18
#define AALMEDIAPLAYLISTCONTROL_H
 
19
 
 
20
#include <qmediaplaylistcontrol_p.h>
 
21
 
 
22
#include <core/media/player.h>
 
23
#include <core/media/track_list.h>
 
24
 
 
25
#include <core/connection.h>
 
26
 
 
27
#include <memory>
 
28
 
 
29
QT_BEGIN_NAMESPACE
 
30
 
 
31
class QMediaPlaylistProvider;
 
32
class AalMediaPlaylistProvider;
 
33
 
 
34
class AalMediaPlaylistControl : public QMediaPlaylistControl
 
35
{
 
36
Q_OBJECT
 
37
public:
 
38
    AalMediaPlaylistControl(QObject *parent=0);
 
39
    ~AalMediaPlaylistControl();
 
40
 
 
41
    QMediaPlaylistProvider* playlistProvider() const;
 
42
    bool setPlaylistProvider(QMediaPlaylistProvider *playlist);
 
43
 
 
44
    int currentIndex() const;
 
45
    void setCurrentIndex(int position);
 
46
    int nextIndex(int steps) const;
 
47
    int previousIndex(int steps) const;
 
48
 
 
49
    void next();
 
50
    void previous();
 
51
 
 
52
    QMediaPlaylist::PlaybackMode playbackMode() const;
 
53
    void setPlaybackMode(QMediaPlaylist::PlaybackMode mode);
 
54
 
 
55
    void setPlayerSession(const std::shared_ptr<core::ubuntu::media::Player>& playerSession);
 
56
 
 
57
Q_SIGNALS:
 
58
    void playlistProviderChanged();
 
59
    void currentIndexChanged(int position);
 
60
    void currentMediaChanged(const QMediaContent&);
 
61
    void playbackModeChanged(QMediaPlaylist::PlaybackMode mode);
 
62
 
 
63
private Q_SLOTS:
 
64
    void onTrackChanged(const core::ubuntu::media::Track::Id& id);
 
65
 
 
66
private:
 
67
    void connect_signals();
 
68
    void disconnect_signals();
 
69
    inline AalMediaPlaylistProvider* aalMediaPlaylistProvider();
 
70
 
 
71
    std::shared_ptr<core::ubuntu::media::Player> m_hubPlayerSession;
 
72
    std::shared_ptr<core::ubuntu::media::TrackList> m_hubTrackList;
 
73
    QMediaPlaylistProvider *m_playlistProvider;
 
74
 
 
75
    int m_currentIndex;
 
76
 
 
77
    core::Connection m_trackChangedConnection;
 
78
};
 
79
 
 
80
QT_END_NAMESPACE
 
81
 
 
82
#endif