1 //===========================================
2 //  Lumina-DE source code
3 //  Copyright (c) 2015, Ken Moore
4 //  Available under the 3-clause BSD license
5 //  See the LICENSE file for full details
6 //===========================================
7 #ifndef _LUMINA_FM_MULTIMEDIA_WIDGET_H
8 #define _LUMINA_FM_MULTIMEDIA_WIDGET_H
9 
10 #include <QList>
11 #include <QWidget>
12 #include <QObject>
13 #include <QMediaObject>
14 #include <QMediaPlayer>
15 #include <QVideoWidget>
16 
17 #include "../DirData.h"
18 
19 namespace Ui{
20 	class MultimediaWidget;
21 };
22 
23 class MultimediaWidget : public QWidget{
24 	Q_OBJECT
25 public:
26 	MultimediaWidget(QWidget *parent = 0);
27 	~MultimediaWidget();
28 
29 public slots:
30 	void ClearPlaylist();
31 	void LoadMultimedia(QList<LFileInfo> list);
32 	void Cleanup(); //perform actions necessary when closing the player
33 
34 	//Theme change functions
35 	void UpdateIcons();
36 	void UpdateText();
37 
38 private:
39 	Ui::MultimediaWidget *ui;
40 	QMediaPlayer *mediaObj;
41 	QVideoWidget *videoDisplay;
42 	QString playerTTime; //total time - to prevent recalculation every tick
43 
44 	QString msToText(qint64 ms);
45 
46 private slots:
47 	//Media Object functions
48 	void playerStatusChanged(QMediaPlayer::MediaStatus stat);
49 	void playerStateChanged(QMediaPlayer::State newstate);
50 	void playerVideoAvailable(bool showVideo);
51 	void playerDurationChanged(qint64 dur);
52 	void playerTimeChanged(qint64 ctime);
53 	void playerError();
54 	void playerFinished();
55 
56 	//The UI functions
57 	void on_tool_player_play_clicked();
58 	void on_combo_player_list_currentIndexChanged(int index);
59 	void on_tool_player_next_clicked();
60 	void on_tool_player_prev_clicked();
61 	void on_tool_player_pause_clicked();
62 	void on_tool_player_stop_clicked();
63 
64 	//Slider controls
65 	void on_playerSlider_sliderPressed();
66 	void on_playerSlider_sliderReleased();
67 	void on_playerSlider_valueChanged(int val);
68 
69 
70 };
71 #endif