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

MPV: The entire MPV view should go fullscreen now, need to be tested on a more...

MPV: The entire MPV view should go fullscreen now, need to be tested on a more conventional DE than i3
parent 7672d0cf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Ce commit fait partie de la requête de fusion !20. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
......@@ -309,17 +309,3 @@ MpvContainer::seekInFile(const chrono::seconds time) noexcept
QByteArray seconds = QString::number(time.count()).toUtf8();
asyncCommand(AsyncCmdType::SeekTime, { "seek", seconds.data(), "absolute", nullptr });
}
void
MpvContainer::toggleFullScreenState() noexcept
{
if (isFullScreen()) {
setWindowState(Qt::WindowMaximized);
showFullScreen();
qDebug() << "Toggle fullscreen: set to normal";
} else {
setWindowState(Qt::WindowFullScreen);
showNormal();
qDebug() << "Toggle fullscreen: set to fullscreen";
}
}
......@@ -52,8 +52,6 @@ public:
void registerMpvTimeCallback(std::function<void(double)>) noexcept;
void registerMpvDurationCallback(std::function<void(double)>) noexcept;
void toggleFullScreenState() noexcept;
private:
void handleMpvEvent(mpv_event *) noexcept;
void closeMpv() noexcept;
......
......@@ -59,8 +59,8 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep
mpv->seekInFile(timePosition);
});
connect(toggleFullScreenButton, &QAbstractButton::clicked, mpv,
&MpvContainer::toggleFullScreenState);
connect(toggleFullScreenButton, &QAbstractButton::clicked, this,
[this]() { emit requestToggleFullScreen(); });
connect(togglePlaybackButton, &QAbstractButton::clicked, mpv, &MpvContainer::mpvTogglePlayback);
connect(mpv, &MpvContainer::mpvPlaybackToggled, this,
[this, togglePlaybackButton](bool isPlay) noexcept -> void {
......
......@@ -27,5 +27,8 @@ private:
public:
explicit MpvControls(MpvContainer *mpv, QWidget *parent) noexcept;
signals:
void requestToggleFullScreen();
};
}
......@@ -11,10 +11,13 @@ VideoView::VideoView(QWidget *parent) noexcept
, mpv(new MpvContainer(this))
{
auto *centralLayout = new QVBoxLayout(this);
auto *mpvControls = new MpvControls(mpv, this);
centralLayout->addWidget(mpv, 1);
centralLayout->addWidget(new MpvControls(mpv, this));
centralLayout->addWidget(mpvControls);
connect(mpvControls, &MpvControls::requestToggleFullScreen, this,
&VideoView::toggleFullScreenState);
setLayout(centralLayout);
}
......@@ -29,3 +32,17 @@ VideoView::forceStopPlayback() noexcept
{
mpv->mpvPause();
}
void
VideoView::toggleFullScreenState() noexcept
{
if (isFullScreen()) {
setWindowState(Qt::WindowMaximized);
showFullScreen();
qDebug() << "Toggle fullscreen: set to normal";
} else {
setWindowState(Qt::WindowFullScreen);
showNormal();
qDebug() << "Toggle fullscreen: set to fullscreen";
}
}
......@@ -22,5 +22,6 @@ public:
public slots:
void loadFile(const QString &) noexcept;
void forceStopPlayback() noexcept;
void toggleFullScreenState() noexcept;
};
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter