-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
186 lines (147 loc) · 4.71 KB
/
mainwindow.h
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
#include <QIcon>
#include <QLabel>
#include <QSlider>
#include <QtMultimedia/QMediaPlayer>
#include <QMediaPlaylist>
#include <QFileDialog>
#include <QStringList>
#include <QList>
#include <QProgressBar>
#include <QCheckBox>
#include <QListWidget>
#include <QTabWidget>
#include <QKeyEvent>
#include <QCheckBox>
#include <QWidget>
#include <QVBoxLayout>
#include <QVector>
class QAction;
class QActionGroup;
class QLabel;
class QMenu;
class QMediaPlayer;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void contextMenuEvent(QContextMenuEvent *event);
void keyPressEvent(QKeyEvent *);
private slots:
/***********BUTTON SLOTS***********/
void _playButtonIsPressed ();
void _nextButtonIsPressed ();
void _prevButtonIsPressed ();
void _newPlaylistTabButtonIsPressed();
/***********VOLUME SLIDER SLOT***********/
void _volumeSliderValueChanged();
/**************MENU OPTION SLOTS****************/
void open();
void addMedia();
void about();
void aboutQt();
void aboutAuthors();
bool savePlaylist();
bool loadPlaylist();
/*************Media Player Slots************/
void playbackPositionChanged(qint64 position);
void durationHasChanged(qint64 duration);
/*************SHUFFLE BUTTON SLOT*********/
void _shuffleButtonHasBeenPressed();
/**************PLAYLIST VIEW SLOT**********/
void playlistItemHasBeenClicked(QListWidgetItem *);
void resetPlaylistViewFunctionality(QListWidgetItem* item = 0);
/**************LOOP CHECKBOX SLOT**********/
void _loopCheckboxStateHasChanged(int);
/*************PLAYLIST TABS SLOTS*************/
void _tabCloseRequested(int);
void _currentTabIndexHasChanged(int);
private:
Ui::MainWindow *_ui;
QIcon _mainWindowIcon;
QWidget * _centralWidget;
QVBoxLayout * _mainLayout;
bool _isPlaying;
bool _isShuffled;
/************Prev Button Objects*************/
QPushButton *_prevButton;
QIcon _prevButtonIcon;
/************Play Button Objects*************/
QPushButton *_playButton;
QIcon _playButtonPlayIcon, _playButtonPauseIcon;
/************Next Button Objects*************/
QPushButton *_nextButton;
QIcon _nextButtonIcon;
/**************Menu Objects and Functions***/
void createActions();
void createMenus();
QMenu *_fileMenu;
QMenu *_playMenu;
QMenu *_playlistMenu;
QMenu *_helpMenu;
QAction *_openAct;
QAction *_addMediaAct;
QAction *_playAct;
QAction *_nextSongAct;
QAction *_previousSongAct;
QAction *_exitAct;
QAction *_savePlaylistAct;
QAction *_loadPlaylistAct;
QAction *_aboutAct;
QAction *_aboutQtAct;
QAction *_aboutAuthorsAct;
QLabel *_infoLabel;
QIcon _helpIcon, _infoIcon, _openIcon, _exitIcon, _qtIcon;
/************Volume Slider*******************/
QLabel *_volumeLabel;
QSlider *_volumeSlider;
/************File Name Display**************/
QLabel * _fileMetadata;
/***********Media Player*********************/
QVector<QMediaPlayer *> * _players;
QMediaPlayer * _currentPlayer;
/***********Get Audio File Types*********/
const QString * getAudioFileTypes();
/*************Open file dialogue*************/
QStringList _openFileDialog(const QString *, const QString *);
/**************Progress Bar*****************/
QProgressBar * _progressBar;
/**************Shuffle Button**************/
QPushButton *_shuffleButton;
/**************Playlist View***************/
QVector<QListWidget *> * _playlistViews;
QListWidget * _currentPlaylistView;
void setupPlaylistViewConnections(const QListWidget *);
const QString getAudioInfo(const int &) const;
void refreshPlaylistView();
/**************Playlist tabs***************/
QTabWidget * _playlistTabs;
QPushButton * _newPlaylistTabButton;
/**************Loop Checkbox***************/
QCheckBox * _loopCheckbox;
/*************Setup Functions***************/
void setupButtons();
void setupProgressBar();
void setupMetadataLabel();
void setupMenus();
void setupPlaylistTabs();
void setupOptionDash();
void setup();
/*************SQLite Functions**************/
bool savePlaylist(const int &);
bool writePlaylist(const QFile *, const int &);
const QStringList * readPlaylist(const QFile *);
bool loadPlaylist(const int &);
/********ADD ALL MUSIC TO PLAYLIST*********/
QStringList * getAllMusicFiles(const QString& searchDirectory);
};
#endif // MAINWINDOW_H