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

« back to all changes in this revision

Viewing changes to src/libtomahawk/widgets/RecentPlaylistsModel.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
/*
 
2
 *    Copyright (C) 2011  Leo Franchi <lfranchi@kde.org>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
 
 
20
#ifndef RECENTLPLAYLISTSMODEL_H
 
21
#define RECENTLPLAYLISTSMODEL_H
 
22
 
 
23
#include <QModelIndex>
 
24
#include <QTimer>
 
25
 
 
26
#include "Playlist.h"
 
27
#include "Source.h"
 
28
#include "database/DatabaseCommand_LoadAllSortedPlaylists.h"
 
29
 
 
30
class RecentPlaylistsModel : public QAbstractListModel
 
31
{
 
32
    Q_OBJECT
 
33
public:
 
34
    explicit RecentPlaylistsModel( unsigned int maxPlaylists, QObject* parent = 0 );
 
35
 
 
36
    virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
 
37
    virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
 
38
 
 
39
public slots:
 
40
    void refresh();
 
41
    void onReady();
 
42
 
 
43
signals:
 
44
    void emptinessChanged( bool isEmpty );
 
45
    
 
46
    void loadingStarted();
 
47
    void loadingFinished();
 
48
 
 
49
private slots:
 
50
    void onRefresh();
 
51
    void playlistsLoaded( const QList<DatabaseCommand_LoadAllSortedPlaylists::SourcePlaylistPair>& playlistGuids );
 
52
 
 
53
    void onPlaylistsRemoved( QList< Tomahawk::playlist_ptr > playlists );
 
54
    void onDynPlaylistsRemoved( QList< Tomahawk::dynplaylist_ptr > playlists );
 
55
    void updatePlaylist();
 
56
 
 
57
    void sourceOnline();
 
58
    void onSourceAdded( const Tomahawk::source_ptr& source );
 
59
 
 
60
private:
 
61
    QList< Tomahawk::playlist_ptr > m_playlists;
 
62
    mutable QHash< Tomahawk::playlist_ptr, QString > m_artists;
 
63
    unsigned int m_maxPlaylists;
 
64
    QTimer* m_timer;
 
65
};
 
66
 
 
67
#endif // RECENTLPLAYLISTSMODEL_H