2009-12-24 20:16:07 +01:00
|
|
|
#ifndef LIBRARYVIEW_H
|
|
|
|
#define LIBRARYVIEW_H
|
|
|
|
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QTreeView>
|
|
|
|
|
|
|
|
class Library;
|
|
|
|
|
|
|
|
class LibraryItemDelegate : public QStyledItemDelegate {
|
|
|
|
public:
|
|
|
|
LibraryItemDelegate(QObject* parent);
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LibraryView : public QTreeView {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
LibraryView(QWidget* parent = 0);
|
|
|
|
|
|
|
|
void SetLibrary(Library* library);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void TotalSongCountUpdated(int count);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void ShowConfigDialog();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// QAbstractItemView
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
// QWidget
|
|
|
|
void paintEvent(QPaintEvent* event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent* e);
|
|
|
|
|
2010-01-17 22:22:56 +01:00
|
|
|
private slots:
|
|
|
|
void ItemExpanded(const QModelIndex& index);
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
private:
|
|
|
|
void RecheckIsEmpty();
|
|
|
|
bool RecursivelyExpand(const QModelIndex& index, int* count);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kRowsToShow;
|
|
|
|
|
|
|
|
Library* library_;
|
|
|
|
int total_song_count_;
|
|
|
|
|
|
|
|
QPixmap nomusic_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LIBRARYVIEW_H
|