aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/widgets/MultimediaWidget.h
blob: c579b2dd31cc7de0935d52da22ead0bd65aa1d62 (plain)
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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2015, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_FM_MULTIMEDIA_WIDGET_H
#define _LUMINA_FM_MULTIMEDIA_WIDGET_H

#include <QList>
#include <QWidget>
#include <QObject>
#include <QMediaObject>
#include <QMediaPlayer>
#include <QVideoWidget>

#include "../DirData.h"

namespace Ui{
	class MultimediaWidget;
};

class MultimediaWidget : public QWidget{
	Q_OBJECT
public:
	MultimediaWidget(QWidget *parent = 0);
	~MultimediaWidget();

public slots:
	void ClearPlaylist();
	void LoadMultimedia(QList<LFileInfo> list);
	void Cleanup(); //perform actions necessary when closing the player

	//Theme change functions
	void UpdateIcons();
	void UpdateText();

private:
	Ui::MultimediaWidget *ui;
	QMediaPlayer *mediaObj;
	QVideoWidget *videoDisplay;
	QString playerTTime; //total time - to prevent recalculation every tick

	QString msToText(qint64 ms);

private slots:
	//Media Object functions
	void playerStatusChanged(QMediaPlayer::MediaStatus stat);
	void playerStateChanged(QMediaPlayer::State newstate);
	void playerVideoAvailable(bool showVideo);
	void playerDurationChanged(qint64 dur);
	void playerTimeChanged(qint64 ctime);
	void playerError();
	void playerFinished();

	//The UI functions
	void on_tool_player_play_clicked();
	void on_combo_player_list_currentIndexChanged(int index);
	void on_tool_player_next_clicked();
	void on_tool_player_prev_clicked();
	void on_tool_player_pause_clicked();
	void on_tool_player_stop_clicked();

	//Slider controls
	void on_playerSlider_sliderPressed();
	void on_playerSlider_sliderReleased();
	void on_playerSlider_valueChanged(int val);


};
#endif
bgstack15