[Refactor] Remove unnecessary undefs
[Refactor] Whitespace changes
[Refactor] Fix up all braceless Qt foreach blocks

It's dangerous enough doing braceless if/else/for/while ... Some of
these had nested if loops, and comments sandwiched in between, so I'm
concerned if they were even being parsed correctly.