Debian Codegraph @

utils/fgqcanvas/qml/LoadSavePanel.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.save(saveTitleInput.text);
51 }
52 }
53
54
55 ListView {
56 id: savedList
57 model: _application.configs
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 clip: true
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 }
85 }
86
87 Button {
88 anchors.verticalCenter: parent.verticalCenter
89 anchors.right: deleteButton.left
90 anchors.rightMargin: 8
91 label: "Save"
92 onClicked: {
93 _application.saveConfigChanges(model.index)
94 }
95 }
96 }
97
98 Rectangle {
99 id: delegateFrame
100 width: parent.width
101 // anchors.horizontalCenter: parent.horizontalCenter
102
103 height: configLabel.implicitHeight + 20
104
105 opacity: 1.0
106 color: "#3f3f3f"
107
108 Text {
109 id: configLabel
110 text: modelData['name']
111 color: "white"
112 anchors.verticalCenter: parent.verticalCenter
113 anchors.left: parent.left
114 anchors.leftMargin: 8
115 }
116
117 MouseArea {
118 anchors.fill: parent
119 onClicked: {
120 _application.restoreConfig(model.index)
121 root.requestPanelClose();
122 }
123
124 drag.target: delegateFrame
125 drag.axis: Drag.XAxis
126 drag.minimumX: -delegateFrame.width
127 drag.maximumX: 0
128 }
129
130
131 } // of visible rect
132 } // of delegate item
133
134 }
135 } // of frame rect
136 }