-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplaycontrols.h
121 lines (100 loc) · 3.31 KB
/
playcontrols.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
/*
* Copyright (C) 2013-2015 Atmel Corporation.
*
* This file is licensed under the terms of the Atmel LIMITED License Agreement
* as written in the COPYING file that is delivered in the project root directory.
*
* DISCLAIMER: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
* See the COPYING license file for more details.
*/
#ifndef PLAYCONTROLS_H
#define PLAYCONTROLS_H
#include <QWidget>
// Button images
#define PLAY_IMG ":/playcontrols/images/Play.png"
#define PAUSE_IMG ":/playcontrols/images/Pause.png"
#define MUTE_IMG ":/playcontrols/images/speaker.png"
#define UNMUTE_IMG ":/playcontrols/images/speaker_mute.png"
/**
* @file playcontrols.h
* @brief Video player play controls implementation
*/
namespace Ui {
class PlayControls;
}
class PlayControls : public QWidget
{
Q_OBJECT
public:
PlayControls(QWidget *parent, bool small_screen);
~PlayControls();
/**
* @brief setCPUusage Sets the value in the CPU usage progress bar
* @param usage Percentage of CPU utilization
*/
void setCPUusage(int usage);
/**
* @brief allowSeek Allow the controls to emit a positionChanged signal when the slider is moved
* @param allow true = allow seeking, fasle = don´t allow seeking (default true)
*/
void allowSeek(bool allow);
/**
* @brief enableVolumeControl Enable/Disable the volume controls
* @param enable True = volume controls enabled, false = volume controls disabled (default state enabled)
*/
void enableVolumeControl(bool enable);
/**
* @brief getCurrentVolume
* @return the current volume configured on the volume slider
*/
int getCurrentVolume();
/**
* @brief getCurrentMute
* @return the current mute state
*/
bool getCurrentMute();
signals:
void play(bool mute,int volume);
void pause();
void setMute(bool mute);
void setVolume(int volume);
void positionChanged(int position);
void setFullScreen();
void showOptions();
private slots:
void on_PlayPause_clicked();
void on_muteButton_clicked();
/**
* @brief durationChanged UPdates the Media progress status bar maximum value and media duration label
* @param duration Media duration
*/
void durationChanged(qint64 duration);
/**
* @brief positionChanged Updates the Media progress status bar current position and Media position label
* @param position Current meda position (position < = duration)
*/
void positionChanged(qint64 position);
void on_fullScreenButtonn_clicked();
public slots:
/**
* @brief set the controls to the current play state
*
* @param state true = onPlay, false = onPause
*/
void setPlayState(int state);
private:
Ui::PlayControls *ui;
// internal funcions
void updatePositionLabel(int position);
QString secondsToString(int seconds);
void setPlayIcon(bool state);
// Internal variables
bool _onPlay; // Video is playing
bool _onMute; // Video is paused
int _totalDuration; // Video total duration
QString _duration; // Video total duration (hh:mm:ss formated)
int _currentPosition; // Current position of the stream
bool _allowSeek; // Allow seek
bool _smallScreen;
};
#endif // PLAYCONTROLS_H