Sélectionner une révision Git
mpvwidget.hh 1,31 Kio
#pragma once
#include <QtWidgets/QOpenGLWidget>
#include <mpv/client.h>
#include <mpv/render_gl.h>
#include <QtGui>
#include <lektor/common.h>
class MpvWidget Q_DECL_FINAL : public QOpenGLWidget {
Q_OBJECT
public:
MpvWidget(struct queue *queue, lkt_db *db, struct module_reg *reg, QWidget *parent);
virtual ~MpvWidget() override;
void command(const QVariant ¶ms);
void setProperty(const QString &name, const QVariant &value);
QVariant getProperty(const QString &name) const;
QSize sizeHint() const { return QSize(480, 270); }
protected:
void initializeGL() Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
private Q_SLOTS:
void on_mpv_events();
void maybeUpdate();
public:
void handle_mpv_event(mpv_event *event);
static void on_update(void *ctx);
mpv_handle *mpv;
mpv_render_context *mpv_gl;
private:
struct queue *m_queue;
lkt_db *m_db;
struct module_reg *m_reg;
int m_position;
int m_duration;
protected:
void keyPressEvent(QKeyEvent* event);
public:
bool get_elapsed(int *);
bool get_duration(int *);
bool set_paussed(int);
bool set_volume(int);
bool set_position(int);
bool load_file(const char *);
bool toggle_pause();
private:
void update_window_title();
signals:
void titleChanged(QString str);
};