From 981f8b3acf7e76f27c02f4ced80d55b424cc7497 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 3 Feb 2013 12:49:25 +0100 Subject: initial commit to mercurial repository. Corresponds to MO version 0.12.6 --- src/tutorials/tutorials.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/tutorials/tutorials.js (limited to 'src/tutorials/tutorials.js') 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() +} -- cgit v1.3.1