Debian Codegraph @

utils/fgqcanvas/qml/SnapshotsPanel.qml

raw
1 import QtQuick 2.0
2 import FlightGear 1.0 as FG
3
4 Item {
5 id: root
6 signal requestPanelClose();
7
8 Rectangle {
9 id: savePanel
10 width: parent.width - 8
11
12 anchors.top: parent.top
13 anchors.topMargin: 8
14 anchors.bottom: parent.bottom
15 anchors.bottomMargin: 8
16
17 anchors.horizontalCenter: parent.horizontalCenter
18
19 border.color: "#9f9f9f"
20 border.width: 1
21 color: "#5f5f5f"
22 opacity: 0.8
23 layer.enabled: true
24
25 InputLine {
26 id: saveTitleInput
27 width: parent.width
28 label: "Title"
29 anchors {
30 top: parent.top
31 topMargin: 8
32 left: parent.left
33 leftMargin: 8
34 right: saveButton.left
35 rightMargin: 8
36 }
37
38 }
39
40 Button {
41 id: saveButton
42 label: "Save"
43 enabled: (saveTitleInput.text != "")
44 anchors.right: parent.right
45 anchors.rightMargin: 8
46 anchors.top: parent.top
47 anchors.topMargin: 8
48
49 onClicked: {
50 _application.saveSnapshot(saveTitleInput.text);
51 }
52 }
53
54
55 ListView {
56 id: savedList
57 model: _application.snapshots
58 width: parent.width - 30
59 anchors.top: saveTitleInput.bottom
60 anchors.topMargin: 8
61 anchors.bottom: parent.bottom
62 anchors.bottomMargin: 8
63 anchors.horizontalCenter: parent.horizontalCenter
64
65 delegate: Item {
66 width: parent.width
67 height:delegateFrame.height + 8
68
69 Rectangle {
70 id: delegateBackFrame
71 color: "#1f1f1f"
72 width: delegateFrame.width
73 height: delegateFrame.height
74
75
76 Button {
77 id: deleteButton
78 anchors.verticalCenter: parent.verticalCenter
79 anchors.right: parent.right
80 anchors.rightMargin: 8
81 label: "Delete"
82 onClicked: {
83 // _application.deleteConfig(model.index)
84 // _application.deleteConfig
85 }
86 }
87 }
88
89 Rectangle {
90 id: delegateFrame
91 width: parent.width
92
93 height: configLabel.implicitHeight + 20
94
95 opacity: 1.0
96 color: "#3f3f3f"
97
98 Text {
99 id: configLabel
100 text: modelData['name']
101 color: "white"
102 anchors.verticalCenter: parent.verticalCenter
103 anchors.left: parent.left
104 anchors.leftMargin: 8
105 }
106
107 MouseArea {
108 anchors.fill: parent
109 onClicked: {
110 _application.restoreSnapshot(model.index);
111 root.requestPanelClose();
112 }
113
114 drag.target: delegateFrame
115 drag.axis: Drag.XAxis
116 drag.minimumX: -delegateFrame.width
117 drag.maximumX: 0
118 }
119
120
121 } // of visible rect
122 } // of delegate item
123
124 }
125 } // of frame rect
126 }