2
* Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#ifndef RECENTLPLAYLISTSMODEL_H
21
#define RECENTLPLAYLISTSMODEL_H
23
#include <QModelIndex>
28
#include "database/DatabaseCommand_LoadAllSortedPlaylists.h"
30
class RecentPlaylistsModel : public QAbstractListModel
34
explicit RecentPlaylistsModel( unsigned int maxPlaylists, QObject* parent = 0 );
36
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
37
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
44
void emptinessChanged( bool isEmpty );
46
void loadingStarted();
47
void loadingFinished();
51
void playlistsLoaded( const QList<DatabaseCommand_LoadAllSortedPlaylists::SourcePlaylistPair>& playlistGuids );
53
void onPlaylistsRemoved( QList< Tomahawk::playlist_ptr > playlists );
54
void onDynPlaylistsRemoved( QList< Tomahawk::dynplaylist_ptr > playlists );
55
void updatePlaylist();
58
void onSourceAdded( const Tomahawk::source_ptr& source );
61
QList< Tomahawk::playlist_ptr > m_playlists;
62
mutable QHash< Tomahawk::playlist_ptr, QString > m_artists;
63
unsigned int m_maxPlaylists;
67
#endif // RECENTLPLAYLISTSMODEL_H