-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
269 lines (256 loc) · 7.63 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
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
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import QtQuick 2.2
import QtQuick.Dialogs 1.0
ApplicationWindow {
id: appwindow
visible: true
visibility: "Maximized"
menuBar: MenuBar {
id: khipuMenuBar
background: Rectangle {
}
delegate: MenuBarItem {
id: menuBarItem
contentItem: Text {
text: menuBarItem.text
font: menuBarItem.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
implicitWidth: 40
implicitHeight: 40
opacity: enabled ? 1 : 0.3
}
}
Menu {
title: {
qsTr("File")
}
Action {
text: qsTr("&Open...")
onTriggered: fileDialog.visible = true
}
MenuSeparator {
}
Action {
text: qsTr("&Save")
onTriggered: saveDialogBar.visible = true //deveria estar abrindo um dialog
}
/*Action {
text: qsTr("&Save as...")
onTriggered: saveDialogBar.visible = true //deveria estar abrindo um dialog
}*/
MenuSeparator {
}
Action {
text: qsTr("&Quit")
onTriggered: close()
}
}
Menu {
title: qsTr("Settings")
Action {
text: qsTr("&Hide menubar")
onTriggered: {
khipuMenuBar.visible = false
menuBarAlert.visible = true
}
}
MenuSeparator {
}
Action {
text: qsTr("&Grid settings")
onTriggered: gridSettings.visible = true
}
}
Menu {
title: qsTr("Help")
Action {
text: qsTr("&Khipu Handbook")
}
Action {
text: qsTr("&What's this?")
}
MenuSeparator {
}
Action {
text: qsTr("&Report bug")
}
MenuSeparator {
}
Action {
text: qsTr("&Donate")
}
MenuSeparator {
}
/*Action {
text: qsTr("&Switch application language")
}
MenuSeparator {
}*/
Action {
text: qsTr("&About Khipu")
}
Action {
text: qsTr("&About KDE")
}
}
}
Keys.onPressed: {
if (event.key === Qt.Key_F1) {
console.log("entrou aqui")
khipuMenuBar.visible = true
}
}
Window{
id: menuBarAlert
visible: false
minimumHeight: 50
minimumWidth: 300
Text{ anchors.centerIn: parent; text: "press F1 to show Menu Bar again" }
}
FileDialog {
id: fileDialog
title: "Please choose a .json file"
onAccepted: {
//console.log("You chose: " + fileDialog.fileUrl)
proxyModel.sourceModel.load(fileUrl)
}
onRejected: {
console.log("Canceled")
fileDialog.close()
}
}
Khipu2DGridSettings {
id: gridSettings
visible: false
}
header: ToolBar {
height: 40
background: Rectangle {
}
RowLayout {
id: buttons
Button {
id: plotdict
text: qsTr(" Plot Examples")
contentItem: Text {
text: plotdict.text
font: plotdict.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
height: 40
}
onClicked: {
proxyModel.sourceModel.plotDict()
spaceList.currentIndex = proxyModel.sourceModel.rowCount() - 2
khipuMenu.visible = true
}
}
Button {
id: add2DSpace
text: qsTr("Add 2D Space")
contentItem: Text {
text: add2DSpace.text
font: add2DSpace.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
height: 40
}
onClicked: {
proxyModel.sourceModel.addSpace("2D Space","2D")
proxyModel.sourceModel.currentSpace = proxyModel.sourceModel.spaceAt(proxyModel.sourceModel.rowCount() - 1)
spaceList.currentIndex = proxyModel.sourceModel.rowCount() - 1
khipuMenu.visible = true
}
}
Button {
id: add3DSpace
text: qsTr("Add 3D Space")
contentItem: Text {
text: add3DSpace.text
font: add3DSpace.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
height: 40
}
onClicked: {
proxyModel.sourceModel.addSpace("3D Space","3D")
proxyModel.sourceModel.currentSpace = proxyModel.sourceModel.spaceAt(proxyModel.sourceModel.rowCount() - 1)
spaceList.currentIndex = proxyModel.sourceModel.rowCount() - 1
khipuMenu.visible = true
}
}
}
}
footer: TabBar {
Text {
// ...
}
}
ColumnLayout{
anchors.fill: parent
RowLayout {
id: saveDialogBar
visible: false
TextField{
id: saveInput
text: "Type file name here"
width: parent.width
onAccepted: {
proxyModel.sourceModel.save(text)
text = ""
saveDialogBar.visible = false
}
}
Button{
text: "Save"
onClicked: {
proxyModel.sourceModel.save(saveInput.text)
saveDialogBar.visible = false
}
}
Button{
text: "Cancel"
onClicked: saveDialogBar.visible = false
}
}
RowLayout {
Rectangle {
}
KhipuSpaceViewer {
id: spaceList
Layout.fillHeight: true
Layout.maximumWidth: 300
model: proxyModel
}
KhipuMenu {
id: khipuMenu
Layout.fillHeight: true
visible: false
}
KhipuScreen {
id: blackscreen
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
}