-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
executable file
·113 lines (104 loc) · 3.45 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls 1.4
import VLCQt 1.1
ApplicationWindow {
visible: true
id: window
width: 1700
height: 820
title: qsTr("qYT")
SplitView {
Keys.onRightPressed: videoPlayer.seekFwd()
Keys.onLeftPressed: videoPlayer.seekBck()
Keys.onUpPressed: videoPlayer.seekFwdFwd()
Keys.onDownPressed: videoPlayer.seekBckBck()
Keys.onSpacePressed: videoOut.togglePlay()
Keys.onPressed: {
if (event.key === Qt.Key_F)
videoOut.toggleFullscreen()
if(event.key === Qt.Key_Q)
window.close()
if(event.key === Qt.Key_Greater)
videoPlayer.next()
if(event.key === Qt.Key_Less)
videoPlayer.prev()
}
focus: true
anchors.fill: parent
orientation: Qt.Horizontal
SearchPage{
id: searchPage
Layout.fillWidth: false
Layout.fillHeight: true
Layout.preferredWidth: 600
Layout.minimumWidth: 600
}
Rectangle{
focus: true
Keys.onRightPressed: {
console.log("right, right?")
videoPlayer.seekFwd()
}
Keys.onLeftPressed: {
console.log("left")
videoPlayer.seekBck()
}
VlcVideoOutput{
function togglePlay() {
console.log("Play or Pause, player state ",
videoPlayer.player.state)
if(videoPlayer.player.state == 3)
videoPlayer.player.pause()
else if(videoPlayer.player.state == 6)
videoPlayer.playFirst()
else
videoPlayer.player.play()
}
function toggleFullscreen() {
if (window.visibility == 5) {
window.showNormal()
}
else {
window.showFullScreen()
searchPage.Layout.minimumWidth = 0
}
}
id: videoOut
anchors.fill: parent
source: videoPlayer.player
Keys.onRightPressed: {
console.log("right, right?")
videoPlayer.seekFwd()
}
Keys.onLeftPressed: {
console.log("left")
videoPlayer.seekBck()
}
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: {
console.log("Clicking stuff", mouse)
if(mouse.button == Qt.RightButton)
videoOut.togglePlay()
}
onDoubleClicked: {
videoOut.toggleFullscreen()
console.log("Double click, going fullscreen")
}
}
}
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 223
Layout.minimumHeight: 161
color: "black"
}
Playlist {
width: 600
}
}
}