diff options
| author | Tannin <Tannin@Serenity> | 2013-02-03 12:49:25 +0100 |
|---|---|---|
| committer | Tannin <Tannin@Serenity> | 2013-02-03 12:49:25 +0100 |
| commit | 981f8b3acf7e76f27c02f4ced80d55b424cc7497 (patch) | |
| tree | 0f504d99d1e5fe197258febff3c147d0725abda4 /src/tutorials/tutorials.js | |
initial commit to mercurial repository.
Corresponds to MO version 0.12.6
Diffstat (limited to 'src/tutorials/tutorials.js')
| -rw-r--r-- | src/tutorials/tutorials.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/tutorials/tutorials.js b/src/tutorials/tutorials.js new file mode 100644 index 00000000..f2b18856 --- /dev/null +++ b/src/tutorials/tutorials.js @@ -0,0 +1,75 @@ +var tutorialSteps = []
+var waitingForClick = false
+
+
+function highlightItem(widgetName, click) {
+ var rect = tutorialControl.getRect(widgetName)
+ highlight.x = rect.x - 1
+ highlight.y = rect.y - 1
+ highlight.width = rect.width + 2
+ highlight.height = rect.height + 2
+ if (click) {
+ highlight.border.color = "green"
+ } else {
+ highlight.border.color = "blue"
+ }
+ highlight.visible = true
+}
+
+function highlightAction(actionName, click) {
+ var rect = tutorialControl.getActionRect(actionName)
+ highlight.x = rect.x - 1
+ highlight.y = rect.y - 1
+ highlight.width = rect.width + 2
+ highlight.height = rect.height + 2
+ if (click) {
+ highlight.border.color = "green"
+ } else {
+ highlight.border.color = "blue"
+ }
+ highlight.visible = true
+}
+
+function unhighlight()
+{
+ highlight.visible = false
+}
+
+function waitForClick()
+{
+ waitingForClick = true;
+ description.continueVisible = true
+ // ui needs to be locked, otherwise the tutorial-view does not receive mouse-events!
+ tutorialControl.lockUI(true)
+}
+
+function clickNext()
+{
+ if (waitingForClick) {
+ nextStep()
+ }
+}
+
+function nextStep()
+{
+ waitingForClick = false;
+ description.continueVisible = false
+ if (step < tutorialSteps.length) {
+ tutorialControl.lockUI(false)
+ step++
+ tutorialSteps[step - 1]()
+ } else {
+ tutorialControl.finish()
+ }
+}
+
+function init()
+{
+ var res = Qt.include("file:///" + scriptName)
+ if (res.status !== 0) {
+ console.log("failed to load " + scriptName + ": " + res.status)
+ return
+ }
+
+ tutorialSteps = getTutorialSteps()
+}
|
