Changeset View
Changeset View
Standalone View
Standalone View
src/core/Tutorial.qml
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 46 | Item { | |||
---|---|---|---|---|---|
51 | * Counter for tutorial instructions | 51 | * Counter for tutorial instructions | ||
52 | */ | 52 | */ | ||
53 | property int tutorialNumber: 0 | 53 | property int tutorialNumber: 0 | ||
54 | 54 | | |||
55 | /* Container for all the tutorial instructions */ | 55 | /* Container for all the tutorial instructions */ | ||
56 | property var tutorialDetails | 56 | property var tutorialDetails | ||
57 | 57 | | |||
58 | /* Do we use image or qml files for illustrations */ | 58 | /* Do we use image or qml files for illustrations */ | ||
59 | | ||||
60 | property bool useImage : true | 59 | property bool useImage: true | ||
61 | 60 | | |||
62 | // Emitted when skipButton is clicked | 61 | // Emitted when skipButton is clicked | ||
63 | signal skipPressed | 62 | signal skipPressed | ||
64 | 63 | | |||
65 | // Emitted when nextButton is clicked | 64 | // Emitted when nextButton is clicked | ||
66 | signal nextPressed | 65 | signal nextPressed | ||
67 | 66 | | |||
68 | // Emitted when previousButton is clicked | 67 | // Emitted when previousButton is clicked | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 159 | onClicked: { | |||
161 | tutorialSection.visible = false | 160 | tutorialSection.visible = false | ||
162 | skipPressed() | 161 | skipPressed() | ||
163 | } | 162 | } | ||
164 | } | 163 | } | ||
165 | 164 | | |||
166 | // Image component for tutorial instructions | 165 | // Image component for tutorial instructions | ||
167 | Image { | 166 | Image { | ||
168 | id: tutorialImage | 167 | id: tutorialImage | ||
169 | enabled: useImage | 168 | visible: useImage | ||
170 | width: parent.width * 0.8 | 169 | width: parent.width * 0.8 | ||
171 | height: (parent.height - nextButton.height) * 0.48 | 170 | height: (parent.height - nextButton.height) * 0.48 | ||
172 | fillMode: Image.PreserveAspectFit | 171 | fillMode: Image.PreserveAspectFit | ||
173 | source: tutorialDetails && useImage ? tutorialDetails[tutorialNumber].instructionImage : "" | 172 | source: tutorialDetails && useImage ? tutorialDetails[tutorialNumber].instructionImage : "" | ||
174 | anchors { | 173 | anchors { | ||
175 | top: previousButton.bottom | 174 | top: previousButton.bottom | ||
176 | topMargin: 10 | 175 | topMargin: 10 | ||
177 | horizontalCenter: parent.horizontalCenter | 176 | horizontalCenter: parent.horizontalCenter | ||
178 | } | 177 | } | ||
179 | } | 178 | } | ||
180 | 179 | | |||
181 | // Alternative QML component for tutorial instructions | 180 | // Alternative QML component for tutorial instructions | ||
182 | Loader { | 181 | Loader { | ||
183 | id: tutorialQml | 182 | id: tutorialQml | ||
184 | enabled: !tutorialImage.visible | 183 | enabled: !tutorialImage.visible | ||
185 | width: parent.width * 0.8 | 184 | width: parent.width * 0.8 | ||
186 | height: (parent.height - nextButton.height) * 0.48 | 185 | height: (parent.height - nextButton.height) * 0.48 | ||
187 | source: tutorialDetails && !useImage ? tutorialDetails[tutorialNumber].instructionQml : "" | 186 | source: tutorialDetails && !useImage ? tutorialDetails[tutorialNumber].instructionQml : "" | ||
188 | anchors { | 187 | anchors { | ||
189 | top: previousButton.bottom | 188 | top: previousButton.bottom | ||
190 | topMargin: 10 | 189 | topMargin: 10 | ||
191 | horizontalCenter: parent.horizontalCenter | 190 | horizontalCenter: parent.horizontalCenter | ||
192 | } | 191 | } | ||
193 | } | 192 | } | ||
194 | | ||||
195 | } | 193 | } |