-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettingsMenu.qml
209 lines (153 loc) · 6.2 KB
/
SettingsMenu.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
import QtQuick 2.15
import QtGraphicalEffects 1.12
import "Logger.js" as Logger
import "Components/Generic"
import "Components/Delegates"
import "Components/SubMenu"
import "Components/GamesMedia"
import "Components/Settings"
FocusScope {
Loader {
id: settingsDataLoader
sourceComponent: settingsDataComponent
onStatusChanged: {
if (status == Loader.Ready) {
// initiate settings menu loader
settingsMenuLoader.active = true
}
}
}
Component {
id: settingsDataComponent
SettingsOptionsModel {
// id: settingsData
}
}
property alias settingsData: settingsDataLoader.item
Loader {
id: settingsMenuLoader
sourceComponent: settingsMenuComponent
active: false
focus: true
width: parent.width
height: parent.height
}
Component {
id: settingsMenuComponent
Item {
id: settingsMenuRoot
focus: true
property alias collectionsMenuListView: collectionsMenuListView
property bool settingsOptionsActive: false
Keys.onPressed: {
if (event.key == Qt.Key_Left) {
event.accepted = true;
collectionsMenuListView.listView.decrementCurrentIndex();
return;
}
if (event.key == Qt.Key_Right) {
event.accepted = true;
collectionsMenuListView.listView.incrementCurrentIndex();
return;
}
if (api.keys.isAccept(event)) {
event.accepted = true;
if (settingsOptionsActive == false) {
settingsOptionsActive = true;
settingsOptions.forceActiveFocus();
}
else {
settingsOptionsActive = false;
settingsListView.forceActiveFocus();
}
return;
}
if (api.keys.isCancel(event)) {
event.accepted = true;
settingsListView.forceActiveFocus();
return;
}
}
SubMenu {
id: collectionsMenuListView
focus: false
width: parent.width * (themeSettings.subMenuWidth / 100)
height: parent.height * (themeSettings.subMenuHeight / 100)
columns: themeSettings.subMenuColumns
anchors.left: parent.left
anchors.leftMargin: parent.width * 0.06
model: settingsData.settingsListModel
}
ItemList {
id: settingsListView
focus: settingsMenuRoot.focus
rows: themeSettings.itemListRows
anchors.top: collectionsMenuListView.bottom
anchors.topMargin: parent.height * 0.02
anchors.left: parent.left
anchors.leftMargin: parent.width * 0.02
anchors.bottom: parent.bottom
width: parent.width * (themeSettings.itemListWidth / 100)
model: collectionsMenuListView.model.get(collectionsMenuListView.currentIndex).settings
delegate: settingsListDelegate.delegate
}
GamesListDelegate {
id: settingsListDelegate
rows: settingsListView.rows
textName: "name"
}
Item {
id: settingsInfo
property int rows: 4
anchors {
top: collectionsMenuListView.bottom
topMargin: parent.height * 0.02
left: settingsListView.right
leftMargin: parent.width * 0.02
bottom: settingsOptions.top
bottomMargin: parent.height * 0.02
right: parent.right
rightMargin: parent.width * 0.02
}
Text {
id: settingsInfoDescription
anchors.fill: parent
font.family: "HackRegular"
font.pixelSize: (parent.height / settingsInfo.rows) * 0.4
color: themeData.colorTheme[theme].primary
wrapMode: Text.WordWrap
text: {
return "Description: " +
settingsListView.model.get(settingsListView.currentIndex).description;
}
}
Text {
id: settingsInfoDefault
anchors.bottom: parent.bottom
font.family: "HackRegular"
font.pixelSize: (parent.height / settingsInfo.rows) * 0.3
color: themeData.colorTheme[theme].primary
text: {
Logger.info("SettingsMenu:settingsInfoDefault:" + settingsListView.model.get(settingsListView.currentIndex).default)
return "Default: " +
settingsListView.model.get(settingsListView.currentIndex).default;
}
onTextChanged: Logger.info("SettingsMenu:settingsInfoDefault:" + settingsListView.model.get(settingsListView.currentIndex).default)
}
}
SettingsOptions {
id: settingsOptions
focus: false
height: parent.height * 0.4
anchors {
left: settingsListView.right
leftMargin: parent.width * 0.05
bottom: parent.bottom
right: parent.right
rightMargin: parent.width * 0.05
}
model: settingsListView.model.get(settingsListView.currentIndex)
}
}
}
}