Fix formatting in generate.sh


Some code used two spaces, while most of the code uses four.
Some parts even used three!

Consistently use four spaces to improve readability.
As a drive-by: add the missing `function` keyword to some function
declarations.

Change-Id: Iadbe23a76af6e131529c085c1de37eb49ac4aab6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
commit55f247d11137b7526c7d4e8e33a37cba4d9fee08
parent09bf1d0797a451bb4f76798cfc60c6316ce12239
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeTue, 5 Aug 2025 15:15:47 +0200