aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/mediaplayer.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-22 21:10:04 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-22 21:10:04 +0200
commit75ec461eeaa851cb5c53f4cfffc434e3e529ed1d (patch)
tree3944737340718ca3675381aa06636045d397e780 /src/widgets/mediaplayer.hpp
parent8dbfb0890560fd1cd698d06fa05ac868c4db8576 (diff)
downloadkristall-75ec461eeaa851cb5c53f4cfffc434e3e529ed1d.tar.gz
Restructures the project source and cleans up a bit
Diffstat (limited to 'src/widgets/mediaplayer.hpp')
-rw-r--r--src/widgets/mediaplayer.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/widgets/mediaplayer.hpp b/src/widgets/mediaplayer.hpp
new file mode 100644
index 0000000..c39a800
--- /dev/null
+++ b/src/widgets/mediaplayer.hpp
@@ -0,0 +1,42 @@
+#ifndef MEDIAPLAYER_HPP
+#define MEDIAPLAYER_HPP
+
+#include <QWidget>
+#include <QBuffer>
+#include <QVideoWidget>
+#include <QMediaPlayer>
+
+namespace Ui {
+class MediaPlayer;
+}
+
+class MediaPlayer : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MediaPlayer(QWidget *parent = nullptr);
+ ~MediaPlayer();
+
+ void setMedia(QByteArray const & data, QUrl const & ref_url, QString const & mime);
+
+ void stopPlaying();
+
+private slots:
+ void on_playpause_button_clicked();
+
+ void on_mute_button_clicked(bool checked);
+
+private: // slots
+ void on_media_positionChanged(qint64 pos);
+
+ void on_media_playbackChanged(QMediaPlayer::State);
+
+private:
+ Ui::MediaPlayer *ui;
+ QBuffer media_stream;
+ QString mime;
+ QMediaPlayer player;
+};
+
+#endif // MEDIAPLAYER_HPP