forked from Tencent/libpag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.qml
More file actions
353 lines (343 loc) · 12.2 KB
/
Menu.qml
File metadata and controls
353 lines (343 loc) · 12.2 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
import QtQuick
import QtQuick.Controls
import Qt.labs.platform as Platform
import "components"
Item {
id: root
required property bool hasPAGFile
required property bool isUseEnglish
required property bool windowActive
required property bool isFullScreen
signal command(string command)
Loader {
id: windowsMenuLoader
active: Qt.platform.os === "windows"
sourceComponent: PAGMenuBar {
id: windowsMenuBar
property int menuWidth: root.isUseEnglish ? 300 : 200
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 36
PAGMenu {
menuWidth: windowsMenuBar.menuWidth
title: qsTr("File")
Action {
text: qsTr("Open...")
shortcut: "Ctrl+O"
onTriggered: {
root.command("open-pag-file");
}
}
Action {
text: qsTr("Close")
shortcut: "Ctrl+Q"
onTriggered: {
root.command("close-window");
}
}
Action {
text: qsTr("Settings...")
onTriggered: {
root.command("open-preferences");
}
}
PAGMenu {
menuWidth: windowsMenuBar.menuWidth
title: qsTr("Export")
Action {
text: qsTr("Export as PNG Sequence Frames")
enabled: root.hasPAGFile
onTriggered: {
root.command('export-as-png-sequence');
}
}
Action {
text: qsTr("Export as APNG")
enabled: root.hasPAGFile
onTriggered: {
root.command('export-as-apng');
}
}
Action {
text: qsTr("Export current frame as PNG")
enabled: root.hasPAGFile
shortcut: "Ctrl+P"
onTriggered: {
root.command('export-frame-as-png');
}
}
}
}
PAGMenu {
menuWidth: windowsMenuBar.menuWidth
title: qsTr("Play")
Action {
text: qsTr("Pause and go to the first frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToPreviousLine
onTriggered: {
root.command("first-frame");
}
}
Action {
text: qsTr("Pause and go to the last frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToNextLine
onTriggered: {
root.command("last-frame");
}
}
Action {
text: qsTr("Previous frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToPreviousChar
onTriggered: {
root.command("previous-frame");
}
}
Action {
text: qsTr("Next frame ")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToNextChar
onTriggered: {
root.command("next-frame");
}
}
Action {
text: qsTr("Pause/Play")
enabled: root.hasPAGFile
shortcut: "space"
onTriggered: {
root.command("pause-or-play");
}
}
}
PAGMenu {
menuWidth: windowsMenuBar.menuWidth
title: qsTr("View")
Action {
text: qsTr("Show/Hide Background")
enabled: root.hasPAGFile
shortcut: "B"
onTriggered: {
root.command("toggle-background");
}
}
Action {
text: qsTr("Show/Hide Edit Panel")
enabled: root.hasPAGFile
shortcut: "L"
onTriggered: {
root.command("toggle-edit-panel");
}
}
}
PAGMenu {
menuWidth: windowsMenuBar.menuWidth
title: qsTr("Help")
Action {
text: qsTr("Help for PAGViewer")
onTriggered: {
root.command("open-help");
}
}
Action {
text: qsTr("About PAGViewer")
onTriggered: {
root.command("open-about");
}
}
Action {
text: qsTr("Feedback")
onTriggered: {
root.command("open-feedback");
}
}
Action {
text: qsTr("About PAG Enterprise Edition")
onTriggered: {
root.command("open-commerce-page");
}
}
}
}
}
Loader {
id: macosMenuBarLoader
active: Qt.platform.os === "osx"
sourceComponent: Platform.MenuBar {
id: macosMenuBar
Platform.Menu {
title: qsTr("PAGViewer")
Platform.MenuItem {
visible: windowActive
text: qsTr("About PAG Enterprise Edition")
role: "ApplicationSpecificRole"
onTriggered: {
root.command("open-commerce-page");
}
}
Platform.MenuItem {
visible: windowActive
text: qsTr("Preference Settings")
role: "ApplicationSpecificRole"
onTriggered: {
root.command("open-preferences");
}
}
Platform.MenuItem {
visible: windowActive
text: qsTr("About PAGViewer")
role: "ApplicationSpecificRole"
onTriggered: {
root.command("open-about");
}
}
Platform.MenuItem {
text: qsTr("Close")
shortcut: StandardKey.Close
role: "QuitRole"
onTriggered: {
root.command("close-window");
}
}
}
Platform.Menu {
title: qsTr("File")
Platform.MenuItem {
text: qsTr("Open...")
shortcut: StandardKey.Open
onTriggered: {
root.command("open-pag-file");
}
}
Platform.Menu {
title: qsTr("Export")
Platform.MenuItem {
text: qsTr("Export as PNG Sequence Frames")
enabled: root.hasPAGFile
onTriggered: {
root.command('export-as-png-sequence');
}
}
Platform.MenuItem {
text: qsTr("Export as APNG")
enabled: root.hasPAGFile
onTriggered: {
root.command('export-as-apng');
}
}
Platform.MenuItem {
text: qsTr("Export current frame as PNG")
enabled: root.hasPAGFile
shortcut: "Meta+P"
onTriggered: {
root.command('export-frame-as-png');
}
}
}
}
Platform.Menu {
title: qsTr("Play")
Platform.MenuItem {
text: qsTr("Pause and go to the first frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToPreviousLine
onTriggered: {
root.command("first-frame");
}
}
Platform.MenuItem {
text: qsTr("Pause and go to the last frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToNextLine
onTriggered: {
root.command("last-frame");
}
}
Platform.MenuItem {
text: qsTr("Previous frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToPreviousChar
onTriggered: {
root.command("previous-frame");
}
}
Platform.MenuItem {
text: qsTr("Next frame")
enabled: root.hasPAGFile
shortcut: StandardKey.MoveToNextChar
onTriggered: {
root.command("next-frame");
}
}
Platform.MenuItem {
text: qsTr("Pause/Play")
enabled: root.hasPAGFile
shortcut: "space"
onTriggered: {
root.command("pause-or-play");
}
}
}
Platform.Menu {
title: qsTr("View")
Platform.MenuItem {
text: qsTr("Show/Hide Background")
enabled: root.hasPAGFile
shortcut: "B"
onTriggered: {
root.command("toggle-background");
}
}
Platform.MenuItem {
text: qsTr("Show/Hide Edit Panel")
enabled: root.hasPAGFile
shortcut: "L"
onTriggered: {
root.command("toggle-edit-panel");
}
}
}
Platform.Menu {
title: qsTr("Window")
Platform.MenuItem {
text: qsTr("Minimize")
shortcut: "Ctrl+M"
onTriggered: {
root.command("minimize-window");
}
}
Platform.MenuItem {
text: qsTr("Zoom")
onTriggered: {
root.command("zoom-window");
}
}
Platform.MenuItem {
text: root.isFullScreen ? qsTr("Exit Fullscreen") : qsTr("Fullscreen")
visible: root.isFullScreen
onTriggered: {
root.command("fullscreen-window");
}
}
}
Platform.Menu {
title: qsTr("Help")
Platform.MenuItem {
text: qsTr("Help for PAGViewer")
onTriggered: {
root.command("open-help");
}
}
Platform.MenuItem {
text: qsTr("Feedback")
onTriggered: {
root.command("open-feedback");
}
}
}
}
}
}