#ifndef PLAYERWIDGET_H #define PLAYERWIDGET_H #include #include class QStandardItemModel; class QStandardItem; class QLineEdit; class QLabel; class QSlider; class QTextEdit; class QMediaPlayer; class QToolBar; class QAction; class BeetPlayerProxy; class BeetView; class PlayerWidget : public QWidget { Q_OBJECT public: enum ItemType { Artist, Album, Song, Genre }; enum PopulateType { FilterType, IdType, EmptyType }; 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 }; explicit PlayerWidget(QWidget *parent = 0); const QMediaPlayer* player() const { return mPlayer; } public slots: void doPopulateByArtist(); void doPopulateByAlbum(); void doPopulateByGenre(); void doPopulateBySong(); void doPopulateByFolder(QString dir = QString()); void viewDoubleClicked(const QModelIndex &idx); void doPlay(); void doStop(); void doPause(); void doFilter(); void clearFilter(); void reindex(); void addToPlayList(); void addToPlayListAndClear(); void removeFromPlayList(); void clearPlayList(); void shufflePlayList(); void randomPlay(); void playCurrent(const QModelIndex &index); void mute(bool triggered); void volumeChanged(int volume); void next(); void previous(); void setPosition(qint64 pos); void setDuration(qint64 dur); void slide(int value); void continuePlaying(QMediaPlayer::MediaStatus state); void expand(); signals: void viewModeChanged(const QString &viewMode); void playModeChanged(const QString &playMode); void numFilesChanged(int numFiles); void playListLengthChanged(quint64 secs); void message(const QString &msg); private: void setupGui(); void createActions(); void populateByArtist(QStandardItem *parent, const QString &filter); void populateByAlbum(QStandardItem *parent, const QVariant &filter, int type); void populateBySong(QStandardItem *parent, const QVariant &filter, int type); void populateByGenre(QStandardItem *parent, const QString &filter); void recurse(const QModelIndex &parent); void addSong(const QModelIndex &idx); void play(const QString &fullPath); void advance(int numSongs); void expandRecursive(const QModelIndex &idx); QLineEdit *mSearch; QMediaPlayer *mPlayer; BeetView *mView; QStandardItemModel *mViewModel; QStandardItemModel *mSearchModel; QStandardItemModel *mCurrentModel; QStandardItemModel *mFolderModel; QLabel *mNowPlayingL; QSlider *mSongSlider; QLabel *mPos; QSlider *mVolumeSlider; QLabel *mVolumePos; QTextEdit *mCurrentTE; BeetView *mPlayListView; QStandardItemModel *mPlayListModel; QToolBar *mToolBar; QAction *mPlayA; QAction *mStopA; QAction *mPauseA; qint64 mDurSecs; quint64 mPlayListLength; }; #endif // PLAYERWIDGET_H