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

« back to all changes in this revision

Viewing changes to src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.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-2012, 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 TRACKPROXYMODELPLAYLISTINTERFACE_H
 
21
#define TRACKPROXYMODELPLAYLISTINTERFACE_H
 
22
 
 
23
#include <QtGui/QSortFilterProxyModel>
 
24
 
 
25
#include "PlaylistInterface.h"
 
26
#include "playlist/PlayableModel.h"
 
27
 
 
28
#include "DllMacro.h"
 
29
 
 
30
class PlayableProxyModel;
 
31
 
 
32
namespace Tomahawk {
 
33
 
 
34
class DLLEXPORT PlayableProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface
 
35
{
 
36
Q_OBJECT
 
37
 
 
38
public:
 
39
    explicit PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel );
 
40
    virtual ~PlayableProxyModelPlaylistInterface();
 
41
 
 
42
    virtual QList<Tomahawk::query_ptr> tracks() const;
 
43
 
 
44
    virtual int trackCount() const;
 
45
 
 
46
    virtual void setCurrentIndex( qint64 index );
 
47
    virtual Tomahawk::result_ptr resultAt( qint64 index ) const;
 
48
    virtual Tomahawk::query_ptr queryAt( qint64 index ) const;
 
49
    virtual qint64 indexOfResult( const Tomahawk::result_ptr& result ) const;
 
50
    virtual qint64 indexOfQuery( const Tomahawk::query_ptr& query ) const;
 
51
 
 
52
    virtual Tomahawk::result_ptr currentItem() const;
 
53
    virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
 
54
 
 
55
    virtual QString filter() const;
 
56
 
 
57
    virtual PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; }
 
58
    virtual bool shuffled() const { return m_shuffled; }
 
59
 
 
60
public slots:
 
61
    virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); }
 
62
    virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); }
 
63
 
 
64
private slots:
 
65
    void onCurrentIndexChanged();
 
66
 
 
67
protected:
 
68
    QWeakPointer< PlayableProxyModel > m_proxyModel;
 
69
 
 
70
    PlaylistModes::RepeatMode m_repeatMode;
 
71
    bool m_shuffled;
 
72
    mutable QList< Tomahawk::query_ptr > m_shuffleHistory;
 
73
    mutable QPersistentModelIndex m_shuffleCache;
 
74
};
 
75
 
 
76
} //ns
 
77
 
 
78
#endif // TRACKPROXYMODELPLAYLISTINTERFACE_H