summaryrefslogtreecommitdiffstats
path: root/collectionwidget.h
blob: e910e57d00752c6af116a9e8b82591cfb635c41c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef COLLECTIONWIDGET_H
#define COLLECTIONWIDGET_H

#include <QWidget>

#include "beetview.h"

class QStandardItemModel;
class QSortFilterProxyModel;
class QLineEdit;
class QActionGroup;

class CollectionWidget : public QWidget {
    Q_OBJECT
    public:
        enum CustomRoles { TypeRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2, FullPathRole = Qt::UserRole + 3, GenreRole = Qt::UserRole + 4, ArtistRole = Qt::UserRole + 5, TitleRole = Qt::UserRole + 6, AlbumRole = Qt::UserRole + 7, LengthRole = Qt::UserRole + 8, UrlRole = Qt::UserRole + 9, RemoteRole = Qt::UserRole + 10 };
        enum ItemType { Artist, Album, Song, Genre, WebRadio };
        explicit CollectionWidget(QWidget *parent = nullptr);
        BeetView *view() { return mView; }
        QStandardItemModel *model() { return mModel; }
        void setHeaders(const QStringList headers) { mHeaders = headers; }
        const QStringList headers() const { return mHeaders; }
        void disableSorting() { mView->setSortingEnabled(false); }
        void enableSorting(int column = 0, Qt::SortOrder sortOrder = Qt::AscendingOrder);
        QActionGroup *customActions() { return mCustomActions; }

    signals:
        void message(const QString &msg);

    public slots:
        virtual void populate() { return; }
        virtual void expandFirst(QSortFilterProxyModel *proxy);

    private:
        BeetView *mView;
        QStandardItemModel *mModel;
        QLineEdit *mFilter;
        QStringList mHeaders;
        QActionGroup *mCustomActions;
};

#endif // COLLECTIONWIDGET_H