diff --git a/src/activities/algebra_by/Algebra.qml b/src/activities/algebra_by/Algebra.qml --- a/src/activities/algebra_by/Algebra.qml +++ b/src/activities/algebra_by/Algebra.qml @@ -51,7 +51,7 @@ property alias bonus: bonus property alias score: score property alias balloon: balloon - property alias timer:timer + property alias timer: timer property GCSfx audioEffects: activity.audioEffects } @@ -134,7 +134,7 @@ } Flow { - id:textFlow + id: textFlow x: parent.width / 2 - width / 2 y: 80 width: parent.width / 2 diff --git a/src/activities/algebra_div/AlgebraDiv.qml b/src/activities/algebra_div/AlgebraDiv.qml --- a/src/activities/algebra_div/AlgebraDiv.qml +++ b/src/activities/algebra_div/AlgebraDiv.qml @@ -24,7 +24,7 @@ import "../algebra_by/" Algebra { - onStart:{ + onStart: { operand.text = "/" } } diff --git a/src/activities/algebra_minus/AlgebraMinus.qml b/src/activities/algebra_minus/AlgebraMinus.qml --- a/src/activities/algebra_minus/AlgebraMinus.qml +++ b/src/activities/algebra_minus/AlgebraMinus.qml @@ -26,7 +26,7 @@ Algebra { - onStart:{ + onStart: { operand.text = "-" } } diff --git a/src/activities/align4-2players/align4.js b/src/activities/align4-2players/align4.js --- a/src/activities/align4-2players/align4.js +++ b/src/activities/align4-2players/align4.js @@ -57,7 +57,7 @@ items.counter = items.nextPlayerStart+1 - if(items.nextPlayerStart == 1) { + if(items.nextPlayerStart === 1) { items.player2score.endTurn(); items.player1score.beginTurn(); } @@ -154,7 +154,7 @@ function isModelEmpty(model) { var state = model.stateTemp - return (state == "1" || state == "2") ? false : true + return (state === "1" || state === "2") ? false : true } function getPieceAt(col, row) { diff --git a/src/activities/babymatch/DropAnswerItem.qml b/src/activities/babymatch/DropAnswerItem.qml --- a/src/activities/babymatch/DropAnswerItem.qml +++ b/src/activities/babymatch/DropAnswerItem.qml @@ -51,7 +51,7 @@ id: targetImage fillMode: Image.PreserveAspectFit anchors.centerIn: parent - z : -1 + z: -1 } function imageRemove() { diff --git a/src/activities/babymatch/babymatch.js b/src/activities/babymatch/babymatch.js --- a/src/activities/babymatch/babymatch.js +++ b/src/activities/babymatch/babymatch.js @@ -93,14 +93,14 @@ items.score.currentSubLevel = currentSubLevel + 1 items.score.numberOfSubLevels = numberOfSubLevel + 1 - if(levelData.glow == undefined) + if(levelData.glow === undefined) glowEnabled = glowEnabledDefault else glowEnabled = levelData.glow items.toolTip.show('') - if(levelData.instruction == undefined) { + if(levelData.instruction === undefined) { items.instruction.opacity = 0 items.instruction.text = "" } else if(!displayDropCircle) { @@ -132,11 +132,11 @@ "imgSound": levelData.levels[i].soundFile ? soundsUrl + levelData.levels[i].soundFile : "qrc:/gcompris/src/core/resource/sounds/scroll.wav", - "imgHeight": levelData.levels[i].height == undefined ? 0 : levelData.levels[i].height, - "imgWidth": levelData.levels[i].width == undefined ? 0 : levelData.levels[i].width, + "imgHeight": levelData.levels[i].height === undefined ? 0 : levelData.levels[i].height, + "imgWidth": levelData.levels[i].width === undefined ? 0 : levelData.levels[i].width, "toolTipText": // We remove the text before the pipe symbol if any (translation disembiguation) - levelData.levels[i].toolTipText == undefined ? + levelData.levels[i].toolTipText === undefined ? "" : (levelData.levels[i].toolTipText.split('|').length > 1 ? levelData.levels[i].toolTipText.split('|')[1] : @@ -151,7 +151,7 @@ }); } //Create Text pieces for the level which has to display additional information - else if(levelData.levels[i].type == "DisplayText") { + else if(levelData.levels[i].type === "DisplayText") { showText[k++] = textItemComponent.createObject( items.backgroundImage, { "posX": levelData.levels[i].x, @@ -174,8 +174,8 @@ "imgName": levelData.levels[i].pixmapfile, "posX": levelData.levels[i].x, "posY": levelData.levels[i].y, - "imgHeight": levelData.levels[i].height == undefined ? 0 : levelData.levels[i].height, - "imgWidth": levelData.levels[i].width == undefined ? 0 : levelData.levels[i].width, + "imgHeight": levelData.levels[i].height === undefined ? 0 : levelData.levels[i].height, + "imgWidth": levelData.levels[i].width === undefined ? 0 : levelData.levels[i].width, }); } } diff --git a/src/activities/balancebox/Balancebox.qml b/src/activities/balancebox/Balancebox.qml --- a/src/activities/balancebox/Balancebox.qml +++ b/src/activities/balancebox/Balancebox.qml @@ -46,7 +46,7 @@ property bool alwaysStart: true // enforce start signal for editor-to-testing- and returning from config-transition property bool needRestart: true - onWidthChanged:if (inForeground && pageView.currentItem === activity) + onWidthChanged: if (inForeground && pageView.currentItem === activity) Activity.reconfigureScene(); onHeightChanged: if (inForeground && pageView.currentItem === activity) diff --git a/src/activities/balancebox/balancebox.js b/src/activities/balancebox/balancebox.js --- a/src/activities/balancebox/balancebox.js +++ b/src/activities/balancebox/balancebox.js @@ -194,19 +194,19 @@ items.ball.y > ballContacts[k].y - items.ballSize/2 && items.ball.y < ballContacts[k].y + items.ballSize/2) { // collision - if (ballContacts[k].categories == items.holeType) + if (ballContacts[k].categories === items.holeType) finishBall(false, ballContacts[k].x, ballContacts[k].y); - else if (ballContacts[k].categories == items.goalType && goalUnlocked) + else if (ballContacts[k].categories === items.goalType && goalUnlocked) finishBall(true, ballContacts[k].x + (items.cellSize - items.wallSize - items.ballSize)/2, ballContacts[k].y + (items.cellSize - items.wallSize - items.ballSize)/2); - else if (ballContacts[k].categories == items.buttonType) { + else if (ballContacts[k].categories === items.buttonType) { if (!ballContacts[k].pressed - && ballContacts[k].orderNum == lastContact + 1) + && ballContacts[k].orderNum === lastContact + 1) { ballContacts[k].pressed = true; lastContact = ballContacts[k].orderNum; - if (lastContact == contacts.length) { + if (lastContact === contacts.length) { items.audioEffects.play("qrc:/gcompris/src/core/resource/sounds/win.wav"); goalUnlocked = true; goal.imageSource = baseUrl + "/door.svg"; diff --git a/src/activities/ballcatch/Ballcatch.qml b/src/activities/ballcatch/Ballcatch.qml --- a/src/activities/ballcatch/Ballcatch.qml +++ b/src/activities/ballcatch/Ballcatch.qml @@ -233,7 +233,7 @@ top: parent.top topMargin: 10 } - z : 10 + z: 10 index: bar.level === 1 && !(items.leftPressed && items.rightPressed) ? 0 : -1 diff --git a/src/activities/ballcatch/ballcatch.js b/src/activities/ballcatch/ballcatch.js --- a/src/activities/ballcatch/ballcatch.js +++ b/src/activities/ballcatch/ballcatch.js @@ -157,14 +157,14 @@ function processKey(event) { if(!gameFinished) { - if(event.key == Qt.Key_Left) { + if(event.key === Qt.Key_Left) { // left if(!items.leftPressed) { leftShiftPressed(); items.leftPressed = true } } - else if(event.key == Qt.Key_Right) { + else if(event.key === Qt.Key_Right) { // right if(!items.rightPressed) { rightShiftPressed(); diff --git a/src/activities/bargame/bargame.js b/src/activities/bargame/bargame.js --- a/src/activities/bargame/bargame.js +++ b/src/activities/bargame/bargame.js @@ -177,26 +177,26 @@ var boardSize = levelsProperties[items.mode - 1].boardSize; if (moveCount <= (boardSize - 1)) { items.answerBallsPlacement.children[moveCount].visible = true; - if (player == 1) { + if (player === 1) { items.answerBallsPlacement.children[moveCount].source = url + "ball_1.svg"; } else { items.answerBallsPlacement.children[moveCount].source = url + "ball_2.svg"; } } // one of the players has won if (moveCount == (boardSize - 1)) { items.okArea.enabled = false; - if (gameMode == 2) { + if (gameMode === 2) { items.isPlayer1Beginning = !items.isPlayer1Beginning; } - if (player == 2) { + if (player === 2) { items.player1score.win(); items.player2score.endTurn(); items.bonus.good("flower"); } else { items.player1score.endTurn(); items.player2score.win(); - if (gameMode == 1) { + if (gameMode === 1) { items.bonus.bad("flower"); } else { @@ -209,17 +209,17 @@ items.isPlayer1Turn = !items.isPlayer1Turn; - if (player == 1 && gameMode == 1) { + if (player === 1 && gameMode === 1) { items.player1score.endTurn(); items.player2score.beginTurn(); items.okArea.enabled = false; items.trigTuxMove.start(); - } else if (player == 2 && gameMode == 1) { + } else if (player === 2 && gameMode === 1) { items.player2score.endTurn(); items.player1score.beginTurn(); items.okArea.enabled = true; - } else if (gameMode == 2) { - if (player == 1) { + } else if (gameMode === 2) { + if (player === 1) { items.player1score.endTurn(); items.player2score.beginTurn(); } else { diff --git a/src/activities/binary_bulb/BinaryBulb.qml b/src/activities/binary_bulb/BinaryBulb.qml --- a/src/activities/binary_bulb/BinaryBulb.qml +++ b/src/activities/binary_bulb/BinaryBulb.qml @@ -90,17 +90,17 @@ if(event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { Activity.equalityCheck() } - else if(event.key == Qt.Key_Space) { + else if(event.key === Qt.Key_Space) { if(items.currentSelectedBulb != -1) { Activity.changeState(items.currentSelectedBulb) } } - else if(event.key == Qt.Key_Left) { + else if(event.key === Qt.Key_Left) { if(--items.currentSelectedBulb < 0) { items.currentSelectedBulb = items.numberOfBulbs-1 } } - else if(event.key == Qt.Key_Right) { + else if(event.key === Qt.Key_Right) { if(++items.currentSelectedBulb >= items.numberOfBulbs) { items.currentSelectedBulb = 0 } diff --git a/src/activities/braille_alphabets/BrailleMap.qml b/src/activities/braille_alphabets/BrailleMap.qml --- a/src/activities/braille_alphabets/BrailleMap.qml +++ b/src/activities/braille_alphabets/BrailleMap.qml @@ -62,7 +62,7 @@ ] Column { - width: (grid1.width - grid1.spacing * 10) / 10 + width: (grid1.width - grid1.spacing * 10) / 10 Rectangle { id: rect1 diff --git a/src/activities/braille_alphabets/FirstScreen.qml b/src/activities/braille_alphabets/FirstScreen.qml --- a/src/activities/braille_alphabets/FirstScreen.qml +++ b/src/activities/braille_alphabets/FirstScreen.qml @@ -105,7 +105,7 @@ Image { id: introTux - z:3 + z: 3 source: Activity.url + "tux_braille.svg" fillMode: Image.PreserveAspectFit sourceSize.width: parent.width * 0.2 @@ -129,7 +129,7 @@ Rectangle { id: bgTux - z:0 + z: 0 color: "#94c1d2" width: introTux.width * 1.5 height: introTux.height * 1.1 diff --git a/src/activities/categorization/CategoryReview.qml b/src/activities/categorization/CategoryReview.qml --- a/src/activities/categorization/CategoryReview.qml +++ b/src/activities/categorization/CategoryReview.qml @@ -55,7 +55,7 @@ sourceSize.width:parent.width Zone { - id:leftZone + id: leftZone x: 0.012 * middleScreen.width z: 2 y: 0.05 * parent.height diff --git a/src/activities/categorization/MenuScreen.qml b/src/activities/categorization/MenuScreen.qml --- a/src/activities/categorization/MenuScreen.qml +++ b/src/activities/categorization/MenuScreen.qml @@ -62,7 +62,7 @@ home() } - Keys.enabled : (items.mode == "expert") ? false : true + Keys.enabled: (items.mode == "expert") ? false : true Keys.onPressed: { if(event.key === Qt.Key_Space) { menuGrid.currentItem.selectCurrentItem() diff --git a/src/activities/categorization/categorization.js b/src/activities/categorization/categorization.js --- a/src/activities/categorization/categorization.js +++ b/src/activities/categorization/categorization.js @@ -191,7 +191,7 @@ items.categoryReview.score.currentSubLevel ++ } } - if(items.categoryReview.score.currentSubLevel == totalImages) + if(items.categoryReview.score.currentSubLevel === totalImages) items.bonus.good("flower") else items.bonus.bad("flower") @@ -298,8 +298,8 @@ } function dropControl(sourcePosition, destinationPosition, image, index) { - var destinationZone = destinationPosition == "left" ? items.categoryReview.leftZone : destinationPosition == "right" ? items.categoryReview.rightZone : items.categoryReview.middleZone - var sourceZone = sourcePosition == "left" ? items.categoryReview.leftZone : sourcePosition == "right" ? items.categoryReview.rightZone : items.categoryReview.middleZone + var destinationZone = destinationPosition === "left" ? items.categoryReview.leftZone : destinationPosition === "right" ? items.categoryReview.rightZone : items.categoryReview.middleZone + var sourceZone = sourcePosition === "left" ? items.categoryReview.leftZone : sourcePosition === "right" ? items.categoryReview.rightZone : items.categoryReview.middleZone destinationZone.append({"name": image, "droppedZone": destinationPosition}) sourceZone.remove(index) } diff --git a/src/activities/checkers/Checkers.qml b/src/activities/checkers/Checkers.qml --- a/src/activities/checkers/Checkers.qml +++ b/src/activities/checkers/Checkers.qml @@ -204,7 +204,7 @@ Rectangle { - id:boardBg + id: boardBg width: items.cellSize * (items.numberOfCases + 0.2) height: items.cellSize * (items.numberOfCases + 0.2) z: 09 @@ -366,7 +366,7 @@ toPiece.hide(from) movingPiece = fromPiece - if(moves.jumps.length != 0) { + if(moves.jumps.length !== 0) { listJumps = moves.jumps } else { @@ -382,7 +382,7 @@ function getPieceAt(pos) { for(var i=0; i < pieces.count; i++) { - if(pieces.itemAt(i).newPos == pos) + if(pieces.itemAt(i).newPos === pos) return pieces.itemAt(i) } return undefined @@ -422,7 +422,7 @@ var tmp = listJumps listJumps = tmp // only change player once all the jumps have been done - if(listJumps.length == 1) { + if(listJumps.length === 1) { items.movesToDo.shift() if(items.movesToDo.length > 0) { diff --git a/src/activities/checkers/checkers.js b/src/activities/checkers/checkers.js --- a/src/activities/checkers/checkers.js +++ b/src/activities/checkers/checkers.js @@ -166,7 +166,7 @@ } var moves = currentState.moves() - if(moves.length == 0) { + if(moves.length === 0) { return [100, 0]; } var bestScore = -1000; @@ -190,7 +190,7 @@ var bestMoves = [] var newState = new Engine.Draughts(state.fen()) // 0 is b, 1 is b -> w, 2 is b -> w -> b guesses - var depth = currentLevel == 5 ? 2 : 1; + var depth = currentLevel === 5 ? 2 : 1; for(var move in moves) { newState.move(moves[move]); @@ -239,7 +239,7 @@ // In computer mode, the white always starts, take care // of undo after a mate which requires us to revert on // a white play - if(!items.twoPlayer && state.getTurn() == 'b') { + if(!items.twoPlayer && state.getTurn() === 'b') { move = state.undo(); redo_stack.push(move) } @@ -261,7 +261,7 @@ // In computer mode, the white always starts, take care // of undo after a mate which requires us to revert on // a white play - if(!items.twoPlayer && state.getTurn() == 'b') { + if(!items.twoPlayer && state.getTurn() === 'b') { move = redo_stack.pop() moveByEngine(move) } @@ -345,18 +345,18 @@ for(var i = 0; i < position.length; ++i) { var img = position[i] !== '0' && position[i] !== '?' ? position[i] : '' - if(img == '') + if(img === '') continue; - else if(img == 'w') { + else if(img === 'w') { white ++; } - else if(img == 'W') { + else if(img === 'W') { white += queenScore; } - if(img == 'b') { + if(img === 'b') { black ++; } - else if(img == 'B') { + else if(img === 'B') { black += queenScore; } } diff --git a/src/activities/chess/Chess.qml b/src/activities/chess/Chess.qml --- a/src/activities/chess/Chess.qml +++ b/src/activities/chess/Chess.qml @@ -217,7 +217,7 @@ Rectangle { - id:boardBg + id: boardBg width: items.cellSize * 8.2 height: boardBg.width z: 08 @@ -410,7 +410,7 @@ function moveTo(from, to) { var fromPiece = getPieceAt(from) var toPiece = getPieceAt(to) - if(toPiece.img != '') + if(toPiece.img !== '') items.audioEffects.play('qrc:/gcompris/src/core/resource/sounds/smudge.wav') else items.audioEffects.play('qrc:/gcompris/src/core/resource/sounds/scroll.wav') @@ -425,7 +425,7 @@ function getPieceAt(pos) { for(var i=0; i < pieces.count; i++) { - if(pieces.itemAt(i).newPos == pos) + if(pieces.itemAt(i).newPos === pos) return pieces.itemAt(i) } return(undefined) diff --git a/src/activities/chess/Piece.qml b/src/activities/chess/Piece.qml --- a/src/activities/chess/Piece.qml +++ b/src/activities/chess/Piece.qml @@ -30,7 +30,7 @@ z: 10 property string img - property bool acceptMove : false + property bool acceptMove: false property int newPos // color = -1 if no piece, 0 is black and 1 is white property int isWhite: img.length != 2 ? -1 : img[0] == 'w' ? 1 : 0 diff --git a/src/activities/chess/chess.js b/src/activities/chess/chess.js --- a/src/activities/chess/chess.js +++ b/src/activities/chess/chess.js @@ -71,7 +71,7 @@ function simplifiedState(state) { var newState = new Array() for(var i = state.length - 1; i >= 0; --i) { - if(state[i] != 16) { + if(state[i] !== 16) { var img = "" switch(state[i]) { case 2: @@ -134,7 +134,7 @@ items.message = items.blackTurn ? qsTr("White mates", "white wins") : qsTr("Black mates", "black wins") items.gameOver = true if(!items.twoPlayer) - if(state.to_play != 0) + if(state.to_play !== 0) items.bonus.good('gnu') else items.bonus.good('tux') @@ -146,7 +146,7 @@ items.bonus.good('flower') } else if((move.flags & Engine.P4_MOVE_FLAG_CHECK) == Engine.P4_MOVE_FLAG_CHECK) { items.message = items.blackTurn ? qsTr("White checks", "black king is under attack") : qsTr("Black checks", "white king is under attack") - } else if(move.flags == Engine.P4_MOVE_ILLEGAL) { + } else if(move.flags === Engine.P4_MOVE_ILLEGAL) { items.isWarningMessage = true items.message = qsTr("Invalid, your king may be in check") } @@ -196,9 +196,9 @@ items.pieces.moveTo(from + 3, to - 1) else if(move.flags & Engine.P4_MOVE_FLAG_CASTLE_QUEEN) items.pieces.moveTo(from - 4, to + 1) - else if(items.pieces.getPieceAt(to).img == 'wp' && to > 55) + else if(items.pieces.getPieceAt(to).img === 'wp' && to > 55) items.pieces.promotion(to) - else if(items.pieces.getPieceAt(to).img == 'bp' && to < 8) + else if(items.pieces.getPieceAt(to).img === 'bp' && to < 8) items.pieces.promotion(to) } @@ -236,7 +236,7 @@ // In computer mode, the white always starts, take care // of undo after a mate which requires us to revert on // a white play - if(!items.twoPlayer && state.to_play != 0) { + if(!items.twoPlayer && state.to_play !== 0) { redo_stack.push(state.history[state.moveno - 1]) state.jump_to_moveno(state.moveno - 1) } @@ -262,7 +262,7 @@ // In computer mode, the white always starts, take care // of undo after a mate which requires us to revert on // a white play - if(!items.twoPlayer && state.to_play != 0) { + if(!items.twoPlayer && state.to_play !== 0) { items.redoTimer.moveByEngine(items.redo_stack.pop()) } @@ -317,7 +317,7 @@ clearAcceptMove() var fromEngine = viewPosToEngine(from) for(var i=0; i < result.length; ++i) { - if(fromEngine == result[i][1]) { + if(fromEngine === result[i][1]) { var pos = engineToViewPos(result[i][2]) items.squares.getSquareAt(pos)['acceptMove'] = true } diff --git a/src/activities/chess/engine.js b/src/activities/chess/engine.js --- a/src/activities/chess/engine.js +++ b/src/activities/chess/engine.js @@ -403,7 +403,7 @@ captures.push([weight + values[E] + weight_lut[e] + all_weights[E][e], s, e]); } } - if(a == P4_KING && castle_flags){ + if(a === P4_KING && castle_flags){ if((castle_flags & 1) && (board[s-1] + board[s-2] + board[s-3] == 0) && p4_check_castling(board, s - 2,other_colour,dir,-1)){//Q side @@ -473,12 +473,12 @@ enpassant, not 2. */ s = ep - dir - 1; - if (board[s] == pawn){ + if (board[s] === pawn){ taken = values[P4_PAWN] + all_weights[P4_PAWN | other_colour][ep - dir]; captures.push([score - weight_lut[s] + weight_lut[ep] + taken, s, ep]); } s += 2; - if (board[s] == pawn){ + if (board[s] === pawn){ taken = values[P4_PAWN] + all_weights[P4_PAWN | other_colour][ep - dir]; captures.push([score - weight_lut[s] + weight_lut[ep] + taken, s, ep]); } @@ -569,16 +569,16 @@ if((E & diag_mask) == diag_slider) return 0; /*knights on row 7. (row 6 is handled below)*/ - if (board[p + dir - 2] == knight || - board[p + dir + 2] == knight) + if (board[p + dir - 2] === knight || + board[p + dir + 2] === knight) return 0; } /* a pawn or king in any of 5 positions on row 7. * or a knight on row 6. */ for(p = s + dir - 1; p < s + dir + 4; p++){ E = board[p] & grid_mask; - if(E == king_pawn || board[p + dir] == knight) + if(E === king_pawn || board[p + dir] === knight) return 0; } /* scan back row for rooks, queens on the other side. @@ -614,16 +614,16 @@ var s = p[1]; var other_colour = 1 - colour; var dir = 10 - 20 * colour; - if (board[s + dir - 1] == (P4_PAWN | other_colour) || - board[s + dir + 1] == (P4_PAWN | other_colour)) + if (board[s + dir - 1] === (P4_PAWN | other_colour) || + board[s + dir + 1] === (P4_PAWN | other_colour)) return true; var knight_moves = P4_MOVES[P4_KNIGHT]; var king_moves = P4_MOVES[P4_KING]; var knight = P4_KNIGHT | other_colour; var king = P4_KING | other_colour; for (i = 0; i < 8; i++){ - if (board[s + knight_moves[i]] == knight || - board[s + king_moves[i]] == king) + if (board[s + knight_moves[i]] === knight || + board[s + king_moves[i]] === king) return true; } var diagonal_moves = P4_MOVES[P4_BISHOP]; @@ -808,7 +808,7 @@ board[e] = promotion; end_piece = promotion; } - else if (((s ^ e) & 1) && E == 0){ + else if (((s ^ e) & 1) && E === 0){ /*this is a diagonal move, but the end spot is empty, so we surmise enpassant */ ep_position = e - 10 + 20 * moved_colour; ep_taken = board[ep_position]; @@ -1005,7 +1005,7 @@ p4_maybe_prepare(state); var moves = p4_parse(state, colour, state.enpassant, 0); for (i = 0; i < moves.length; i++){ - if (e == moves[i][2] && s == moves[i][1]){ + if (e === moves[i][2] && s === moves[i][1]){ legal = true; break; } @@ -1210,7 +1210,7 @@ var count = 0; for (var x = 1; x < 9; x++){ var piece = board[y * 10 + x]; - if (piece == 0) + if (piece === 0) count++; else{ if (count) @@ -1291,7 +1291,7 @@ var i; for (var j = 0; j < fen_board.length; j++){ var c = fen_board.charAt(j); - if (c == '/'){ + if (c === '/'){ x = 1; y -= 10; if (y < 20) @@ -1520,11 +1520,11 @@ state.enpassant, 0); for (i = 0; i < moves.length; i++){ var mv = moves[i]; - if (e == mv[2]){ + if (e === mv[2]){ s = mv[1]; - if (state.board[s] == piece && - (column === undefined || column == s % 10) && - (row === undefined || row == parseInt(s / 10)) + if (state.board[s] === piece && + (column === undefined || column === s % 10) && + (row === undefined || row === parseInt(s / 10)) ){ var change = p4_make_move(state, s, e, P4_QUEEN); if (! p4_check_check(state, colour)) diff --git a/src/activities/click_on_letter/Carriage.qml b/src/activities/click_on_letter/Carriage.qml --- a/src/activities/click_on_letter/Carriage.qml +++ b/src/activities/click_on_letter/Carriage.qml @@ -63,7 +63,6 @@ carriageBg.verticalCenter : parent.verticalCenter z: 11 - text: letter font.pointSize: NaN // need to clear font.pointSize explicitly font.pixelSize: parent.width * 0.65 @@ -85,13 +84,13 @@ } Image { - id:softFailure + id: softFailure z: 12 source: "qrc:/gcompris/src/activities/tic_tac_toe/resource/cross.svg" width: parent.width height: width anchors.centerIn: text - opacity:0 + opacity: 0 visible: ApplicationInfo.useOpenGL ? false : true } @@ -120,7 +119,8 @@ PropertyChanges { target: carriageItem scale: /*carriageImage.scale * */ 1.2 - z: 2} + z: 2 + } } transitions: Transition { @@ -144,8 +144,8 @@ target: carriageImage easing.type: Easing.InOutQuad property: "rotation" - to: 0 - duration: 50 } + to: 0; duration: 50 + } } SequentialAnimation { diff --git a/src/activities/click_on_letter/ClickOnLetter.qml b/src/activities/click_on_letter/ClickOnLetter.qml --- a/src/activities/click_on_letter/ClickOnLetter.qml +++ b/src/activities/click_on_letter/ClickOnLetter.qml @@ -275,7 +275,6 @@ Image { id: engine source: Activity.url + "engine.svg" - anchors.bottom: railway.bottom anchors.left: railway.left anchors.leftMargin: 10 * ApplicationInfo.ratio @@ -287,7 +286,6 @@ Image { id: smoke source: Activity.url + "smoke.svg" - anchors.bottom: engine.top anchors.left: railway.left anchors.leftMargin: 10 * ApplicationInfo.ratio diff --git a/src/activities/click_on_letter/click_on_letter.js b/src/activities/click_on_letter/click_on_letter.js --- a/src/activities/click_on_letter/click_on_letter.js +++ b/src/activities/click_on_letter/click_on_letter.js @@ -200,7 +200,7 @@ function checkAnswer(index) { var modelEntry = items.trainModel.get(index); - if (modelEntry.letter == currentLetter) { + if (modelEntry.letter === currentLetter) { playLetter(modelEntry.letter); items.bonus.good("flower"); return true diff --git a/src/activities/clickgame/Clickgame.qml b/src/activities/clickgame/Clickgame.qml --- a/src/activities/clickgame/Clickgame.qml +++ b/src/activities/clickgame/Clickgame.qml @@ -58,7 +58,9 @@ Timer { id: timer - interval: 5000; running: true; repeat: true + interval: 5000 + running: true + repeat: true onTriggered: activity.audioEffects.play("qrc:/gcompris/src/activities/clickgame/resource/bubble.wav") } diff --git a/src/activities/colors/findit.js b/src/activities/colors/findit.js --- a/src/activities/colors/findit.js +++ b/src/activities/colors/findit.js @@ -32,7 +32,7 @@ var hasWon function start(items_, dataset_, mode_) { - if (mode_ == "Colors") + if (mode_ === "Colors") Core.checkForVoices(items_.background); items = items_ dataset = dataset_.get() diff --git a/src/activities/digital_electricity/DigitalElectricity.qml b/src/activities/digital_electricity/DigitalElectricity.qml --- a/src/activities/digital_electricity/DigitalElectricity.qml +++ b/src/activities/digital_electricity/DigitalElectricity.qml @@ -53,25 +53,25 @@ } Keys.onPressed: { - if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && okButton.enabled) { + if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && okButton.enabled) { Activity.checkAnswer() } - if (event.key == Qt.Key_Plus) { + if (event.key === Qt.Key_Plus) { Activity.zoomIn() } - if (event.key == Qt.Key_Minus) { + if (event.key === Qt.Key_Minus) { Activity.zoomOut() } - if (event.key == Qt.Key_Right) { + if (event.key === Qt.Key_Right) { playArea.x -= 200; } - if (event.key == Qt.Key_Left) { + if (event.key === Qt.Key_Left) { playArea.x += 200 } - if (event.key == Qt.Key_Up) { + if (event.key === Qt.Key_Up) { playArea.y += 200 } - if (event.key == Qt.Key_Down) { + if (event.key === Qt.Key_Down) { playArea.y -= 200 } if (playArea.x >= mousePan.drag.maximumX) { diff --git a/src/activities/explore_farm_animals/AnimalLevels.qml b/src/activities/explore_farm_animals/AnimalLevels.qml --- a/src/activities/explore_farm_animals/AnimalLevels.qml +++ b/src/activities/explore_farm_animals/AnimalLevels.qml @@ -62,11 +62,9 @@ Image { id: star - x: animalImg.width / 2.5 y: animalImg.height * 0.8 visible: false - source:"qrc:/gcompris/src/core/resource/star.png" } @@ -85,7 +83,7 @@ } var questionTargetId = items.questionOrder[Activity.items.progressbar.value] Activity.items.instruction.visible = false - if (Activity.items.score.currentSubLevel == 1) { + if (Activity.items.score.currentSubLevel === 1) { if(animalImg.audio) { audioVoices.play(animalImg.audio); } diff --git a/src/activities/football/Football.qml b/src/activities/football/Football.qml --- a/src/activities/football/Football.qml +++ b/src/activities/football/Football.qml @@ -139,7 +139,7 @@ color: "blue" anchors.top: border.top anchors.left: border.right - z:10 + z: 10 opacity: 0.3 } } diff --git a/src/activities/gletters/FallingDomino.qml b/src/activities/gletters/FallingDomino.qml --- a/src/activities/gletters/FallingDomino.qml +++ b/src/activities/gletters/FallingDomino.qml @@ -70,7 +70,7 @@ return var chars = text.split(""); - if (chars[unmatchedIndex] == c) { + if (chars[unmatchedIndex] === c) { unmatchedIndex++; return true; } else { diff --git a/src/activities/gletters/FallingImage.qml b/src/activities/gletters/FallingImage.qml --- a/src/activities/gletters/FallingImage.qml +++ b/src/activities/gletters/FallingImage.qml @@ -60,7 +60,6 @@ property: "opacity" to: 0 duration: 1000 - onStopped: Activity.deleteWord(word); } @@ -71,7 +70,7 @@ return var chars = text.split(""); - if (chars[unmatchedIndex] == c) { + if (chars[unmatchedIndex] === c) { unmatchedIndex++; return true; } else { diff --git a/src/activities/gletters/FallingWord.qml b/src/activities/gletters/FallingWord.qml --- a/src/activities/gletters/FallingWord.qml +++ b/src/activities/gletters/FallingWord.qml @@ -75,7 +75,6 @@ property: "opacity" to: 0 duration: 1000 - onStopped: Activity.deleteWord(word); } @@ -91,7 +90,7 @@ return (text === c) } else { var chars = text.split(""); - if (chars[unmatchedIndex] == c) { + if (chars[unmatchedIndex] === c) { unmatchedIndex++; return true; } else { @@ -114,7 +113,6 @@ GCText { id: wordText - text: "" fontSize: 35 font.bold: true @@ -129,9 +127,7 @@ GCText { id: highlightedWordText - anchors.fill: parent - text: "" fontSize: parent.fontSize font.bold: parent.font.bold diff --git a/src/activities/gletters/Gletters.qml b/src/activities/gletters/Gletters.qml --- a/src/activities/gletters/Gletters.qml +++ b/src/activities/gletters/Gletters.qml @@ -232,23 +232,19 @@ Score { id: score - anchors.top: undefined anchors.topMargin: 10 * ApplicationInfo.ratio anchors.right: parent.right anchors.rightMargin: 10 * ApplicationInfo.ratio anchors.bottom: keyboard.top } VirtualKeyboard { - id: keyboard - + id: keyboard anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter width: parent.width - - onKeypress: Activity.processKeyPress(text) - + onKeypress: Activity.processKeyPress(text) onError: console.log("VirtualKeyboard error: " + msg); } diff --git a/src/activities/gnumch-equality/Monster.qml b/src/activities/gnumch-equality/Monster.qml --- a/src/activities/gnumch-equality/Monster.qml +++ b/src/activities/gnumch-equality/Monster.qml @@ -30,7 +30,7 @@ property var player function checkCell() { - if (index == player.index) { + if (index === player.index) { player.getCaught(-1) eating = true } diff --git a/src/activities/gnumch-equality/WarnMonster.qml b/src/activities/gnumch-equality/WarnMonster.qml --- a/src/activities/gnumch-equality/WarnMonster.qml +++ b/src/activities/gnumch-equality/WarnMonster.qml @@ -25,7 +25,7 @@ import "../../core" Rectangle { - property var text : warningText + property var text: warningText width: warningText.contentWidth * 1.1 height: warningText.height * 1.1 diff --git a/src/activities/gnumch-equality/Warning.qml b/src/activities/gnumch-equality/Warning.qml --- a/src/activities/gnumch-equality/Warning.qml +++ b/src/activities/gnumch-equality/Warning.qml @@ -43,7 +43,7 @@ property var mArea: area function setFault(index) { - if (index == -1) { + if (index === -1) { fault = qsTr("You were eaten by a Troggle.") + "
" return } @@ -58,7 +58,7 @@ fault += num1 + " - " + num2 + " = " + (num1 - num2) } } else if (activity.type == "primes") { - if (num1 == 1) { + if (num1 === 1) { fault += qsTr("1 is not a prime number.") return } diff --git a/src/activities/lang/ImageReview.qml b/src/activities/lang/ImageReview.qml --- a/src/activities/lang/ImageReview.qml +++ b/src/activities/lang/ImageReview.qml @@ -364,7 +364,7 @@ } function nextPressed() { - if(currentMiniGame == 0) { + if(currentMiniGame === 0) { nextSubLevel() } } diff --git a/src/activities/louis-braille/LouisBraille.qml b/src/activities/louis-braille/LouisBraille.qml --- a/src/activities/louis-braille/LouisBraille.qml +++ b/src/activities/louis-braille/LouisBraille.qml @@ -170,7 +170,7 @@ anchors.topMargin: 5 * ApplicationInfo.ratio GCText { - id:info + id: info color: "black" anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter diff --git a/src/activities/magic-hat-plus/MagicHatPlus.qml b/src/activities/magic-hat-plus/MagicHatPlus.qml --- a/src/activities/magic-hat-plus/MagicHatPlus.qml +++ b/src/activities/magic-hat-plus/MagicHatPlus.qml @@ -24,6 +24,6 @@ import "../../core" import "../magic-hat-minus/" -MagicHat{ +MagicHat { mode: "plus" } diff --git a/src/activities/mazerelative/Mazerelative.qml b/src/activities/mazerelative/Mazerelative.qml --- a/src/activities/mazerelative/Mazerelative.qml +++ b/src/activities/mazerelative/Mazerelative.qml @@ -21,6 +21,7 @@ */ import QtQuick 2.6 import "../maze" + Maze { relativeMode: true } diff --git a/src/activities/memory/CardItem.qml b/src/activities/memory/CardItem.qml --- a/src/activities/memory/CardItem.qml +++ b/src/activities/memory/CardItem.qml @@ -142,7 +142,7 @@ Behavior on opacity { NumberAnimation { duration: 1000 } } - states : [ + states: [ State { name: "front" PropertyChanges { target: rotation; angle: 180 } diff --git a/src/activities/note_names/NoteNames.qml b/src/activities/note_names/NoteNames.qml --- a/src/activities/note_names/NoteNames.qml +++ b/src/activities/note_names/NoteNames.qml @@ -148,7 +148,7 @@ } onVisibleChanged: { - if(Activity.targetNotes[0] == undefined) + if(Activity.targetNotes[0] === undefined) text = "" else if(items.isTutorialMode) text = qsTr("New note: %1").arg(getTranslatedNoteName(Activity.targetNotes[0])) diff --git a/src/activities/penalty/Penalty.qml b/src/activities/penalty/Penalty.qml --- a/src/activities/penalty/Penalty.qml +++ b/src/activities/penalty/Penalty.qml @@ -87,7 +87,7 @@ property alias progressTop: progressTop property alias bonus: bonus property int duration : 0 - property int progressBarOpacity : 40 + property int progressBarOpacity: 40 property string saveBallState: "INITIAL" property double ballX: ball.parent.width/2 - ball.width/2 property double ballY: ball.parent.height*0.77 - ball.height/2 diff --git a/src/activities/piano_composition/Piano_composition.qml b/src/activities/piano_composition/Piano_composition.qml --- a/src/activities/piano_composition/Piano_composition.qml +++ b/src/activities/piano_composition/Piano_composition.qml @@ -93,11 +93,11 @@ function findBlackKey(keyNumber) { for(var i = 0; keyNumber; i++) { - if(piano.keyRepeater.itemAt(i) == undefined) + if(piano.keyRepeater.itemAt(i) === undefined) break if(piano.keyRepeater.itemAt(i).blackKey.visible) keyNumber-- - if(keyNumber == 0) + if(keyNumber === 0) piano.keyRepeater.itemAt(i).blackKey.keyPressed() } } @@ -284,7 +284,7 @@ function addMusicElementAndPushToStack(noteName, noteType, elementType) { if(noteType === "Rest") elementType = "rest" - else if(elementType == undefined) + else if(elementType === undefined) elementType = "note" var tempModel = multipleStaff.createNotesBackup() diff --git a/src/activities/play_piano/PlayPiano.qml b/src/activities/play_piano/PlayPiano.qml --- a/src/activities/play_piano/PlayPiano.qml +++ b/src/activities/play_piano/PlayPiano.qml @@ -83,7 +83,7 @@ function findBlackKey(keyNumber) { for(var i = 0; keyNumber; i++) { - if(piano.keyRepeater.itemAt(i) == undefined) + if(piano.keyRepeater.itemAt(i) === undefined) break if(piano.keyRepeater.itemAt(i).blackKey.visible) keyNumber-- diff --git a/src/activities/readingh/Readingh.qml b/src/activities/readingh/Readingh.qml --- a/src/activities/readingh/Readingh.qml +++ b/src/activities/readingh/Readingh.qml @@ -121,7 +121,7 @@ var oldLocale = background.locale; var newLocale = dialogActivityConfig.configItem.availableLangs[dialogActivityConfig.loader.item.localeBox.currentIndex].locale; // Remove .UTF-8 - if(newLocale.indexOf('.') != -1) { + if(newLocale.indexOf('.') !== -1) { newLocale = newLocale.substring(0, newLocale.indexOf('.')) } dataToSave = { diff --git a/src/activities/redraw/Redraw.qml b/src/activities/redraw/Redraw.qml --- a/src/activities/redraw/Redraw.qml +++ b/src/activities/redraw/Redraw.qml @@ -74,7 +74,7 @@ if(event.key >= Qt.Key_0 && event.key < Qt.Key_0 + items.numberOfColor) items.colorSelector = event.key - Qt.Key_0 - if(event.key == Qt.Key_Backspace) + if(event.key === Qt.Key_Backspace) userModel.clearCurrentItem() } Keys.onEnterPressed: userModel.paintCurrentItem() diff --git a/src/activities/roman_numerals/RomanNumerals.qml b/src/activities/roman_numerals/RomanNumerals.qml --- a/src/activities/roman_numerals/RomanNumerals.qml +++ b/src/activities/roman_numerals/RomanNumerals.qml @@ -173,7 +173,7 @@ } function initSubLevel() { - if(dataset[currentLevel].values[0] == '_random_') { + if(dataset[currentLevel].values[0] === '_random_') { questionValue = Math.round(Math.random() * dataset[currentLevel].values[1] + 1) score.numberOfSubLevels = dataset[currentLevel].values[2] } else { diff --git a/src/activities/submarine/Submarine.qml b/src/activities/submarine/Submarine.qml --- a/src/activities/submarine/Submarine.qml +++ b/src/activities/submarine/Submarine.qml @@ -58,41 +58,41 @@ /* Testing purposes, A / Left Key => Reduces velocity, D / Right Key => Increases velocity */ Keys.onPressed: { - if ((event.key == Qt.Key_D || event.key == Qt.Key_Right) && !tutorial.visible) { + if ((event.key === Qt.Key_D || event.key === Qt.Key_Right) && !tutorial.visible) { submarine.increaseHorizontalVelocity(1) } - if ((event.key == Qt.Key_A || event.key == Qt.Key_Left) && !tutorial.visible) { + if ((event.key === Qt.Key_A || event.key === Qt.Key_Left) && !tutorial.visible) { submarine.decreaseHorizontalVelocity(1) } - if ((event.key == Qt.Key_W || event.key == Qt.Key_Up) && !tutorial.visible) { + if ((event.key === Qt.Key_W || event.key === Qt.Key_Up) && !tutorial.visible) { centralBallastTank.fillBallastTanks() controls.updateVannes(centralBallastTank.waterFilling, controls.rotateCentralFill) } - if ((event.key == Qt.Key_S || event.key == Qt.Key_Down) && !tutorial.visible) { + if ((event.key === Qt.Key_S || event.key === Qt.Key_Down) && !tutorial.visible) { centralBallastTank.flushBallastTanks() controls.updateVannes(centralBallastTank.waterFlushing, controls.rotateCentralFlush) } - if ((event.key == Qt.Key_Plus) && !tutorial.visible) { + if ((event.key === Qt.Key_Plus) && !tutorial.visible) { submarine.increaseWingsAngle(1) } - if ((event.key == Qt.Key_Minus) && !tutorial.visible) { + if ((event.key === Qt.Key_Minus) && !tutorial.visible) { submarine.decreaseWingsAngle(1) } - if ((event.key == Qt.Key_R) && !tutorial.visible) { + if ((event.key === Qt.Key_R) && !tutorial.visible) { leftBallastTank.fillBallastTanks() controls.updateVannes(leftBallastTank.waterFilling, controls.rotateLeftFill) } - if ((event.key == Qt.Key_F) && !tutorial.visible) { + if ((event.key === Qt.Key_F) && !tutorial.visible) { leftBallastTank.flushBallastTanks() controls.updateVannes(leftBallastTank.waterFlushing, controls.rotateLeftFlush) } - if ((event.key == Qt.Key_T) && !tutorial.visible) { + if ((event.key === Qt.Key_T) && !tutorial.visible) { rightBallastTank.fillBallastTanks() controls.updateVannes(rightBallastTank.waterFilling, controls.rotateRightFill) } - if ((event.key == Qt.Key_G) && !tutorial.visible) { + if ((event.key === Qt.Key_G) && !tutorial.visible) { rightBallastTank.flushBallastTanks() controls.updateVannes(rightBallastTank.waterFlushing, controls.rotateRightFlush) } @@ -475,10 +475,10 @@ onBeginContact: { var collidedObject = other.getBody().target - if (collidedObject == whale) { + if (collidedObject === whale) { whale.hit() } - if (collidedObject == crown) { + if (collidedObject === crown) { crown.captureCrown() } else { Activity.finishLevel(false) diff --git a/src/activities/sudoku/Sudoku.qml b/src/activities/sudoku/Sudoku.qml --- a/src/activities/sudoku/Sudoku.qml +++ b/src/activities/sudoku/Sudoku.qml @@ -158,18 +158,18 @@ var id = x + y * sudoColumn.rows; // Only color if we can modify the case - if(sudokuModel.get(id).mState == "default") + if(sudokuModel.get(id).mState === "default") sudokuModel.get(id).mState = "hovered"; // Restore previous case if different from the new one if(previousHoveredCase != id) { - if(previousHoveredCase != -1 && sudokuModel.get(previousHoveredCase).mState == "hovered") + if(previousHoveredCase != -1 && sudokuModel.get(previousHoveredCase).mState === "hovered") sudokuModel.get(previousHoveredCase).mState = "default" previousHoveredCase = id } } onExited: { - if(previousHoveredCase != -1 && sudokuModel.get(previousHoveredCase).mState == "hovered") + if(previousHoveredCase != -1 && sudokuModel.get(previousHoveredCase).mState === "hovered") sudokuModel.get(previousHoveredCase).mState = "default" previousHoveredCase = -1 } diff --git a/src/activities/target/Target.qml b/src/activities/target/Target.qml --- a/src/activities/target/Target.qml +++ b/src/activities/target/Target.qml @@ -139,7 +139,7 @@ if(userEntry.text.length === 0) { userEntry.text = "?" } else { - if(targetItem.scoreTotal == userEntry.text) + if(targetItem.scoreTotal === userEntry.text) bonus.good("flower") } } @@ -164,7 +164,7 @@ userEntry.text += text - if(targetItem.scoreTotal == userEntry.text) + if(targetItem.scoreTotal === userEntry.text) bonus.good("flower") } diff --git a/src/activities/traffic/Traffic.qml b/src/activities/traffic/Traffic.qml --- a/src/activities/traffic/Traffic.qml +++ b/src/activities/traffic/Traffic.qml @@ -180,7 +180,6 @@ Score { id: score - anchors.top: parent.top anchors.topMargin: 10 * ApplicationInfo.ratio anchors.right: parent.right diff --git a/src/core/Tutorial.qml b/src/core/Tutorial.qml --- a/src/core/Tutorial.qml +++ b/src/core/Tutorial.qml @@ -56,8 +56,7 @@ property var tutorialDetails /* Do we use image or qml files for illustrations */ - - property bool useImage : true + property bool useImage: true // Emitted when skipButton is clicked signal skipPressed @@ -166,7 +165,7 @@ // Image component for tutorial instructions Image { id: tutorialImage - enabled: useImage + visible: useImage width: parent.width * 0.8 height: (parent.height - nextButton.height) * 0.48 fillMode: Image.PreserveAspectFit @@ -177,7 +176,7 @@ horizontalCenter: parent.horizontalCenter } } - + // Alternative QML component for tutorial instructions Loader { id: tutorialQml @@ -191,5 +190,4 @@ horizontalCenter: parent.horizontalCenter } } - }