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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#ifndef PLAYERWIDGET_H
#define PLAYERWIDGET_H
#include <QWidget>
#include <QMediaPlayer>
#include <QSystemTrayIcon>
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);
~PlayerWidget();
const QMediaPlayer* player() const { return mPlayer; }
public slots:
void doPopulateByArtist();
void doPopulateByAlbum();
void doPopulateByGenre();
void doPopulateBySong();
void doPopulateByFolder(QString dir = QString());
void doModelChanged();
void viewDoubleClicked(const QModelIndex &idx);
void doPlay();
void doStop();
void doPause();
void doPlayOrPause();
void doSelectFiles();
void doDeselect();
void doDeleteFiles();
void volumeUp();
void volumeDown();
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 slide(int value);
void continuePlaying(QMediaPlayer::MediaStatus state);
void expand();
void readSettings();
void writeSettings();
void aboutDlg();
signals:
void viewModeChanged(const QString &viewMode);
void playModeChanged(const QString &playMode);
void numFilesChanged(int numFiles);
void playListLengthChanged(quint64 secs);
void message(const QString &msg);
void modelChanged();
void setWinTitle(const QString &title);
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);
void adjustVolume(int by);
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;
QAction *mSearchA;
QAction *mViewByArtistA;
QAction *mSelectFilesA;
QAction *mDeselectAllA;
QAction *mDeleteFilesA;
qint64 mDurSecs;
quint64 mPlayListLength;
QString mCurDir;
QString mCurWinTitle;
QSystemTrayIcon *mTrayIcon;
};
#endif // PLAYERWIDGET_H
|