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

MPV: Re create the MPV context at first toggle request if not already initialized

parent bf5ab9de
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!26MPV: Fix the MPV controls
Pipeline #2507 réussi
......@@ -297,6 +297,10 @@ MpvContainer::mpvPause() noexcept
void
MpvContainer::mpvTogglePlayback() noexcept
{
if (!isMpvAlreadyInitialized) {
reCreateMpvContext();
}
logDebug() << "MPV: Toggling the playback";
asyncCommand(AsyncCmdType::TogglePlayback, { "cycle", "pause", "up", nullptr });
}
......
......@@ -9,8 +9,6 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep
{
auto *progressBar = new QSlider(this);
auto *togglePlaybackButton = new QPushButton(playIcon, "", this); // Be default MPV is paused
auto *reCreateMpvButton = new QPushButton(
reCreateMpvIcon, "", this); // Recreate the MPV context if something went wrong
progressBar->setTracking(false);
progressBar->setOrientation(Qt::Horizontal);
......@@ -56,7 +54,6 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep
});
connect(togglePlaybackButton, &QAbstractButton::clicked, mpv, &MpvContainer::mpvTogglePlayback);
connect(reCreateMpvButton, &QAbstractButton::clicked, mpv, &MpvContainer::reCreateMpvContext);
connect(mpv, &MpvContainer::mpvPlaybackToggled, this,
[this, togglePlaybackButton](bool isPlay) noexcept -> void {
togglePlaybackButton->setIcon(isPlay ? pauseIcon : playIcon);
......@@ -64,7 +61,6 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep
auto *centralLayout = new QHBoxLayout(this);
centralLayout->addWidget(togglePlaybackButton);
centralLayout->addWidget(reCreateMpvButton);
centralLayout->addWidget(progressBar, 1);
setLayout(centralLayout);
}
......@@ -23,7 +23,6 @@ private:
const QIcon playIcon{ VIVY_ICON_PLAY };
const QIcon pauseIcon{ VIVY_ICON_PAUSE };
const QIcon reCreateMpvIcon{ VIVY_ICON_RUN };
public:
explicit MpvControls(MpvContainer *mpv, QWidget *parent) noexcept;
......
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