Replace use of QParams with parameter directives.

This is a blunt translation of QParams code to directives, it could
probably benefit from a comprehensive rewrite at some point. My aim
was to preserve the exiting behavior.

The tests pass.