Commit f3afd95a authored by Timothée Giet's avatar Timothée Giet

algebra, gletters, smallnumbers, wordsgame, some cleaning in Options

parent b1da8995
......@@ -56,21 +56,15 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 5
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -56,21 +56,15 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 5
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -57,21 +57,15 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 5
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -57,21 +57,15 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 5
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -77,7 +77,6 @@ Item {
}
property var dataToSave
function setDefaultValues() {
// Recreate the binding
uppercaseBox.checked = Qt.binding(function(){return activityConfiguration.uppercaseOnly;})
......@@ -96,35 +95,26 @@ Item {
}
activityConfiguration.locale = localeUtf8
activityConfiguration.uppercaseOnly = (dataToSave.uppercaseMode === "true")
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 10
}
}
function saveValues() {
var configHasChanged = false
var oldLocale = activityConfiguration.locale;
var newLocale = activityConfiguration.availableLangs[activityConfiguration.localeBox.currentIndex].locale;
// Remove .UTF-8
if(newLocale.indexOf('.') != -1) {
newLocale = newLocale.substring(0, newLocale.indexOf('.'))
}
var oldUppercaseMode = activityConfiguration.uppercaseOnly
activityConfiguration.uppercaseOnly = activityConfiguration.uppercaseBox.checked
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"locale": newLocale, "uppercaseMode": "" + activityConfiguration.uppercaseOnly, "speedSetting": speedSetting}
activityConfiguration.locale = newLocale;
if(oldLocale !== newLocale || oldUppercaseMode !== activityConfiguration.uppercaseOnly || oldSpeed !== speedSetting) {
configHasChanged = true;
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -57,21 +57,15 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 10
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
......@@ -75,21 +75,22 @@ Item {
property var dataToSave
function setDefaultValues() {
speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
activityConfiguration.speedSetting = dataToSave.speedSetting
for(var i = 0 ; i < availableModes.length ; i++) {
if(availableModes[i].value === dataToSave["mode"]) {
modeBox.currentIndex = i;
break;
}
}
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 10
}
}
function saveValues() {
var configHasChanged = false
var oldSpeed = activityConfiguration.speedSetting
var newMode = availableModes[modeBox.currentIndex].value;
speedSetting = speedSlider.value
dataToSave = {"speedSetting": speedSetting}
if (oldSpeed !== speedSetting) {
configHasChanged = true
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
dataToSave = {"mode": newMode, "speedSetting": speedSetting}
}
}
......@@ -95,35 +95,26 @@ Item {
}
activityConfiguration.locale = localeUtf8
activityConfiguration.uppercaseOnly = (dataToSave.uppercaseMode === "true")
activityConfiguration.speedSetting = dataToSave.speedSetting
if(dataToSave.speedSetting) {
activityConfiguration.speedSetting = dataToSave.speedSetting
}
else {
activityConfiguration.speedSetting = 10
}
}
function saveValues() {
var configHasChanged = false
var oldLocale = activityConfiguration.locale;
var newLocale = activityConfiguration.availableLangs[activityConfiguration.localeBox.currentIndex].locale;
// Remove .UTF-8
if(newLocale.indexOf('.') != -1) {
newLocale = newLocale.substring(0, newLocale.indexOf('.'))
}
var oldUppercaseMode = activityConfiguration.uppercaseOnly
activityConfiguration.uppercaseOnly = activityConfiguration.uppercaseBox.checked
var oldSpeed = activityConfiguration.speedSetting
speedSetting = speedSlider.value
dataToSave = {"locale": newLocale, "uppercaseMode": "" + activityConfiguration.uppercaseOnly, "speedSetting": speedSetting}
activityConfiguration.locale = newLocale;
if(oldLocale !== newLocale || oldUppercaseMode !== activityConfiguration.uppercaseOnly || oldSpeed !== speedSetting) {
configHasChanged = true;
}
// Restart the activity with new information
if(configHasChanged) {
background.stop();
background.start();
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment