-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFullScreenView.qml
109 lines (96 loc) · 3.64 KB
/
FullScreenView.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
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtMultimedia 5.9
GridView {
id: fullScreenView
anchors.fill: parent
model: photoListModel
cellHeight: height
cellWidth: width
focus: visible
interactive: false
highlightMoveDuration: 0
Binding {
target: fullScreenView
property: "currentIndex"
value: stack.viewIndex
}
onCurrentIndexChanged: stack.viewIndex = currentIndex
delegate: Item {
id: wrapper
width: GridView.view.cellWidth
height: GridView.view.cellHeight
StackLayout {
id: layout
anchors.fill: parent
Image {
// This makes the image provider get a proper requestedSize
sourceSize.width: width
sourceSize.height: height
source: "image://thumbnails/" + thumbnail
fillMode: Image.PreserveAspectFit
}
Loader {
id: loader
active: wrapper.visible
sourceComponent: type == "photo" ? image : video
Component {
id: image
Image {
asynchronous: true
source: "file:///" + mappedfilename
autoTransform: true
fillMode: Image.PreserveAspectFit
onStatusChanged: if (status == Image.Ready) { layout.currentIndex = 1; }
MouseArea {
anchors.fill: parent
onDoubleClicked: stack.currentIndex = 0
}
}
}
Component {
id: video
StackLayout {
id: videostack
Image {
id: videoframe
source: "image://videoframes/" + thumbnail
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
onClicked: {
videostack.currentIndex = 1;
videoplayer.play();
}
}
}
Video {
id: videoplayer
source: "file:///" + mappedfilename
onStatusChanged: if (status == MediaPlayer.Loaded) { layout.currentIndex = 1; }
MouseArea {
anchors.fill: parent
onClicked: {
if (parent.playbackState != MediaPlayer.PlayingState)
parent.play();
else
parent.pause();
}
onDoubleClicked: {
parent.stop()
stack.currentIndex = 0
}
}
}
}
}
}
}
Keys.onEscapePressed: stack.currentIndex = 0
Keys.onUpPressed: GridView.view.moveCurrentIndexLeft()
Keys.onLeftPressed: GridView.view.moveCurrentIndexLeft()
Keys.onRightPressed: GridView.view.moveCurrentIndexRight()
Keys.onDownPressed: GridView.view.moveCurrentIndexRight()
}
}