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

Merge branch 'fix-mpv' into 'master'

MPV: Fix the MPV controls

See merge request !26
parents 4d375e40 9316baa7
Branches
Aucune étiquette associée trouvée
1 requête de fusion!26MPV: Fix the MPV controls
Pipeline #2508 réussi
......@@ -19,3 +19,7 @@ build.clang/*
# Local configurations
.vim/*
.vscode/*
# CCLS styff
.ccls*/
.ccls
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.17)
# Alpho Vivy, CXX only
project(Vivy VERSION 0.1 LANGUAGES CXX)
......@@ -7,16 +7,16 @@ cmake_policy(SET CMP0009 NEW) # Do not follow symlinks with GLOB_RECURSE
# Don't forget for specific things
if(WIN32)
message("You are building on windows, pay attenion to the dependencies")
message(STATUS "You are building on windows, pay attenion to the dependencies")
endif()
if(MSVC OR MSYS OR MINGW)
message("You are building with a windows compiler")
message(STATUS "You are building with a windows compiler")
endif()
if(APPLE)
message("You are building on MacOS X")
message(STATUS "You are building on MacOS X")
endif()
if(UNIX AND NOT APPLE)
message("You are building on Linux, FreeBSD or any other toaster OS")
message(STATUS "You are building on Linux, FreeBSD or any other toaster OS")
endif()
# Pass -fPIC
......
......@@ -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.
Veuillez vous inscrire ou vous pour commenter