-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.qml
More file actions
85 lines (75 loc) · 2.04 KB
/
main.qml
File metadata and controls
85 lines (75 loc) · 2.04 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
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: fileDialog.open();
}
MenuItem {
text: qsTr("&Run")
onTriggered: {
paintingTimer.start();// <--- Celui là
chip8.startEmulation();
}
}
MenuItem {
text: qsTr("Exit")
onTriggered: {
chip8.stopEmulation();
paintingTimer.stop();
Qt.quit();
}
}
}
}
onClosing: {
chip8.stopEmulation();
paintingTimer.stop();
close.accepted = true;
}
MainForm {
id: mainForm;
anchors.fill: parent
function reload() {
var oldSource = chip8ScreenImage.source;
chip8ScreenImage.source = "";
chip8ScreenImage.source = oldSource;
}
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
}
FileDialog {
id: fileDialog
title: "Please choose a Chip8 file"
nameFilters: ["Chip Rom (*.ch8)"]
onAccepted: {
chip8.loadRom(fileDialog.fileUrl);
}
onRejected: {
console.log("Canceled")
}
}
Timer {
id: paintingTimer
interval: 16;
repeat: true;
running: false;
triggeredOnStart: true;
//onTriggered: chip8Screen.requestPaint()
onTriggered: mainForm.reload();
}
}