Un inicio
This commit is contained in:
87
ui/FadingFeedback.qml
Normal file
87
ui/FadingFeedback.qml
Normal file
@@ -0,0 +1,87 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
|
||||
width: 100
|
||||
height: width
|
||||
|
||||
opacity: 0
|
||||
|
||||
function trigger() {
|
||||
hideTimer.stop();
|
||||
root.state = "hidden";
|
||||
root.state = "visible";
|
||||
hideTimer.start();
|
||||
}
|
||||
|
||||
function get_opacity() {
|
||||
return root.opacity
|
||||
}
|
||||
|
||||
function hide() {
|
||||
root.opacity = 0;
|
||||
root.state = "hidden";
|
||||
}
|
||||
|
||||
// IconImage {
|
||||
// id: innerIcon
|
||||
// anchors.fill: parent
|
||||
// source: videoPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/App/ui/icons/play.svg" : "qrc:/App/ui/icons/pause.svg"
|
||||
// color: "white"
|
||||
// fillMode: Image.PreserveAspectFit
|
||||
//
|
||||
// layer.enabled: true
|
||||
// layer.effect: MultiEffect {
|
||||
// shadowEnabled: true
|
||||
// shadowColor: "black"
|
||||
// shadowBlur: 0.5
|
||||
// }
|
||||
// }
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "visible"
|
||||
PropertyChanges {
|
||||
root.opacity: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hidden"
|
||||
PropertyChanges {
|
||||
root.opacity: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "hidden"
|
||||
to: "visible"
|
||||
NumberAnimation {
|
||||
properties: "opacity"
|
||||
duration: 150
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "visible"
|
||||
to: "hidden"
|
||||
NumberAnimation {
|
||||
properties: "opacity"
|
||||
duration: 400
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
}
|
||||
]
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 800
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
root.state = "hidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
1
ui/icons/pause.svg
Normal file
1
ui/icons/pause.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M176 96C149.5 96 128 117.5 128 144L128 496C128 522.5 149.5 544 176 544L240 544C266.5 544 288 522.5 288 496L288 144C288 117.5 266.5 96 240 96L176 96zM400 96C373.5 96 352 117.5 352 144L352 496C352 522.5 373.5 544 400 544L464 544C490.5 544 512 522.5 512 496L512 144C512 117.5 490.5 96 464 96L400 96z"/></svg>
|
||||
|
After Width: | Height: | Size: 527 B |
1
ui/icons/play.svg
Normal file
1
ui/icons/play.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M187.2 100.9C174.8 94.1 159.8 94.4 147.6 101.6C135.4 108.8 128 121.9 128 136L128 504C128 518.1 135.5 531.2 147.6 538.4C159.7 545.6 174.8 545.9 187.2 539.1L523.2 355.1C536 348.1 544 334.6 544 320C544 305.4 536 291.9 523.2 284.9L187.2 100.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 470 B |
156
ui/main.qml
Normal file
156
ui/main.qml
Normal file
@@ -0,0 +1,156 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls.impl
|
||||
import QtMultimedia
|
||||
import QtQuick.Effects
|
||||
|
||||
Window {
|
||||
id: window
|
||||
width: 800
|
||||
height: 600
|
||||
visible: true
|
||||
title: "YouAlbumTube"
|
||||
color: "#1e1e2e"
|
||||
|
||||
function togglePause() {
|
||||
videoPlayer.playbackState == MediaPlayer.PlayingState ? videoPlayer.pause() : videoPlayer.play();
|
||||
|
||||
seekFeedback.hide();
|
||||
playFeedback.trigger();
|
||||
}
|
||||
|
||||
property int times: 0
|
||||
property int dir: 0
|
||||
|
||||
function seek(time) {
|
||||
let opacity = seekFeedback.get_opacity();
|
||||
|
||||
if (opacity <= 0) {
|
||||
window.times = 0;
|
||||
}
|
||||
|
||||
window.times++;
|
||||
|
||||
if (time > 0) {
|
||||
if (dir < 0) {
|
||||
window.times = 1;
|
||||
}
|
||||
dir = 1;
|
||||
|
||||
videoPlayer.position = Math.min(videoPlayer.duration, videoPlayer.position + time);
|
||||
innerText.text = "+" + (5 * window.times);
|
||||
} else if (time <= 0) {
|
||||
if (dir > 0) {
|
||||
window.times = 1;
|
||||
}
|
||||
dir = -1;
|
||||
|
||||
videoPlayer.position = Math.max(0, videoPlayer.position + time);
|
||||
innerText.text = "-" + (5 * window.times);
|
||||
}
|
||||
|
||||
playFeedback.hide();
|
||||
seekFeedback.trigger();
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "Space"
|
||||
onActivated: window.togglePause()
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "Left"
|
||||
onActivated: window.seek(-5000)
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "Right"
|
||||
onActivated: window.seek(5000)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: window.togglePause()
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "No content\nAdd it to playlist!"
|
||||
font.pixelSize: 32
|
||||
font.bold: true
|
||||
color: "#cdd6f4"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
// Estudiar el doble buffer, parece ser no tan coñazo como podria esperar
|
||||
// mañana lo intento implementar
|
||||
Video {
|
||||
id: videoPlayer
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
source: playlist.currentVideoSource
|
||||
visible: true
|
||||
loops: 0
|
||||
playbackRate: 1
|
||||
|
||||
onSourceChanged: {
|
||||
console.log("Now playing:", source);
|
||||
if (source.toString() !== "") {
|
||||
videoPlayer.play();
|
||||
}
|
||||
}
|
||||
|
||||
onStopped: {
|
||||
playlist.loadNextVideo();
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
console.log("Cambio la visibilidad");
|
||||
}
|
||||
}
|
||||
|
||||
FadingFeedback {
|
||||
id: playFeedback
|
||||
|
||||
IconImage {
|
||||
id: innerIcon
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
source: videoPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/App/ui/icons/play.svg" : "qrc:/App/ui/icons/pause.svg"
|
||||
color: "white"
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: true
|
||||
shadowColor: "black"
|
||||
shadowBlur: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FadingFeedback {
|
||||
id: seekFeedback
|
||||
|
||||
Text {
|
||||
id: innerText
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
text: ""
|
||||
color: "white"
|
||||
// fontSizeMode: Text.Fit
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: 72
|
||||
font.bold: true
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: true
|
||||
shadowColor: "black"
|
||||
shadowBlur: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
ui/media/Puta.mp4
Normal file
BIN
ui/media/Puta.mp4
Normal file
Binary file not shown.
BIN
ui/media/video.mp4
Normal file
BIN
ui/media/video.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user