Changeset View
Changeset View
Standalone View
Standalone View
src/activities/target/Target.qml
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 42 | Keys.onPressed: { | |||
---|---|---|---|---|---|
45 | 45 | | |||
46 | if(event.key === Qt.Key_Backspace) { | 46 | if(event.key === Qt.Key_Backspace) { | ||
47 | backspace() | 47 | backspace() | ||
48 | } | 48 | } | ||
49 | appendText(event.text) | 49 | appendText(event.text) | ||
50 | } | 50 | } | ||
51 | 51 | | |||
52 | Component.onCompleted: { | 52 | Component.onCompleted: { | ||
53 | dialogActivityConfig.initialize() | ||||
53 | activity.start.connect(start) | 54 | activity.start.connect(start) | ||
54 | activity.stop.connect(stop) | 55 | activity.stop.connect(stop) | ||
55 | } | 56 | } | ||
56 | 57 | | |||
57 | // Add here the QML items you need to access in javascript | 58 | // Add here the QML items you need to access in javascript | ||
58 | QtObject { | 59 | QtObject { | ||
59 | id: items | 60 | id: items | ||
60 | property Item main: activity.main | 61 | property Item main: activity.main | ||
61 | property alias background: background | 62 | property alias background: background | ||
62 | property alias bar: bar | 63 | property alias bar: bar | ||
63 | property alias bonus: bonus | 64 | property alias bonus: bonus | ||
64 | property alias targetModel: targetItem.model | 65 | property alias targetModel: targetItem.model | ||
66 | property var levels: activity.datasetLoader.item.data | ||||
65 | property alias targetItem: targetItem | 67 | property alias targetItem: targetItem | ||
66 | property alias userEntry: userEntry | 68 | property alias userEntry: userEntry | ||
67 | property int currentArrow | 69 | property int currentArrow | ||
68 | property int nbArrow | 70 | property int nbArrow | ||
69 | property int currentSubLevel | 71 | property int currentSubLevel | ||
70 | property int numberOfSubLevel | 72 | property int numberOfSubLevel | ||
71 | property bool arrowFlying | 73 | property bool arrowFlying | ||
72 | 74 | | |||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 149 | function appendText(text) { | |||
159 | } | 161 | } | ||
160 | 162 | | |||
161 | if(userEntry.text.length > ('' + targetItem.scoreTotal).length) { | 163 | if(userEntry.text.length > ('' + targetItem.scoreTotal).length) { | ||
162 | return | 164 | return | ||
163 | } | 165 | } | ||
164 | 166 | | |||
165 | userEntry.text += text | 167 | userEntry.text += text | ||
166 | 168 | | |||
167 | if(targetItem.scoreTotal === userEntry.text) | 169 | if(targetItem.scoreTotal.toString() === userEntry.text) | ||
168 | bonus.good("flower") | 170 | bonus.good("flower") | ||
169 | } | 171 | } | ||
170 | 172 | | |||
171 | GCText { | 173 | GCText { | ||
172 | id: userEntry | 174 | id: userEntry | ||
173 | anchors.top: scoreItem.bottom | 175 | anchors.top: scoreItem.bottom | ||
174 | width: parent.width | 176 | width: parent.width | ||
175 | fontSize: 22 | 177 | fontSize: 22 | ||
Show All 27 Lines | 194 | [ | |||
203 | { label: keyboard.backspace } | 205 | { label: keyboard.backspace } | ||
204 | ] ] | 206 | ] ] | ||
205 | } | 207 | } | ||
206 | onKeypress: background.appendText(text) | 208 | onKeypress: background.appendText(text) | ||
207 | 209 | | |||
208 | onError: console.log("VirtualKeyboard error: " + msg); | 210 | onError: console.log("VirtualKeyboard error: " + msg); | ||
209 | } | 211 | } | ||
210 | 212 | | |||
213 | DialogChooseLevel { | ||||
214 | id: dialogActivityConfig | ||||
215 | currentActivity: activity.activityInfo | ||||
216 | | ||||
217 | onSaveData: { | ||||
218 | levelFolder = dialogActivityConfig.chosenLevel | ||||
219 | currentActivity.currentLevel = dialogActivityConfig.chosenLevel | ||||
220 | ApplicationSettings.setCurrentLevel(currentActivity.name, dialogActivityConfig.chosenLevel) | ||||
221 | background.start() | ||||
222 | home() | ||||
223 | } | ||||
224 | onClose: { | ||||
225 | home() | ||||
226 | } | ||||
227 | onStartActivity: { | ||||
228 | background.start() | ||||
229 | } | ||||
230 | } | ||||
231 | | ||||
211 | DialogHelp { | 232 | DialogHelp { | ||
212 | id: dialogHelp | 233 | id: dialogHelp | ||
213 | onClose: home() | 234 | onClose: home() | ||
214 | } | 235 | } | ||
215 | 236 | | |||
216 | Bar { | 237 | Bar { | ||
217 | id: bar | 238 | id: bar | ||
218 | anchors.bottom: keyboard.top | 239 | anchors.bottom: keyboard.top | ||
219 | content: BarEnumContent { value: help | home | level } | 240 | content: BarEnumContent { value: help | home | level | activityConfig } | ||
220 | onHelpClicked: { | 241 | onHelpClicked: { | ||
221 | displayDialog(dialogHelp) | 242 | displayDialog(dialogHelp) | ||
222 | } | 243 | } | ||
244 | onActivityConfigClicked: { | ||||
245 | displayDialog(dialogActivityConfig) | ||||
246 | } | ||||
223 | onPreviousLevelClicked: Activity.previousLevel() | 247 | onPreviousLevelClicked: Activity.previousLevel() | ||
224 | onNextLevelClicked: Activity.nextLevel() | 248 | onNextLevelClicked: Activity.nextLevel() | ||
225 | onHomeClicked: activity.home() | 249 | onHomeClicked: activity.home() | ||
226 | } | 250 | } | ||
227 | 251 | | |||
228 | Score { | 252 | Score { | ||
229 | id: score | 253 | id: score | ||
230 | anchors.right: parent.right | 254 | anchors.right: parent.right | ||
Show All 12 Lines |