1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
4
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
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.
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.
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/>.
20
#ifndef TRACKPROXYMODELPLAYLISTINTERFACE_H
21
#define TRACKPROXYMODELPLAYLISTINTERFACE_H
23
#include <QtGui/QSortFilterProxyModel>
25
#include "PlaylistInterface.h"
26
#include "playlist/PlayableModel.h"
30
class PlayableProxyModel;
34
class DLLEXPORT PlayableProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface
39
explicit PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel );
40
virtual ~PlayableProxyModelPlaylistInterface();
42
virtual QList<Tomahawk::query_ptr> tracks() const;
44
virtual int trackCount() const;
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;
52
virtual Tomahawk::result_ptr currentItem() const;
53
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
55
virtual QString filter() const;
57
virtual PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; }
58
virtual bool shuffled() const { return m_shuffled; }
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 ); }
65
void onCurrentIndexChanged();
68
QWeakPointer< PlayableProxyModel > m_proxyModel;
70
PlaylistModes::RepeatMode m_repeatMode;
72
mutable QList< Tomahawk::query_ptr > m_shuffleHistory;
73
mutable QPersistentModelIndex m_shuffleCache;
78
#endif // TRACKPROXYMODELPLAYLISTINTERFACE_H