PlayerFlat
 Tudo Classes Funções
mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 //#include <climits>
5 #include <QAudioBuffer>
6 #include <QAudioDeviceInfo>
7 #include <QAudioInput>
8 #include <QAudioProbe>
9 #include <QDir>
10 #include <QFileDialog>
11 #include <QFileInfo>
12 #include <QHeaderView>
13 #include <QImage>
14 #include <QIODevice>
15 #include <QMainWindow>
16 #include <QMediaMetaData>
17 #include <QMediaPlaylist>
18 #include <QMessageBox>
19 #include <QMimeDatabase>
20 #include <QSettings>
21 #include <QStandardItemModel>
22 #include <QString>
23 #include <QtMultimedia>
24 #include <QtMultimedia/QMediaPlayer>
25 #include <QUrl>
26 #include <QVector>
27 
28 
29 #include "fftcalc.h"
30 #include "playlistmodel.h"
31 
32 namespace Ui {
33 class MainWindow;
34 }
35 
36 // the MainWindow class is used to manage with all stuff
37 // fft, audio probing, widget properties
38 
39 class MainWindow : public QMainWindow{
40  Q_OBJECT
41 
42 public:
43  explicit MainWindow(QWidget *parent = 0);
44  ~MainWindow();
45 
46 public slots:
47  //
48  // see description on mainwindow.h
49  //
50  void goToItem(const QModelIndex &index);
51  void loadMedia();
52  void loadPlaylist();
53  void onAddMediaToPlayList(QString media);
54  void mediaStatusChanged(QMediaPlayer::MediaStatus status);
55  void metaDataChanged();
56  void next();
57  void playPause();
58  void slotPositionChanged(qint64 e);
59  void prev();
60  void processBuffer(QAudioBuffer buffer);
61  void setMediaAt(qint32 percent);
62  void setVolume(int volume);
63  void spectrumAvailable(QVector<double> spectrum);
64  void metaDataAvailableChanged(bool);
65 private:
66  // User interface widget
67  Ui::MainWindow *ui;
68 
69  // pointer to the media player object
70  QMediaPlayer *player;
71 
72  // stores the playlist
73  QMediaPlaylist *playlist;
74 
75  // audio info... we do not use it
76  QAudioDeviceInfo audioInfo;
77 
78  // a buffer to copy audio into it
79  QByteArray buffer;
80 
81  // the audio prober
82  QAudioProbe *probe;
83 
84  // a fft calculator object
85  FFTCalc *calculator;
86 
87  // item model to design the playlist into mainwindow
88  QStandardItemModel *model;
89 
90  // each item to be displayed in playlist
91  QStandardItem *item;
92 
93  // input sample to fft calc
94  QVector<double> sample;
95 
96  // output vector with spectrum
97  QVector<double> spectrum;
98 
99  PlaylistModel *playlistModel;
100 
101  // left and right mean levels
102  double levelLeft, levelRight;
103 signals:
104  // telle a new buffer from audio prober
105  int spectrumChanged(QVector<double> &sample);
106 
107  // music position changed by user. Tell
108  // new position to the player
109  int positionChanged(qint64 position);
110 
111  // tells the new left and right mean audio levels
112  int levels(double left, double right);
113 
114  // tells the duration of media
115  // when a new media is played
116  int elapsedTimeChanged(qint64 elapsed);
117 
118  // tells there are new directories to be added to the music library
119  int addFolderToLibrary(QString folder);
120 
121 protected slots:
122 };
123 
124 
125 #endif // MAINWINDOW_H
Definition: fftcalc.h:42
Definition: mainwindow.h:39
Definition: playlistmodel.h:19