D12329: programmingMaze, code clean-up revision #1
Aman Kumar Gupta
noreply at phabricator.kde.org
Wed Apr 18 20:52:21 UTC 2018
amankumargupta added inline comments.
INLINE COMMENTS
> AnswerSheet.qml:76
> + signal tabKeyPressed
> + signal deleteKeyPressed
>
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.
> AnswerSheet.qml:192
> +
> + onPositionChanged: {
> + var newPos = codeArea.indexAt(mouseX, mouseY)
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.
> ProgrammingMaze.qml:58
> property bool insertIntoMain: true
> - property bool insertIntoProcedure: false
> property alias items: items
This is an un-needed variable. We can use !background.insertIntoMain in its place everywhere.
> ProgrammingMaze.qml:114
> + Keys.enabled: items.isTuxMouseAreaEnabled || items.isRunCodeEnabled
> + Keys.onPressed: {
> + activity.keyboardNavigationVisible = true
A centralised keyboard control for all areas which reduces redundancy and simplifies the code a lot.
> ProgrammingMaze.qml:136
>
> - function changeFocus(currentCodeArea) {
> - if(currentCodeArea === "main") {
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.
> programmingMaze.js:374
> + */
> +function createProcedureObjects() {
> + procedureObject = instructionComponents[CALL_PROCEDURE].createObject(items.background)
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.
REPOSITORY
R2 GCompris
REVISION DETAIL
https://phabricator.kde.org/D12329
To: amankumargupta, #gcompris_improvements
Cc: #kde_edu, #gcompris_improvements, himanshuvishwakarma, harrymecwan, ganeshredcobra, nityanandkumar, echarruau, rahulyadav, narvaez, scagarwal, apol, timotheegiet, hkaelberer, jjazeix, bcoudoin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180418/565b6b22/attachment.html>
More information about the kde-edu
mailing list