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

UI: Use play/pause icons for MPV controls

parent 11da8c29
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!15Video playback with mpv
......@@ -35,6 +35,9 @@
<file alias="folder.svg">icons/breeze-dark/folder.svg</file>
<file alias="text-x-generic.svg">icons/breeze-dark/text-x-generic.svg</file>
<file alias="help-about.svg">icons/breeze-dark/help-about.svg</file>
<file alias="media-pause.svg">icons/breeze-dark/media-playback-pause.svg</file>
<file alias="media-play.svg">icons/breeze-dark/media-playback-start.svg</file>
<file alias="media-stop.svg">icons/breeze-dark/media-playback-stop.svg</file>
</qresource>
<qresource prefix="icons/light">
<file alias="document-new.svg">icons/breeze-light/document-new.svg</file>
......@@ -44,6 +47,9 @@
<file alias="folder.svg">icons/breeze-light/folder.svg</file>
<file alias="text-x-generic.svg">icons/breeze-light/text-x-generic.svg</file>
<file alias="help-about.svg">icons/breeze-light/help-about.svg</file>
<file alias="media-pause.svg">icons/breeze-light/media-playback-pause.svg</file>
<file alias="media-play.svg">icons/breeze-light/media-playback-start.svg</file>
<file alias="media-stop.svg">icons/breeze-light/media-playback-stop.svg</file>
</qresource>
<!-- QDarkStyle style sheet, MIT Licence -->
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#eff0f1;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 8 0 0 -20 z m 12 0 0 20 8 0 0 -20 z"
id="path8"
class="ColorScheme-Text"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#eff0f1;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 20 -10 z"
id="path105"
class="ColorScheme-Text"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#eff0f1;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 20 0 0 -20 z"
id="path91"
class="ColorScheme-Text"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 8 0 0 -20 z m 12 0 0 20 8 0 0 -20 z"
id="path8"
class="ColorScheme-Text"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 20 -10 z"
id="path105"
class="ColorScheme-Text"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 6 6 0 20 20 0 0 -20 z"
id="path91"
class="ColorScheme-Text"
/>
</svg>
......@@ -44,11 +44,10 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep
connect(togglePlaybackButton, &QAbstractButton::clicked, mpv, &MpvContainer::mpvTogglePlayback);
connect(mpv, &MpvContainer::mpvPlaybackToggled, this,
[togglePlaybackButton](bool isPlay) noexcept -> void {
[this, togglePlaybackButton](bool isPlay) noexcept -> void {
qDebug() << "Got playback update to"
<< (isPlay ? QStringLiteral("Play") : QStringLiteral("Pause"));
togglePlaybackButton->setText(isPlay ? QStringLiteral("Pause")
: QStringLiteral("Play"));
togglePlaybackButton->setIcon(isPlay ? pauseIcon : playIcon);
});
auto *centralLayout = new QHBoxLayout(this);
......
......@@ -5,6 +5,8 @@
#endif
#include "../../Lib/Utils.hh"
#include "../../VivyApplication.hh"
#include <QIcon>
namespace Vivy
{
......@@ -20,6 +22,9 @@ private:
chrono::seconds timePosition;
int askedSliderPosition{ 0 };
const QIcon playIcon{ VIVY_ICON_PLAY };
const QIcon pauseIcon{ VIVY_ICON_PAUSE };
public:
explicit MpvControls(MpvContainer *mpv, QWidget *parent) noexcept;
};
......
......@@ -16,6 +16,9 @@
#define VIVY_ICON_ABOUT ":icons/dark/help-about.svg"
#define VIVY_ICON_FILE ":icons/dark/text-x-generic.svg"
#define VIVY_ICON_FOLDER ":icons/dark/folder.svg"
#define VIVY_ICON_PLAY ":icons/dark/media-play.svg"
#define VIVY_ICON_PAUSE ":icons/dark/media-pause.svg"
#define VIVY_ICON_STOP ":icons/dark/media-stop.svg"
#include <QApplication>
#include <QPixmap>
......
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