Fix grab project

This is a grab project refactoring so it can be compiled with MSVC.
Also I make some fixes like add QScopedPointers insetad of raw * pointers.
This patch should be applied after 'fix-math-project' request because it uses math::round() function.