programmingMaze, code clean-up revision #1
ClosedPublic

Authored by amankumargupta on Apr 18 2018, 8:17 PM.

Details

Summary

On an overview:

  1. Some variable names have been improved and made more meaningful.
  1. Some un-needed/redundant variables are removed.
  1. Keyboard control has been centralised for all the areas.
  1. Large code snippets have been moved to new functions to make the code more modularised.

Diff Detail

Repository
R2 GCompris
Lint
Lint Skipped
Unit
Unit Tests Skipped
amankumargupta created this revision.Apr 18 2018, 8:17 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptApr 18 2018, 8:17 PM
Restricted Application added a subscriber: KDE Edu. · View Herald Transcript
amankumargupta added inline comments.Apr 18 2018, 8:52 PM
src/activities/programmingMaze/AnswerSheet.qml
76

Previously, each code area had their own separate keyboard controls and statements for them and certain statements were redundant. Also additional functions were used to switch the keyboard focus from one to other.

Now, they are centralised. This can be seen in ProgrammingMaze.qml down below for further clarification.

192

This portion of code is moved here from line 243 since, the order pressed --> position changed --> released seems more easy to read code than pressed --> released --> position changed.

src/activities/programmingMaze/ProgrammingMaze.qml
58

This is an un-needed variable. We can use !background.insertIntoMain in its place everywhere.

114

A centralised keyboard control for all areas which reduces redundancy and simplifies the code a lot.

136

On centralising the keyboard control, this function is no longer needed and the concerned statements are now simplified and put in their respective areas and become more easy to read, understand and follow up for everyone.

Also some redundant statements get eliminated.

src/activities/programmingMaze/programmingMaze.js
374

This function contains the code moved here from line 402 - 417 and this function is now called from there,

Note: This is further refactored and simplified a lot in the next diff, making the object creation process same for both: procedure as well as main and have the same behavior for them, which is currently not the case in the present code.

jjazeix accepted this revision.Apr 19 2018, 6:26 AM
This revision is now accepted and ready to land.Apr 19 2018, 6:26 AM