Skip to content
Extraits de code Groupes Projets
Vérifiée Valider b51fccdb rédigé par salixor's avatar salixor
Parcourir les fichiers

Make it possible to switch to fullscreen with F or double click (mpv default)

parent 63396a27
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!203Make it possible to switch to fullscreen with F or double click (mpv default)
Pipeline #4131 réussi
......@@ -113,6 +113,17 @@ MpvWidget::paintGL()
mpv_render_context_render(mpv_gl, params);
}
void
MpvWidget::toggle_fullscreen()
{
if (window()->isFullScreen()) {
was_maximized ? window()->showMaximized() : window()->showNormal();
} else {
was_maximized = window()->isMaximized();
window()->showFullScreen();
}
}
void
MpvWidget::on_mpv_events()
{
......@@ -396,12 +407,18 @@ MpvWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_J: MPV_SEND_COMMAND_ASYNC("osd-msg", "cycle", "sub", "down", nullptr);
case Qt::Key_Underscore: MPV_SEND_COMMAND_ASYNC("osd-msg", "cycle", "video", nullptr);
/* Window management */
case Qt::Key_F:
toggle_fullscreen();
break;
/* Misc */
case Qt::Key_I: MPV_SEND_COMMAND_ASYNC("script-binding", "stats/display-stats", nullptr);
case Qt::Key_Delete:
MPV_SEND_COMMAND_ASYNC("script-message", "osc-visibility",
(m_oscVisible = !m_oscVisible) ? "always" : "never", nullptr);
case Qt::Key_Z: MPV_SEND_COMMAND_ASYNC("osd-msg", "add", "sub-delay", "-0.1", nullptr);
case Qt::Key_X: MPV_SEND_COMMAND_ASYNC("osd-msg", "add", "sub-delay", "+0.1", nullptr);
case Qt::Key_M: MPV_SEND_COMMAND_ASYNC("osd-msg", "cycle", "mute", nullptr);
default: break;
......@@ -409,3 +426,12 @@ MpvWidget::keyPressEvent(QKeyEvent *event)
return QOpenGLWidget::keyPressEvent(event);
}
}
void
MpvWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
toggle_fullscreen();
}
}
......@@ -33,6 +33,7 @@ public:
private:
enum { PLAY, PAUSE, STOP, NONSTOPPED } m_state = STOP;
bool was_maximized = false;
queue *m_queue;
lkt_db *m_db;
......@@ -46,6 +47,7 @@ private:
protected:
void keyPressEvent(QKeyEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
public:
bool get_elapsed(int *);
......@@ -55,6 +57,7 @@ public:
bool set_position(int);
bool load_file(const char *);
bool toggle_pause();
void toggle_fullscreen();
bool stop();
private:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter